Oracle Fusion Middleware Java API Reference for Oracle Data Visualization Components
11g Release 1 (11.1.1)

E12063-04

oracle.dss.gauge
Class GaugeEngine

java.lang.Object
  extended by oracle.dss.gauge.GaugeEngine

public class GaugeEngine
extends java.lang.Object

For internal use only. Application developers should not use this
Represents the control for a single Gauge.

Field Summary
protected  java.awt.Shape _gaugeSetClip
           
protected static double ASCENT_TEXT_HEIGHT
           
static int BORDER_ONLY
           
protected static int DEFAULT_OBJECTLIST_SIZE
           
static int FILL_AND_BORDER
           
static int FILL_ONLY
           
 
Constructor Summary
GaugeEngine(java.util.Map propMap)
           
GaugeEngine(java.util.Map propMap, int gaugeType)
          Constructor with a property map.
 
Method Summary
protected  java.lang.String[] _getFlashToolTipText(int filter, int compType, int compIndex)
          Generates tooltips based on the given filter for Flash.
protected  java.lang.String[] _getPNGToolTipText(int filter, int compType, int compIndex)
          Generates tooltips based on the given filter for PNG.
protected  int _getPowerOfTen(double dValue)
           
protected static java.awt.Polygon _processImagemapPolygon(DrawableObject obj)
          Handles the various types of shapes that need to be added to the imageMap vector.
protected  java.awt.Dimension autoLayout(java.awt.Graphics2D g, java.awt.Rectangle rect)
          Figures out the size of the gauge based on the size of each component.
 java.awt.Dimension calcGaugeSize(java.awt.Graphics2D g, java.awt.Dimension maxSize)
          Calculates the actual size required by this gauge taking into account all the current attribute settings and given the maximum size available for the gauge.
protected  void determineFormat(boolean metricLabel)
          Based on the min and max values, determine the best scale for the view format of the given component
protected  java.lang.String formatValue(java.lang.Double data, java.lang.String viewFormatKey)
          Formats the given value base on the current locale and the current setting of the number type property.
 java.lang.Object getAttribute(java.lang.String name)
          This method provides a single means of retrieving attribute values of gauge components.
protected static java.lang.String getCompNameForImagemapEnumeration(int compType)
          Get the name for the given component type.
 ErrorHandler getErrorHandler()
           
 java.lang.String getErrorIntlString(java.lang.String key)
           
 java.awt.Graphics2D getGraphics()
           
protected  java.lang.String getId()
           
 java.util.Enumeration getImagemapEnumeration(java.awt.Graphics2D g, int filter)
          Retrieves the enumeration of specific kinds of components that are currently in use and visible on the gauge.
protected  double getIncrement()
          Gets the major tick mark increment value
protected static java.lang.Object getIndicatorAttr(java.util.Map map, java.lang.String attr, int index)
          This function is used when you need to get the attribute for indicators But don't use this function for indicator base
protected  java.lang.Object getIndicatorAttr(java.lang.String attr, int index)
          This function is used when you need to get the attribute for indicators But don't use this function for indicator base.
protected static int getIndicatorColumn(java.util.Map map, int index)
          Retrieves the column index in the data set for each indicator
protected static int getIndicatorRow(java.util.Map map, int index)
          Retrieves the row index in the data set for each indicator
 java.lang.String getIntlString(java.lang.String key, java.util.ResourceBundle bundle)
           
 java.lang.String getIntlStringFromUtilBundle(java.lang.String key)
           
 java.util.Locale getLocale()
          returns the Locale for this GaugeEngine.
 double getMax()
           
protected  int getMaxNumberOfSteps()
           
protected  java.lang.Double getMetric()
          Gets the first metric value
protected  java.lang.Double getMetric(int i)
          Gets a specific metric value, it takes care of array out of bound
protected  double getMetricMax()
          Gets the maximum metric among the metrics
