|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
com.jidesoft.gauge.AbstractGauge<AxisType>
public abstract class AbstractGauge<AxisType>
An abstract superclass for gauge components. A Dial
is a Gauge component and we are introducing a new Gauge
component called Bullet
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
static String |
DEFAULT_NEEDLE_NAME
|
static String |
PROPERTY_BACKGROUND_PAINT
|
static String |
PROPERTY_RESIZE_FONTS
|
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
AbstractGauge()
|
Method Summary | |
---|---|
protected abstract Point2D |
calculatePixelPoint2D(AxisType axis,
double value)
|
protected Positionable |
createPositionable(Double value)
When the supplied value is a double and we need to create a Positionable object this method is called to create that object. |
protected boolean |
drawRotatedStringIfWithinBounds(Graphics g,
Font f,
String s,
float x,
float y,
double rotation)
|
protected boolean |
drawStringIfWithinBounds(Graphics2D g,
String s,
float x,
float y)
Paints a string but only if the whole of the string will be visible according to the bounds of the component |
void |
gaugeChanged(GaugeModelEvent e)
This is the method of the GaugeModelListener interface |
protected Color |
getAncestorBackground()
|
Paint |
getBackgroundPaint()
We would like to provide the ability to get/set a Paint as the background rather than just a Color, so we provide that ability through this property. |
Dimension |
getFontComparisonSize()
Returns the component size used for comparison when font resizing is switched on |
float |
getFontSizeRatio()
Returns the current font size ratio, when auto-resizing fonts |
GaugeModel |
getModel()
|
Double |
getValue()
|
Double |
getValue(String needleName)
|
boolean |
isAllowTickLabelOverlap()
Returns the property that specifies whether tick labels are allowed to overlap |
boolean |
isResizeFonts()
Return a boolean to indicate whether fonts are being auto-resized. |
boolean |
isShadowVisible()
|
protected String |
longestTickLabel(Collection<Tick> ticks,
FontMetrics fm)
|
void |
setAllowTickLabelOverlap(boolean allowTickLabelOverlap)
Normally you would not want your tick labels to overlap, but this property provides for this as a possibility. |
void |
setBackgroundPaint(Paint background)
Specify the background to use for this gauge. |
void |
setFontComparisonSize(Dimension fontComparisonSize)
Specify the size that will be used to determine the new font size when resizing. |
protected void |
setFontSizeRatio(float fontSizeRatio)
|
void |
setModel(GaugeModel model)
|
void |
setResizeFonts(boolean resizeFonts)
Specify whether to automatically resize fonts |
void |
setShadowVisible(boolean shadowVisible)
|
void |
setValue(Double value)
Set the value of the gauge |
void |
setValue(int value)
|
void |
setValue(String needleName,
Double value)
Set the value of the specified needle |
void |
setValue(String needleName,
double value,
boolean fireUpdate)
Set the value of the specified needle |
void |
setValue(String needleName,
int value)
Set the value of the specified needle |
void |
setValue(String needleName,
Positionable pos)
Set the value of the specified needle |
abstract void |
setValue(String needleName,
Positionable pos,
boolean fireUpdate)
|
Font |
tickLabelFontForAxis(AbstractNumericGaugeAxis axis)
Returns the tick label font to be used for the supplied axis. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.jidesoft.chart.ResizableComponent |
---|
addComponentListener |
Field Detail |
---|
public static final String DEFAULT_NEEDLE_NAME
public static final String PROPERTY_BACKGROUND_PAINT
public static final String PROPERTY_RESIZE_FONTS
Constructor Detail |
---|
public AbstractGauge()
Method Detail |
---|
public void gaugeChanged(GaugeModelEvent e)
gaugeChanged
in interface GaugeModelListener
e
- the GaugeModelEventpublic GaugeModel getModel()
public void setModel(GaugeModel model)
public Double getValue()
public Double getValue(String needleName)
protected Positionable createPositionable(Double value)
RealPosition
but if necessary you can override the method to
create an instance of a different class.
value
- the double that we need to convert to a Positionable object
public void setValue(int value)
public void setValue(Double value)
value
- the new valuepublic void setValue(String needleName, Double value)
needleName
- the needle whose value we are settingvalue
- the value of the needlepublic void setValue(String needleName, int value)
needleName
- the needle whose value we are settingvalue
- the value of the needlepublic void setValue(String needleName, Positionable pos)
needleName
- the needle whose value we are settingpos
- a Positionable object that carries the value of the needle (and possibly other information
too)public void setValue(String needleName, double value, boolean fireUpdate)
needleName
- the needle whose value we are settingvalue
- the value of the needlefireUpdate
- specify whether an update event should be fired on the modelpublic abstract void setValue(String needleName, Positionable pos, boolean fireUpdate)
protected abstract Point2D calculatePixelPoint2D(AxisType axis, double value)
public boolean isShadowVisible()
public void setShadowVisible(boolean shadowVisible)
public void setResizeFonts(boolean resizeFonts)
resizeFonts
- whether to automatically resize fontspublic boolean isResizeFonts()
isResizeFonts
in interface ResizableComponent
public Dimension getFontComparisonSize()
public void setFontComparisonSize(Dimension fontComparisonSize)
fontComparisonSize
- a component size for which tick labels will be shown at their specified sizepublic float getFontSizeRatio()
protected void setFontSizeRatio(float fontSizeRatio)
public Font tickLabelFontForAxis(AbstractNumericGaugeAxis axis)
axis
- the axis of interest
public Paint getBackgroundPaint()
public void setBackgroundPaint(Paint background)
background
- the background Paintprotected Color getAncestorBackground()
protected String longestTickLabel(Collection<Tick> ticks, FontMetrics fm)
protected boolean drawStringIfWithinBounds(Graphics2D g, String s, float x, float y)
g
- the Graphics
contexts
- the string to drawx
- the bottom left x coordinate of the drawn stringy
- the bottom left y coordinate of the drawn string
protected boolean drawRotatedStringIfWithinBounds(Graphics g, Font f, String s, float x, float y, double rotation)
g
- the Graphics context into which to draws
- the string to drawx
- the x coordinate of the centre of where the string should be drawny
- the y coordinate of the centre of where the string should be drawnrotation
- the rotation to use, in radians
public boolean isAllowTickLabelOverlap()
public void setAllowTickLabelOverlap(boolean allowTickLabelOverlap)
allowTickLabelOverlap
- specify whether tick labels are allowed to overlap
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |