com.jidesoft.gauge
Class AbstractIndicatorRenderer<GaugeType extends AbstractGauge<?>>
java.lang.Object
com.jidesoft.gauge.AbstractIndicatorRenderer<GaugeType>
- All Implemented Interfaces:
- IndicatorRenderer<GaugeType>
- Direct Known Subclasses:
- BarIndicatorRenderer, LineIndicatorRenderer, PointerIndicatorRenderer
public abstract class AbstractIndicatorRenderer<GaugeType extends AbstractGauge<?>>
- extends Object
- implements IndicatorRenderer<GaugeType>
Method Summary |
protected abstract Shape |
calculateShape(GaugeType gauge,
Double value)
Calculates the shape of the indicator. |
protected abstract void |
drawIndicator(Graphics2D g,
GaugeType gauge,
Shape shape,
IndicatorStyle style)
|
protected String |
generateLabel(Double value)
|
Color |
getLabelColor()
|
NumberLabeler<Double> |
getLabeler()
Returns the labeler that generates a string to be used as a label for the indicator |
Font |
getLabelFont()
|
String |
getLabelText()
Returns the fixed label text specified with setLabelText() |
ShadowRenderer |
getShadowRenderer()
|
Shape |
paintIndicator(Graphics2D g,
GaugeType gauge,
Double value,
IndicatorStyle style)
|
abstract void |
paintLabel(Graphics2D g,
GaugeType gauge,
Double value,
IndicatorStyle style)
|
void |
setLabelColor(Color labelColor)
|
void |
setLabeler(NumberLabeler<Double> labeler)
Specify a labeler that can be used to dynamically generate the string for the label, usually based on the
value of the indicator. |
void |
setLabelFont(Font labelFont)
|
void |
setLabelText(String labelText)
Use this method to specify a static value for the text of the label. |
void |
setShadowRenderer(ShadowRenderer shadowRenderer)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
labelFont
protected Font labelFont
labelColor
protected Color labelColor
AbstractIndicatorRenderer
protected AbstractIndicatorRenderer()
getShadowRenderer
public ShadowRenderer getShadowRenderer()
setShadowRenderer
public void setShadowRenderer(ShadowRenderer shadowRenderer)
getLabeler
public NumberLabeler<Double> getLabeler()
- Returns the labeler that generates a string to be used as a label for the indicator
- Returns:
- the labeler that generates a string to be used as a label for the indicator
setLabeler
public void setLabeler(NumberLabeler<Double> labeler)
- Specify a labeler that can be used to dynamically generate the string for the label, usually based on the
value of the indicator.
- Parameters:
labeler
- the labeler that converts a numeric value into a string for display as the label
getLabelText
public String getLabelText()
- Returns the fixed label text specified with setLabelText()
- Returns:
- the fixed string specified as a label for the indicator
setLabelText
public void setLabelText(String labelText)
- Use this method to specify a static value for the text of the label. Note that if a labeler is specified
in addition to a labelText, the labeler will be used to generate the text value in preference to any
fixed text value specified here.
- Parameters:
labelText
- the fixed label text
generateLabel
protected String generateLabel(Double value)
getLabelFont
public Font getLabelFont()
setLabelFont
public void setLabelFont(Font labelFont)
getLabelColor
public Color getLabelColor()
setLabelColor
public void setLabelColor(Color labelColor)
paintIndicator
public Shape paintIndicator(Graphics2D g,
GaugeType gauge,
Double value,
IndicatorStyle style)
- Specified by:
paintIndicator
in interface IndicatorRenderer<GaugeType extends AbstractGauge<?>>
paintLabel
public abstract void paintLabel(Graphics2D g,
GaugeType gauge,
Double value,
IndicatorStyle style)
drawIndicator
protected abstract void drawIndicator(Graphics2D g,
GaugeType gauge,
Shape shape,
IndicatorStyle style)
calculateShape
protected abstract Shape calculateShape(GaugeType gauge,
Double value)
- Calculates the shape of the indicator. This is needed so that we can create a BufferedImage of the right
size when generating shadows
- Parameters:
gauge
- the gauge, such as an instance of Bulletvalue
- the value to be represented by the indicator