protected  double getMetricMin()
          Gets the minimum metric among the metrics
protected  java.lang.Double[] getMetrics()
          Gets the array of metric values
protected  int getMetricSize()
          Gets the number of metric values
 double getMin()
           
protected  double getMinorIncrement()
          Gets the minor tick mark increment value
protected  int getMinorNumberOfSteps()
          Gets the minor tick mark increment value
protected  int getNumberOfSteps()
           
protected  java.awt.Rectangle getOuterBounds()
           
protected static int getThresholdColumn(java.util.Map map, int index)
          Retrieves the column index in the data set for each Threshold
protected static int getThresholdRow(java.util.Map map, int index)
          Retrieves the row index in the data set for each Threshold
 java.lang.String getToolTipText(java.awt.Point pt)
          Retrieves the tooltip text for the component under the given point.
protected  boolean isNullMetric()
           
protected  boolean prepareObjects(java.awt.Graphics2D g)
          Prepares the objects in this gauge by following the render process without actually rendering the objects.
protected  void prepareViewFormats()
           
protected static void putIndicatorAttr(java.util.Map map, java.lang.String attr, java.lang.Object value, int index)
          This function is used when you need to put the attribute for indicators But don't use this function for indicator base
 boolean render(java.awt.Graphics2D g)
          Renders this gauge using the given instance of Graphics2D.
 boolean render(java.awt.Graphics2D g, GaugeExportXMLWriter writer, int mode)
           
 boolean render(java.awt.Graphics2D g, GaugeSVGWriter writer, int mode)
          This method renders this gauge onto the given instance of OutputStream.
 int selectObject(java.awt.Point pt)
          Selects the object under the given point, as well as all objects in this engine of equal component type
 void setAttribute(java.lang.String name, java.lang.Object value)
          This method provides a single means of setting attribute values of gauge components.
protected  void setBackgroundClip(java.awt.Shape clipShape)
           
protected  void setCustomShapesParser(CustomShapesParser parser)
          Sets the engine's customShapesParser.
 void setDVTResources(DVTResources res)
           
 void setErrorHandler(ErrorHandler eh)
           
protected  void setId(java.lang.String id)
           
protected  void setInnerBounds(java.awt.Rectangle innerBounds)
           
 void setLocale(java.util.Locale loc)
          Specifies the Locale for this GaugeEngine.
 boolean setSelectedObject(int type)
          Toggles the selection state for all objects of the given type.
static java.awt.Rectangle trimRectToText(java.awt.Graphics2D g, java.awt.Font font, int x, int y, int width, int height)
           
protected  void updateResourceBundle()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_OBJECTLIST_SIZE

protected static final int DEFAULT_OBJECTLIST_SIZE
See Also:
Constant Field Values

BORDER_ONLY

public static int BORDER_ONLY

FILL_ONLY

public static int FILL_ONLY

FILL_AND_BORDER

public static int FILL_AND_BORDER

_gaugeSetClip

protected java.awt.Shape _gaugeSetClip

ASCENT_TEXT_HEIGHT

protected static double ASCENT_TEXT_HEIGHT
Constructor Detail

GaugeEngine

public GaugeEngine(java.util.Map propMap)

GaugeEngine

public GaugeEngine(java.util.Map propMap,
                   int gaugeType)
Constructor with a property map. Both data and attributes can be included in this map.

Method Detail

getErrorHandler

public ErrorHandler getErrorHandler()

setErrorHandler

public void setErrorHandler(ErrorHandler eh)

getId

protected java.lang.String getId()

setId

protected void setId(java.lang.String id)

getIntlString

public java.lang.String getIntlString(java.lang.String key,
                                      java.util.ResourceBundle bundle)

getIntlStringFromUtilBundle

public java.lang.String getIntlStringFromUtilBundle(java.lang.String key)

getErrorIntlString

public java.lang.String getErrorIntlString(java.lang.String key)

setDVTResources

