public abstract class DrawableObject
extends java.lang.Object
Gauge should derive. It will have the capacity
to hold the parameters necessary to render this object.| Modifier and Type | Class and Description |
|---|---|
static class |
DrawableObject.Image
This class defines an area.
|
static class |
DrawableObject.Label
This class defines a label.
|
static class |
DrawableObject.Shape
This class defines a shape.
|
static class |
DrawableObject.TickLabel
This class defines a tick label.
|
static class |
DrawableObject.Transform
This class defines an AffineTransform.
|
| Modifier and Type | Field and Description |
|---|---|
protected java.awt.geom.AffineTransform |
m_transform |
| Constructor and Description |
|---|
DrawableObject(int compType,
java.awt.geom.AffineTransform transform)
Provides a constructor for implementations of
DrawableObject and includes the
specification for an object type. |
DrawableObject(int compType,
int index,
java.awt.geom.AffineTransform transform)
Provides a constructor for implementations of
DrawableObject and includes the
specification for an object type. |
DrawableObject(int compType,
int index,
java.util.Map map,
java.awt.geom.AffineTransform transform)
Provides a constructor for implementations of
DrawableObject and includes the
specification for an object type. |
DrawableObject(int compType,
java.util.Map map,
java.awt.geom.AffineTransform transform)
Provides a constructor for implementations of
DrawableObject and includes the
specification for an object type. |
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
contains(double x,
double y,
boolean useTruncated)
Perform an inclusion test on the object based on the given point
|
java.awt.geom.AffineTransform |
getAffineTransform()
Returns the
AffineTransform to apply to this object. |
int |
getComponentIndex()
Returns the index of component to which this
DrawableObject instance belongs. |
int |
getComponentType()
Returns the type of component to which this
DrawableObject instance belongs. |
static java.awt.Dimension |
getLabelDimensions(java.awt.Graphics2D g,
java.awt.Font f,
java.lang.String label)
Calculates and returns the dimensions of the given label
based on the given Graphics2D object and font
|
static DrawableObject |
getLabelObject(java.awt.Graphics2D g,
java.lang.String label,
java.awt.Font font,
java.awt.Color fontColor,
java.awt.Rectangle bounds,
java.lang.String labelType)
Generates the DrawableObject instance for a Label object.
|
static DrawableObject.TickLabel |
getTickLabelObject(java.awt.Graphics2D g,
java.lang.String text,
java.awt.Font font,
java.awt.Color fontColor,
java.awt.Rectangle bounds,
int tickType)
Generates a tick label object, complete with trimmed rectangle
to facilitate hit testing and prevention of overlapping labels.
|
boolean |
isSelected()
Returns the selection state of this object.
|
protected boolean |
isVisible()
Returns the visibility state of this object.
|
boolean |
render(GaugeRenderer renderer)
This method will render the current object onto the
given instance of
GaugeRenderer. |
void |
setSelected(boolean selected)
Sets the selection state of this object.
|
protected void |
setVisible(boolean visible)
Gets the visibility state of this object.
|
public DrawableObject(int compType,
int index,
java.util.Map map,
java.awt.geom.AffineTransform transform)
DrawableObject and includes the
specification for an object type.transform - Instance of AffineTransform to apply
to this shape before rendering itmap - Map that contains the properties for the gaugecompType - Type of component to which this object belongs;
valid values are constants in the
GaugeConstants class beginning with
ID_index - The index of threshold or indicator objectpublic DrawableObject(int compType,
int index,
java.awt.geom.AffineTransform transform)
DrawableObject and includes the
specification for an object type.transform - Instance of AffineTransform to apply
to this shape before rendering itcompType - Type of component to which this object belongs;
valid values are constants in the
GaugeConstants class beginning with
ID_index - The index of threshold or indicator objectpublic DrawableObject(int compType,
java.awt.geom.AffineTransform transform)
DrawableObject and includes the
specification for an object type.transform - Instance of AffineTransform to apply
to this shape before rendering itcompType - Type of component to which this object belongs;
valid values are constants in the
GaugeConstants class beginning with
ID_public DrawableObject(int compType,
java.util.Map map,
java.awt.geom.AffineTransform transform)
DrawableObject and includes the
specification for an object type.transform - Instance of AffineTransform to apply
to this shape before rendering itmap - Map that contains the properties for the gaugecompType - Type of component to which this object belongs;
valid values are constants in the
GaugeConstants class beginning with
ID_public int getComponentType()
DrawableObject instance belongs.GaugeConstants beginning with
ID_public int getComponentIndex()
DrawableObject instance belongs.public java.awt.geom.AffineTransform getAffineTransform()
AffineTransform to apply to this object.AffineTransform to apply
to this shape before rendering itpublic boolean isSelected()
True if this object is currently selected,
False if it is not selectedpublic void setSelected(boolean selected)
protected boolean isVisible()
True if this object is currently visible,
False if it is not visibleprotected void setVisible(boolean visible)
public boolean render(GaugeRenderer renderer)
GaugeRenderer.renderer - Instance of GaugeRendererspublic abstract boolean contains(double x,
double y,
boolean useTruncated)
useTruncated - True if the truncated rectangle
should be used, False otherwisey - Double representing the Y location of the pointx - Double representing the X location of the pointTrue if the point is contained within
this object, False otherwisepublic static DrawableObject getLabelObject(java.awt.Graphics2D g, java.lang.String label, java.awt.Font font, java.awt.Color fontColor, java.awt.Rectangle bounds, java.lang.String labelType)
labelType - Type of label; can be one of the label
constants in GaugeAttributesbounds - Bounds in which the label should be confinedfont - Font object that must be non-null
or no DrawableObjects will be generatedfontColor - Color object that must be non-null
or no DrawableObjects will be generatedlabel - String to use for this label objectg - Graphics2D object to use in obtaining FontMetricspublic static DrawableObject.TickLabel getTickLabelObject(java.awt.Graphics2D g, java.lang.String text, java.awt.Font font, java.awt.Color fontColor, java.awt.Rectangle bounds, int tickType)
tickType - Type of tick label; can be TICK_METRIC,
TICK_THRESHOLD, TICK_MIN_MAX, or TICK_INCREMENTS from
the GaugeAttributes class.bounds - Rectangle in which this label should be drawnfontColor - Instance of Color representing
the font color of this ticklabelfont - Instance of Font representing the
font for this ticklabeltext - String value for this labelg - Graphics2D instance to use for setup of this labelDrawableObject.TickLabelpublic static java.awt.Dimension getLabelDimensions(java.awt.Graphics2D g,
java.awt.Font f,
java.lang.String label)
label - String of labelf - Font object that must be non-null
or no dimensions will be calculatedg - Graphics2D instance from which to retrieve FontMetrics