public abstract class GaugeType
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.awt.Rectangle |
_bottomLabelBounds |
protected java.awt.Dimension |
_btmLblDim |
protected CustomShapesParser |
_csParser |
protected GaugeEngine |
_engine |
protected java.util.ResourceBundle |
_gaugeBundle |
protected java.awt.Rectangle |
_gaugeFrameBounds |
protected boolean |
_hasLowerReflection |
protected java.awt.Rectangle |
_innerBounds |
protected GaugeLayout |
_layout |
protected java.awt.Dimension |
_lowerFrameDim |
protected java.awt.Rectangle |
_lowerLabelFrameBounds |
protected java.awt.Dimension |
_metLblDim |
protected java.awt.Rectangle |
_metricLabelBounds |
protected java.awt.geom.AffineTransform |
_moveTransform |
protected java.awt.geom.AffineTransform |
_scaleTransform |
protected java.awt.Rectangle |
_titleSeparatorBounds |
protected java.awt.Rectangle |
_topLabelBounds |
protected java.awt.Dimension |
_topLblDim |
protected java.awt.Dimension |
_upperFrameDim |
protected java.awt.Rectangle |
_upperLabelFrameBounds |
protected java.util.ResourceBundle |
_utilBundle |
protected static java.lang.String |
DEF_TICK_LABEL |
protected static int |
DIR_BOTTOM |
protected static int |
DIR_LEFT |
protected static int |
DIR_RIGHT |
protected static int |
DIR_TOP |
protected static int |
HEIGHT_LOWERLABELFRAME_REFLECTION |
protected static int |
HEIGHT_TITLESEPARATOR |
protected static java.lang.String |
LABEL_SPACE |
protected static int |
LED_GAUGESET_GAP |
protected static boolean |
m_bBlended |
protected java.util.Locale |
m_locale |
protected static double |
SHADOW_OFFSET |
protected static int |
TICK_MARK_LENGTH |
Constructor and Description |
---|
GaugeType(GaugeEngine engine) |
Modifier and Type | Method and Description |
---|---|
protected java.awt.Color |
_blendColors(java.awt.Color a,
java.awt.Color b) |
protected void |
_calcCustomShapesLabelBounds()
Calculates and saves the bounding box for the labels and frames if they
are defined in the Custom Shapes definition file.
|
protected void |
_calcLabelDimensions(java.util.Map map,
java.awt.Graphics2D g)
Calculates and stores the dimensions of each label.
|
protected java.awt.Color |
_getIndicatorColor(java.util.Map map,
boolean autoColor) |
protected java.awt.Color |
_getIndicatorColor(java.util.Map map,
boolean autoColor,
int ind) |
protected java.awt.Rectangle |
_getMetricLabelBounds(java.awt.Rectangle outerBounds,
java.util.Map map,
java.awt.Graphics2D g)
Returns the bounding box for the metricLabel based on the currently available
information.
|
protected java.awt.Rectangle |
_getPlotAreaBounds(java.awt.Rectangle gaugeFrameBounds,
java.util.Map map,
java.awt.Graphics2D g)
Calculates and returns the bounding box of the plotArea.
|
protected int |
_getPlotAreaCenter(java.util.Map map) |
protected java.awt.Rectangle |
_getTopLabelBounds(java.awt.Rectangle outerBounds,
java.util.Map map)
Returns the bounding box for the topLabel based on the currently available
information.
|
protected java.awt.Rectangle |
_getUpperLabelFrameBounds(java.awt.Rectangle labelBounds,
java.util.Map map)
Returns the bounding box for the upperLabelFrame based on the currently available
information.
|
protected static boolean |
_hasGaugeFrame(java.util.Map map) |
protected java.awt.Dimension |
autoLayout(java.awt.Graphics2D g,
java.awt.Rectangle rect,
java.util.Map map)
Figures out the size of the gauge based on the size of each
component.
|
protected static DrawableObject |
createTickMark(java.awt.geom.Point2D pt,
double angle,
int length,
java.awt.Color color,
int position) |
protected java.util.Collection |
getBackgroundObject(java.util.Map map,
java.awt.Rectangle outerBounds,
java.awt.Shape gaugeSetClip)
Generates a background object.
|
protected int |
getFrameHeight(java.awt.Graphics2D g,
java.awt.Font f)
Returns the height of the label frame for a label with given font and height
|
protected abstract java.util.Collection |
getGaugeFrameObject(java.util.Map map)
Generates the
DrawableObject instances necessary
to render the frame behind the gauge. |
protected abstract java.util.Collection |
getGaugeLinkObject(java.util.Map map,
java.awt.Rectangle outerBounds)
Generates the
DrawableObject instances necessary
to render the frame behind the gauge. |
protected abstract int |
getGaugeRadius(int availWidth,
int availHeight)
Allows a gauge type to determine the radius of the gauge.
|
protected int |
getGaugeSetGap(java.util.Map map,
java.awt.Graphics2D g,
int dir)
Returns the space between gauges in a gaugeSet, and the space bordering
each gauge.
|
abstract int |
getGaugeType()
Returns the type of this gauge type implementation.
|
protected abstract java.util.Collection |
getIndicatorObject(java.util.Map map,
int metricIndex)
Generates the
DrawableObject instances necessary to render an Indicator. |
protected abstract java.awt.Rectangle |
getInnerBounds(java.util.Map map,
java.awt.Rectangle rect,
int reqAboveSpace,
int reqBelowSpace,
int reqLeftSpace,
int reqRightSpace)
Allows a gauge type implementation to determine the area
in which to draw the actual gauge.
|
protected java.util.Collection |
getLabelObjects(java.util.Map map,
java.awt.Rectangle outerBounds)
Generates the
DrawableObject instances
necessary to render gauge labels. |
protected abstract int |
getMaxNumberOfSteps()
Allows a customization of the maximum number of steps
to use for the tick labels and marks for this gauge type.
|
protected abstract DrawableObject |
getNoDataLabelObject(java.util.Map map)
Generates the
DrawableObject instances necessary to render a No Data label. |
protected java.util.Collection<DrawableObject> |
getOverlayEffectObjects(java.util.Map map)
Generates the
DrawableObject instances for any overlay
effects on the gauge. |
protected abstract java.util.Collection |
getPlotAreaObject(java.util.Map map,
int type)
Generates the
DrawableObject instances necessary to render a PlotArea. |
protected static java.awt.geom.AffineTransform |
getScalingTransform(java.awt.Shape s,
java.awt.Rectangle bounds)
Returns a AffineTransform that will scale the Shape s so that it will
fit inside of the Rectangle bounds.
|
protected static java.awt.geom.AffineTransform |
getScalingTransform(java.awt.Shape s,
java.awt.Rectangle bounds,
boolean flip)
Returns a AffineTransform that will scale the Shape s so that it will
fit inside of the Rectangle bounds.
|
protected int |
getSpaceAboveGauge(java.util.Map map,
java.awt.Graphics2D g)
Calculates the space needed above the gauge
based on the attributes in the given map.
|
protected int |
getSpaceBelowGauge(java.util.Map map,
java.awt.Graphics2D g)
Calculates the space needed below the gauge
based on the attributes in the given map.
|
protected int |
getSpaceLeftOfGauge(java.util.Map map,
java.awt.Graphics2D g)
Calculates the space needed to the left of the gauge
based on the attributes in the given map.
|
protected int |
getSpaceRightOfGauge(java.util.Map map,
java.awt.Graphics2D g)
Calculates the space needed to the right of the gauge
based on the attributes in the given map.
|
protected static java.lang.Object |
getThresholdAttribute(java.util.Map map,
int index,
java.lang.Object attr)
Returns the intended attribute from the threshold attributes map
|
protected abstract java.util.Collection |
getTickLabelObjects(java.util.Map map)
Generates the
DrawableObject instances necessary to render Tick Labels. |
protected int |
getTickLabelWidth(java.util.Map map,
java.awt.Graphics2D g,
java.lang.String tickType)
Returns the width of the value of the given tick label type,
or the width of the default tick label (represented by
GaugeType.DEF_TICK_LABEL).
|
protected abstract java.util.Collection |
getTickMarkObjects(java.util.Map map)
Generates the
DrawableObject instances necessary to render Tick Marks. |
protected static java.awt.geom.AffineTransform |
getTranslateTransform(java.awt.Shape s,
java.awt.Rectangle bounds,
java.awt.geom.AffineTransform scale)
Returns a AffineTransform that will translate the Shape s so that it will
be centered at the center of the Rectangle bounds.
|
protected void |
setCustomShapesParser(CustomShapesParser parser)
Sets the GaugeType's customShapesParser.
|
void |
setLocale(java.util.Locale loc)
Specifies the
Locale for this Gauge . |
protected void |
updateResourceBundle() |
protected static java.lang.String DEF_TICK_LABEL
protected static java.lang.String LABEL_SPACE
protected static double SHADOW_OFFSET
protected static int TICK_MARK_LENGTH
protected static final int LED_GAUGESET_GAP
protected static final int HEIGHT_LOWERLABELFRAME_REFLECTION
protected static final int HEIGHT_TITLESEPARATOR
protected static final int DIR_TOP
protected static final int DIR_BOTTOM
protected static final int DIR_LEFT
protected static final int DIR_RIGHT
protected static final boolean m_bBlended
protected GaugeEngine _engine
protected CustomShapesParser _csParser
protected GaugeLayout _layout
protected java.awt.Rectangle _innerBounds
protected java.awt.Rectangle _gaugeFrameBounds
protected java.awt.Rectangle _lowerLabelFrameBounds
protected java.awt.Rectangle _upperLabelFrameBounds
protected java.awt.Rectangle _bottomLabelBounds
protected java.awt.Rectangle _topLabelBounds
protected java.awt.Rectangle _metricLabelBounds
protected java.awt.Rectangle _titleSeparatorBounds
protected java.awt.Dimension _btmLblDim
protected java.awt.Dimension _metLblDim
protected java.awt.Dimension _topLblDim
protected java.awt.Dimension _upperFrameDim
protected java.awt.Dimension _lowerFrameDim
protected boolean _hasLowerReflection
protected java.awt.geom.AffineTransform _scaleTransform
protected java.awt.geom.AffineTransform _moveTransform
protected java.util.ResourceBundle _gaugeBundle
protected java.util.ResourceBundle _utilBundle
protected java.util.Locale m_locale
public GaugeType(GaugeEngine engine)
protected java.util.Collection getBackgroundObject(java.util.Map map, java.awt.Rectangle outerBounds, java.awt.Shape gaugeSetClip)
map
- Map of attributes for this gaugeouterBounds
- Rectangle in which objects can be drawngaugeSetClip
- Shape clipping area of the entire gaugeSetDrawableObject
instancesprotected static DrawableObject createTickMark(java.awt.geom.Point2D pt, double angle, int length, java.awt.Color color, int position)
pt
- Point at which tick mark should originateangle
- Angle at which tick mark should be drawnlength
- Length of tick markcolor
- Color of tick markposition
- Position of the tickMark: TLP_INTERIOR or TLP_EXTERIORpublic abstract int getGaugeType()
protected abstract java.util.Collection getPlotAreaObject(java.util.Map map, int type)
DrawableObject
instances necessary to render a PlotArea.map
- Map of attributes for this gaugetype
- Type of plot area to generate. Can be FILL_ONLY,
BORDER_ONLY, and FILL_AND_BORDERDrawableObject
instancesprotected abstract java.util.Collection getIndicatorObject(java.util.Map map, int metricIndex)
DrawableObject
instances necessary to render an Indicator.map
- Map of attributes for this gaugemetricIndex
- Index of the indicatorDrawableObject
instancesprotected abstract java.util.Collection getTickLabelObjects(java.util.Map map)
DrawableObject
instances necessary to render Tick Labels.map
- Map of attributes for this gaugeDrawableObject
instancesprotected abstract java.util.Collection getTickMarkObjects(java.util.Map map)
DrawableObject
instances necessary to render Tick Marks.map
- Map of attributes for this gaugeDrawableObject
instancesprotected abstract java.util.Collection getGaugeFrameObject(java.util.Map map)
DrawableObject
instances necessary
to render the frame behind the gauge.map
- Map of attributes for this gaugeDrawableObject
instancesprotected abstract java.util.Collection getGaugeLinkObject(java.util.Map map, java.awt.Rectangle outerBounds)
DrawableObject
instances necessary
to render the frame behind the gauge.map
- Map of attributes for this gaugeouterBounds
- Rectangle representing gauge and its backgroundDrawableObject
instancesprotected java.util.Collection<DrawableObject> getOverlayEffectObjects(java.util.Map map)
DrawableObject
instances for any overlay
effects on the gauge.map
- Map of attributes for this gaugeDrawableObject
instancesprotected static java.lang.Object getThresholdAttribute(java.util.Map map, int index, java.lang.Object attr)
map
- Instance of Map
index
- Index of thresholdattr
- Attribute to retrieveprotected java.util.Collection getLabelObjects(java.util.Map map, java.awt.Rectangle outerBounds)
DrawableObject
instances
necessary to render gauge labels.map
- Map of attributes for this gaugeouterBounds
- Rectangle in which the entire gauge
and surrounding objects are drawnDrawableObject
instancesprotected abstract DrawableObject getNoDataLabelObject(java.util.Map map)
DrawableObject
instances necessary to render a No Data label.map
- Map of attributes for this gaugeDrawableObject
instancesprotected java.awt.Dimension autoLayout(java.awt.Graphics2D g, java.awt.Rectangle rect, java.util.Map map)
rect
- Rectangle in which to base the layoutmap
- attribute mapprotected int getSpaceAboveGauge(java.util.Map map, java.awt.Graphics2D g)
map
- Map instance containing gauge attributesg
- Instance of Graphics2D to use for various
font calculationsprotected int getSpaceBelowGauge(java.util.Map map, java.awt.Graphics2D g)
map
- Map instance containing gauge attributesg
- Instance of Graphics2D to use for various
font calculationsprotected int getSpaceLeftOfGauge(java.util.Map map, java.awt.Graphics2D g)
map
- Map instance containing gauge attributesg
- Instance of Graphics2D to use for various
font calculationsprotected int getSpaceRightOfGauge(java.util.Map map, java.awt.Graphics2D g)
map
- Map instance containing gauge attributesg
- Instance of Graphics2D to use for various
font calculationsprotected int getGaugeSetGap(java.util.Map map, java.awt.Graphics2D g, int dir)
map
- Map instance containing gauge attributesg
- Instance of Graphics2D to use for various
font calculationsdir
- int gap for which side of the gaugeprotected abstract int getGaugeRadius(int availWidth, int availHeight)
availHeight
- Integer representing the height
available for drawing the actual gaugeavailWidth
- Integer representing the width
available for drawing the actual gaugeprotected abstract java.awt.Rectangle getInnerBounds(java.util.Map map, java.awt.Rectangle rect, int reqAboveSpace, int reqBelowSpace, int reqLeftSpace, int reqRightSpace)
reqRightSpace
- Integer indicating the space required
to the right of the gaugereqLeftSpace
- Integer indicating the space required
to the left of the gaugereqBelowSpace
- Integer indicating the space required
below the gaugereqAboveSpace
- Integer indicating the space required
above the gaugerect
- Rectangle indicating the initial working areaprotected abstract int getMaxNumberOfSteps()
protected int getTickLabelWidth(java.util.Map map, java.awt.Graphics2D g, java.lang.String tickType)
tickType
- Type of tick label to measure; valid constants
are one of the following constants in
GaugeAttributes: MIN_VALUE, MAX_VALUE, and
METRIC.g
- Graphics2D instancemap
- Map of values for this gaugeprotected void setCustomShapesParser(CustomShapesParser parser)
parser
- protected static java.awt.geom.AffineTransform getScalingTransform(java.awt.Shape s, java.awt.Rectangle bounds)
s
- the shape to be modifybounds
- the bound of the shapeprotected static java.awt.geom.AffineTransform getScalingTransform(java.awt.Shape s, java.awt.Rectangle bounds, boolean flip)
s
- the shape to be modifybounds
- the bound of the shapeflip
- whether this shape is horizontally flipped or notprotected static java.awt.geom.AffineTransform getTranslateTransform(java.awt.Shape s, java.awt.Rectangle bounds, java.awt.geom.AffineTransform scale)
s
- bounds
- scale
- protected void _calcCustomShapesLabelBounds()
protected java.awt.Rectangle _getTopLabelBounds(java.awt.Rectangle outerBounds, java.util.Map map)
outerBounds
- Rectangle bounding box used for allocating space in the gaugemap
- Map containing attribute valuesprotected java.awt.Rectangle _getUpperLabelFrameBounds(java.awt.Rectangle labelBounds, java.util.Map map)
labelBounds
- Rectangle bounding box of the contained labelmap
- Map containing attribute valuesprotected java.awt.Rectangle _getMetricLabelBounds(java.awt.Rectangle outerBounds, java.util.Map map, java.awt.Graphics2D g)
outerBounds
- Rectangle bounding box used for allocating space in the gaugemap
- Map containing attribute valuesprotected java.awt.Rectangle _getPlotAreaBounds(java.awt.Rectangle gaugeFrameBounds, java.util.Map map, java.awt.Graphics2D g)
gaugeFrameBounds
- map
- protected int getFrameHeight(java.awt.Graphics2D g, java.awt.Font f)
g
- f
- protected static boolean _hasGaugeFrame(java.util.Map map)
protected int _getPlotAreaCenter(java.util.Map map)
protected void _calcLabelDimensions(java.util.Map map, java.awt.Graphics2D g)
map
- g
- protected java.awt.Color _getIndicatorColor(java.util.Map map, boolean autoColor)
protected java.awt.Color _getIndicatorColor(java.util.Map map, boolean autoColor, int ind)
protected java.awt.Color _blendColors(java.awt.Color a, java.awt.Color b)
public void setLocale(java.util.Locale loc)
Locale
for this Gauge
.loc
- The Locale
for this Gauge
.protected void updateResourceBundle()