public void setDVTResources(DVTResources res)

getLocale

public java.util.Locale getLocale()
returns the Locale for this GaugeEngine.

Returns:
The Locale for this GaugeEngine.

setLocale

public void setLocale(java.util.Locale loc)
Specifies the Locale for this GaugeEngine.

Parameters:
loc - The Locale for this GaugeEngine.

updateResourceBundle

protected void updateResourceBundle()

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
This method provides a single means of retrieving attribute values of gauge components. Valid constants for the name parameter can be found in the GaugeAttributes interface.

Parameters:
name - String representation of the attribute name to retrieve.
Returns:
Object containing the value of the property given.

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
This method provides a single means of setting attribute values of gauge components. Valid constants for the name parameter can be found in the GaugeAttributes interface.

Parameters:
name - String representation of the attribute name to set.
value - Object containing the value of the property.

calcGaugeSize

public java.awt.Dimension calcGaugeSize(java.awt.Graphics2D g,
                                        java.awt.Dimension maxSize)
Calculates the actual size required by this gauge taking into account all the current attribute settings and given the maximum size available for the gauge.

Parameters:
g - Instance of Graphics2D
maxSize - The maximum size available for the gauge
Returns:
Required size for the gauge. This will either be less than or equal to the maxSize, or null if the given size is too small to fit the gauge.

getToolTipText

public java.lang.String getToolTipText(java.awt.Point pt)
Retrieves the tooltip text for the component under the given point.

Parameters:
pt - Instance of Point
Returns:
Tooltip in a String instance

render

public boolean render(java.awt.Graphics2D g)
Renders this gauge using the given instance of Graphics2D. If components of this gauge have not been prepared in advance by calling this method or the prepare method, prepareComponents will be called to save the list of components for later render calls.

Parameters:
g - Instance of Graphics2D
Returns:
True if the rendering was successful, False if there was a problem.

render

public boolean render(java.awt.Graphics2D g,
                      GaugeSVGWriter writer,
                      int mode)
This method renders this gauge onto the given instance of OutputStream. SVG writers use this method.

Parameters:
mode - specifies what to include in SVG; constants are defined in GaugeConstants and begin with SVG_MODE_
writer - Instance of GaugeSVGWriter to use
g - Instance of Graphics2D
Returns:
True if the gauge components rendered successfully, False if they could not.

render

public boolean render(java.awt.Graphics2D g,
                      GaugeExportXMLWriter writer,
                      int mode)
Parameters:
mode - specifies what to include in XML; not currently used
writer - Instance of GaugeExportXMLWriter to use
g - Instance of Graphics2D
Returns:
True if the gauge components rendered successfully, False if they could not.
For internal use only. Application developers should not use this
This method renders this gauge onto the given instance of OutputStream. ExportXML writers use this method.

getGraphics

public java.awt.Graphics2D getGraphics()
Returns:
Graphics2D instance
For internal use only. Application developers should not use this
Returns the Graphics2D object used by this engine

getOuterBounds

protected java.awt.Rectangle getOuterBounds()
Returns:
Rectangle instance
For internal use only. Application developers should not use this
Returns the bounds for this entire gauge

setBackgroundClip

protected void setBackgroundClip(java.awt.Shape clipShape)

selectObject

public int selectObject(java.awt.Point pt)
Selects the object under the given point, as well as all objects in this engine of equal component type

Parameters:
pt - Instance of Point
Returns:
compType Type of component to which this object belongs; valid values are constants in the GaugeConstants class beginning with ID_

setSelectedObject

public boolean setSelectedObject(int type)
Toggles the selection state for all objects of the given type.

Parameters:
type - Integer representing the type of objects to select; Valid values are constants in the GaugeConstants beginning with ID_
Returns:
True if the objects were selected, False if the objects couldn't be selected

trimRectToText

public static java.awt.Rectangle trimRectToText(java.awt.Graphics2D g,
                                                java.awt.Font font,
                                                int x,
                                                int y,
                                                int width,
                                                int height)
Parameters:
g - Instance of Graphics2D
font - Font to use in trimming the rectangle; if null, the current font in use by the Gauge graphics object is used
x - Left bound of the label to be drawn
y - Top bound of the label to be drawn
width - Width of the label to be drawn
height - Height of the label to be drawn
Returns:
Rectangle Label bounds approximately trimmed to only the drawn text
For internal use only. Application developers should not use this
Trims the given rectangle bounds to remove whitespace around actual drawn text. This trimming is approximate, based on results that use the default font in varying sizes, as well as with Arial and Serif using varying sizes.

getImagemapEnumeration

public java.util.Enumeration getImagemapEnumeration(java.awt.Graphics2D g,
                                                    int filter)
Retrieves the enumeration of specific kinds of components that are currently in use and visible on the gauge. The enumeration provides an ImagemapComponent object for each gauge object. Each ImagemapComponent object contains the ComponentHandle and the Polygon for that gauge component. The ComponentHandle contains information about the component, and the Polygon contains information about the component's position on the gauge.

Parameters:
g - Instance of Graphics2D
filter - One or more bitwise values specifying the kinds of gauge components to enumerate. Valid values are constants in the GaugeConstants class beginning with MAP_.
Returns:
Enumeration of the specified kinds of gauge components.
See Also:
DataviewConstants, ImagemapComponent

getCompNameForImagemapEnumeration

protected static java.lang.String getCompNameForImagemapEnumeration(int compType)
Get the name for the given component type.

Parameters:
compType - component type
Returns:
name for given component type

autoLayout

protected java.awt.Dimension autoLayout(java.awt.Graphics2D g,
                                        java.awt.Rectangle rect)
Figures out the size of the gauge based on the size of each component. Each gauge type will be responsible for determining this figure, which should include the total space taken up by the gauge, including any labels around it.

Parameters:
rect - Rectangle in which to base the layout

prepareObjects

protected boolean prepareObjects(java.awt.Graphics2D g)
Prepares the objects in this gauge by following the render process without actually rendering the objects. Each of the objects is generated as an instance of DrawableObject, and the list of DrawableObject instances is saved in the GaugeEngine for future render or getImageMapEnumeration invocations.

Parameters:
g - Instance of Graphics2D
Returns:
True if the preparation was successful, False if there was a problem.

prepareViewFormats

protected void prepareViewFormats()

setCustomShapesParser

protected void setCustomShapesParser(CustomShapesParser parser)
Sets the engine's customShapesParser. The CustomShapesParser is also set on this object's GaugeType instance.

Parameters:
parser -
For internal use only. Application developers should not use this

_processImagemapPolygon

protected static java.awt.Polygon _processImagemapPolygon(DrawableObject obj)
Handles the various types of shapes that need to be added to the imageMap vector. These shapes are converted to a Polygon.

Parameters:
obj -
Returns:
Polygon

getIndicatorRow

protected static int getIndicatorRow(java.util.Map map,
                                     int index)
Retrieves the row index in the data set for each indicator

Parameters:
map - the gauge attribute map
index - the indicator index
Returns:
the row index in the data set

getIndicatorColumn

protected static int getIndicatorColumn(java.util.Map map,
                                        int index)
Retrieves the column index in the data set for each indicator

Parameters:
map - the gauge attribute map
index - the indicator index
Returns:
the column index in the data set

getThresholdRow

protected static int getThresholdRow(java.util.Map map,
                                     int index)
Retrieves the row index in the data set for each Threshold

Parameters:
map - the gauge attribute map
index - the Threshold index
Returns:
the row index in the data set

getThresholdColumn

protected static int getThresholdColumn(java.util.Map map,
                                        int index)
Retrieves the column index in the data set for each Threshold

Parameters:
map - the gauge attribute map
index - the Threshold index
Returns:
the column index in the data set

_getFlashToolTipText

protected java.lang.String[] _getFlashToolTipText(int filter,
                                                  int compType,
                                                  int compIndex)
Generates tooltips based on the given filter for Flash.

Parameters:
filter - Bitwise integer with valid bits from the GaugeConstants class starting with MAP_.
Returns:
Array of Strings with tooltips

_getPNGToolTipText

protected java.lang.String[] _getPNGToolTipText(int filter,
                                                int compType,
                                                int compIndex)
Generates tooltips based on the given filter for PNG.

Parameters:
filter - Bitwise integer with valid bits from the GaugeConstants class starting with MAP_.
Returns:
Array of Strings with tooltips

getMin

public double getMin()

getMax

public double getMax()

isNullMetric

protected boolean isNullMetric()

getMetric

protected java.lang.Double getMetric()
Gets the first metric value

Returns:
the first metric

getMetrics

protected java.lang.Double[] getMetrics()
Gets the array of metric values

Returns:
the array of metrics

getMetric

protected java.lang.Double getMetric(int i)
Gets a specific metric value, it takes care of array out of bound

Parameters:
i - the index of the metric
Returns:
the metric

getMetricSize

protected int getMetricSize()
Gets the number of metric values

Returns:
the size of metrics

getMetricMax

protected double getMetricMax()
Gets the maximum metric among the metrics

Returns:
The maximum metric

getMetricMin

protected double getMetricMin()
Gets the minimum metric among the metrics

Returns:
The minimum metric

getIncrement

protected double getIncrement()
Gets the major tick mark increment value

Returns:
the increment value

getMinorIncrement

protected double getMinorIncrement()
Gets the minor tick mark increment value

Returns:
the increment value

getMinorNumberOfSteps

protected int getMinorNumberOfSteps()
Gets the minor tick mark increment value

Returns:
the increment value

getNumberOfSteps

protected int getNumberOfSteps()

getMaxNumberOfSteps

protected int getMaxNumberOfSteps()

putIndicatorAttr

protected static void putIndicatorAttr(java.util.Map map,
                                       java.lang.String attr,
                                       java.lang.Object value,
                                       int index)
This function is used when you need to put the attribute for indicators But don't use this function for indicator base

Parameters:
map - The attribute map of gauge
attr - The indicator attribute to be set
value - The value for that attribute
index - The index of the indicator

getIndicatorAttr

protected static java.lang.Object getIndicatorAttr(java.util.Map map,
                                                   java.lang.String attr,
                                                   int index)
This function is used when you need to get the attribute for indicators But don't use this function for indicator base

Parameters:
map - The attribute map of gauge
attr - The indicator attribute to be set
index - The index of the indicator
Returns:
the object of the value

getIndicatorAttr

protected java.lang.Object getIndicatorAttr(java.lang.String attr,
                                            int index)
This function is used when you need to get the attribute for indicators But don't use this function for indicator base. Use the map from the gauge engine

Parameters:
attr - The indicator attribute to be set
index - The index of the indicator
Returns:
the object of the value

_getPowerOfTen

protected int _getPowerOfTen(double dValue)

determineFormat

protected void determineFormat(boolean metricLabel)
Based on the min and max values, determine the best scale for the view format of the given component

Parameters:
metricLabel - if true determines format for metric label

formatValue

protected java.lang.String formatValue(java.lang.Double data,
                                       java.lang.String viewFormatKey)
Formats the given value base on the current locale and the current setting of the number type property.

Parameters:
data - Value to format
viewFormatKey - ViewFormat to use in formatting value
Returns:
String-based representation of the value

setInnerBounds

protected void setInnerBounds(java.awt.Rectangle innerBounds)

Oracle Fusion Middleware Java API Reference for Oracle Data Visualization Components
11g Release 1 (11.1.1)

E12063-04

Copyright © 1997, 2010, Oracle. All rights reserved.