EchoPoint
1.0

echopoint
Class Tachometer

java.lang.Object
  extended bynextapp.echo.Component
      extended bynextapp.echo.Container
          extended byechopoint.EchoPointComponent
              extended byechopoint.meter.AbstractMeterComponent
                  extended byechopoint.Tachometer
All Implemented Interfaces:
MouseCursorable, ReflectionSetter, java.io.Serializable, ToolTipPopUpSupport, nextapp.echo.ToolTipSupport

public class Tachometer
extends AbstractMeterComponent

This component uses the JFreeChart capabilties to draw a Tachometer.

For the purists out there, a Tachometer is "an instrument used to measure the rotations per minute of a rotating shaft". However we are using it to mean a gauge for measuring any range of values.

This class is derived from AbstractMeterComponent which contains many of its methods.

This class uses the MeterModelJFreeChartAdapter class to bridge data from the EchoPoint MeterModel interface to the JFreeChart MeterDatSet interface.

See Also:
Serialized Form

Nested Class Summary
static class Tachometer.NestedStyleInfo
          Nested public static StyleInfo class.
 
Field Summary
static java.lang.String DIAL_TYPE_CHANGED_PROPERTY
           
static SymbolicValue[] dialTypeSymbolics
          Helper static SymbolicValue[] - Tachometer.TACHO_PIE, TACHO_CIRCLE and TACHO_CHORD
static java.lang.String METER_ANGLE_CHANGED_PROPERTY
           
static java.lang.String NEEDLE_COLOR_CHANGED_PROPERTY
           
static java.lang.String STYLE_DIAL_COLOR
          A style constant for the Dial Color property.
static java.lang.String STYLE_DIAL_TYPE
          A style constant for the Dial Type property.
static java.lang.String STYLE_METER_ANGLE
          A style constant for the Meter Angle property.
static java.lang.String STYLE_NEEDLE_COLOR
          A style constant for the Needle Color property.
static java.lang.String STYLE_TICK_LABELS_FONT
          A style constant for the Tick Labels Font property.
static java.lang.String STYLE_TICK_LABELS_SHOWN
          A style constant for the Tick Labels Shown property.
static int TACHO_CHORD
           
static int TACHO_CIRCLE
           
static int TACHO_PIE
          These constants control the shape of the Tachometer
static java.lang.String TICK_LABELS_FONT
           
static java.lang.String TICK_LABELS_SHOWN
           
 
Fields inherited from class echopoint.meter.AbstractMeterComponent
COLORS_CHANGED_PROPERTY, criticalColor, height, HEIGHT_CHANGED_PROPERTY, image, IMAGE_CHANGED_PROPERTY, insets, INSETS_CHANGED_PROPERTY, model, MODEL_CHANGED_PROPERTY, needsRedraw, normalColor, STYLE_CRITICAL_COLOR, STYLE_HEIGHT, STYLE_INSETS, STYLE_NORMAL_COLOR, STYLE_VALUE_COLOR, STYLE_VALUE_FONT, STYLE_WARNING_COLOR, STYLE_WIDTH, units, UNITS_CHANGED_PROPERTY, valueColor, valueFont, warningColor, width, WIDTH_CHANGED_PROPERTY
 
Fields inherited from class echopoint.EchoPointComponent
STYLE_TOOL_TIP_TEXT, TOOL_TIP_TEXT_CHANGED_PROPERTY, toolTipPopUp
 
Fields inherited from class nextapp.echo.Component
BACKGROUND_CHANGED_PROPERTY, CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FONT_CHANGED_PROPERTY, FOREGROUND_CHANGED_PROPERTY, IDENTIFIER_CHANGED_PROPERTY, listenerList, LOCALE_CHANGED_PROPERTY, STYLE_BACKGROUND, STYLE_FONT, STYLE_FOREGROUND, UPDATE_PROPERTY, VISIBLE_CHANGED_PROPERTY
 
Fields inherited from interface echopoint.positionable.MouseCursorable
borderStyleSymbolics, CURSOR_AUTO, CURSOR_CROSSHAIR, CURSOR_CUSTOM_URI, CURSOR_DEFAULT, CURSOR_E_RESIZE, CURSOR_HELP, CURSOR_MOVE, CURSOR_N_RESIZE, CURSOR_NE_RESIZE, CURSOR_NW_RESIZE, CURSOR_POINTER, CURSOR_S_RESIZE, CURSOR_SE_RESIZE, CURSOR_SW_RESIZE, CURSOR_TEXT, CURSOR_W_RESIZE, CURSOR_WAIT, STYLE_MOUSE_CURSOR, STYLE_MOUSE_CURSOR_URI
 
Constructor Summary
Tachometer()
          Thermometer constructor.
 
Method Summary
 void applyStyle(nextapp.echo.Style style)
          Applies the provided style to the component.
protected  nextapp.echo.ImageReference drawMeterImage()
          Called to redraw the image for this meter.
 nextapp.echo.Color getDialColor()
          Returns the color of the dial background
 int getDialType()
          Returns the dial type of the Tachometer.
 org.jfree.chart.JFreeChart getJFreeChart()
          Returns the internal JFreeChart used to paint the component.
 int getMeterAngle()
          Gets the meter angle (in degrees)
 nextapp.echo.Color getNeedleColor()
          Returns the needle color
 nextapp.echo.Font getTickLabelsFont()
          Gets the font for tick labels
protected  boolean isImageRepresentation()
          Subclasses can overrride this method to indicate that a "image" representation is NOT required.
 boolean isTickLabelsShown()
          Returns true if tick labels are shown
 java.lang.Object set(java.lang.reflect.Field field, java.lang.Object newValue)
          Called to save the old value of a field, set in a new value and return the old value of a field.
 void setDialColor(nextapp.echo.Color newDialColor)
          Sets the color of the dial background
 void setDialType(int newDialType)
          /** Sets the dial type of the Tachometer.
 void setMeterAngle(int newMeterAngle)
          Sets the meter angle (in degrees)
 void setModel(MeterModel model)
          Sets the model for the Tachometer and also uses an Adapter to reflect changes into the JFreeChart architecture.
 void setNeedleColor(nextapp.echo.Color newNeedleColor)
          Sets the needle color
 void setTickLabelFont(nextapp.echo.Font newTickLabelsFont)
          Sets the font for tick labels
 void setTickLabelsShown(boolean newTickLabelsShown)
          If true, then tick labels will be shown
 
Methods inherited from class echopoint.meter.AbstractMeterComponent
addChangeListener, getCriticalColor, getHeight, getImage, getInsets, getMaximumCriticalValue, getMaximumNormalValue, getMaximumValue, getMaximumWarningValue, getMinimumCriticalValue, getMinimumNormalValue, getMinimumValue, getMinimumWarningValue, getModel, getNormalColor, getUnits, getValue, getValueColor, getValueFont, getWarningColor, getWidth, invalidate, removeChangeListener, setCriticalColor, setCriticalRange, setHeight, setInsets, setNormalColor, setNormalRange, setRange, setUnits, setValue, setValue, setValueColor, setValueFont, setWarningColor, setWarningRange, setWidth, validate
 
Methods inherited from class echopoint.EchoPointComponent
getMouseCursor, getMouseCursorURI, getToolTipPopUp, getToolTipText, set, set, set, set, set, set, set, set, set, setEnabledAllChildren, setMouseCursor, setMouseCursorURI, setToolTipText
 
Methods inherited from class nextapp.echo.Component
add, add, addHierarchyListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getComponent, getComponentCount, getComponents, getEchoInstance, getFont, getForeground, getIdentifier, getLocale, getParent, indexOf, init, isAncestorOf, isEnabled, isRegistered, isShowing, isVisible, remove, remove, removeAll, removeHierarchyListener, removePropertyChangeListener, setBackground, setEnabled, setFont, setForeground, setIdentifier, setLocale, setVisible, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TACHO_PIE

public static final int TACHO_PIE
These constants control the shape of the Tachometer

See Also:
Constant Field Values

TACHO_CIRCLE

public static final int TACHO_CIRCLE
See Also:
Constant Field Values

TACHO_CHORD

public static final int TACHO_CHORD
See Also:
Constant Field Values

STYLE_NEEDLE_COLOR

public static final java.lang.String STYLE_NEEDLE_COLOR
A style constant for the Needle Color property. Values of this key must be of type Color

See Also:
Constant Field Values

STYLE_DIAL_COLOR

public static final java.lang.String STYLE_DIAL_COLOR
A style constant for the Dial Color property. Values of this key must be of type Color

See Also:
Constant Field Values

STYLE_DIAL_TYPE

public static final java.lang.String STYLE_DIAL_TYPE
A style constant for the Dial Type property. Values of this key must be of type int

See Also:
Constant Field Values

STYLE_METER_ANGLE

public static final java.lang.String STYLE_METER_ANGLE
A style constant for the Meter Angle property. Values of this key must be of type int

See Also:
Constant Field Values

STYLE_TICK_LABELS_FONT

public static final java.lang.String STYLE_TICK_LABELS_FONT
A style constant for the Tick Labels Font property. Values of this key must be of type Font

See Also:
Constant Field Values

STYLE_TICK_LABELS_SHOWN

public static final java.lang.String STYLE_TICK_LABELS_SHOWN
A style constant for the Tick Labels Shown property. Values of this key must be of type boolean

See Also:
Constant Field Values

dialTypeSymbolics

public static SymbolicValue[] dialTypeSymbolics
Helper static SymbolicValue[] - Tachometer.TACHO_PIE, TACHO_CIRCLE and TACHO_CHORD


NEEDLE_COLOR_CHANGED_PROPERTY

public static final java.lang.String NEEDLE_COLOR_CHANGED_PROPERTY
See Also:
Constant Field Values

DIAL_TYPE_CHANGED_PROPERTY

public static final java.lang.String DIAL_TYPE_CHANGED_PROPERTY
See Also:
Constant Field Values

METER_ANGLE_CHANGED_PROPERTY

public static final java.lang.String METER_ANGLE_CHANGED_PROPERTY
See Also:
Constant Field Values

TICK_LABELS_FONT

public static final java.lang.String TICK_LABELS_FONT
See Also:
Constant Field Values

TICK_LABELS_SHOWN

public static final java.lang.String TICK_LABELS_SHOWN
See Also:
Constant Field Values
Constructor Detail

Tachometer

public Tachometer()
Thermometer constructor.

Method Detail

applyStyle

public void applyStyle(nextapp.echo.Style style)
Applies the provided style to the component. The base nextapp.echo.Component style names can be used as well.

Specified by:
applyStyle in interface MouseCursorable
Overrides:
applyStyle in class AbstractMeterComponent

drawMeterImage

protected nextapp.echo.ImageReference drawMeterImage()
Called to redraw the image for this meter.

Specified by:
drawMeterImage in class AbstractMeterComponent

getDialColor

public nextapp.echo.Color getDialColor()
Returns the color of the dial background

Returns:
nextapp.echo.Color

getDialType

public int getDialType()
Returns the dial type of the Tachometer.

This can be one of the following values:

Returns:
int

getJFreeChart

public org.jfree.chart.JFreeChart getJFreeChart()
Returns the internal JFreeChart used to paint the component.


getMeterAngle

public int getMeterAngle()
Gets the meter angle (in degrees)

Returns:
int

getNeedleColor

public nextapp.echo.Color getNeedleColor()
Returns the needle color

Returns:
nextapp.echo.Color

getTickLabelsFont

public nextapp.echo.Font getTickLabelsFont()
Gets the font for tick labels

Returns:
nextapp.echo.Font

isImageRepresentation

protected boolean isImageRepresentation()
Subclasses can overrride this method to indicate that a "image" representation is NOT required. The "drawImage" method will not be called and the subclass is therefore responsivle for all visual representation processing.

Specified by:
isImageRepresentation in class AbstractMeterComponent

isTickLabelsShown

public boolean isTickLabelsShown()
Returns true if tick labels are shown

Returns:
boolean

setDialColor

public void setDialColor(nextapp.echo.Color newDialColor)
Sets the color of the dial background

Parameters:
newDialColor - nextapp.echo.Color

setDialType

public void setDialType(int newDialType)
/** Sets the dial type of the Tachometer.

This can be one of the following values:

Parameters:
newDialType - int

setMeterAngle

public void setMeterAngle(int newMeterAngle)
Sets the meter angle (in degrees)

Parameters:
newMeterAngle - int

setModel

public void setModel(MeterModel model)
Sets the model for the Tachometer and also uses an Adapter to reflect changes into the JFreeChart architecture.

Overrides:
setModel in class AbstractMeterComponent
Parameters:
model - echopoint.meter.MeterModel

setNeedleColor

public void setNeedleColor(nextapp.echo.Color newNeedleColor)
Sets the needle color

Parameters:
newNeedleColor - nextapp.echo.Color

setTickLabelFont

public void setTickLabelFont(nextapp.echo.Font newTickLabelsFont)
Sets the font for tick labels

Parameters:
newTickLabelsFont - nextapp.echo.Font

setTickLabelsShown

public void setTickLabelsShown(boolean newTickLabelsShown)
If true, then tick labels will be shown

Parameters:
newTickLabelsShown - boolean

set

public java.lang.Object set(java.lang.reflect.Field field,
                            java.lang.Object newValue)
                     throws java.lang.Exception
Description copied from interface: ReflectionSetter
Called to save the old value of a field, set in a new value and return the old value of a field. This interface allows a field set operation to be "delegated" back into the class that has permission to perform the field set.

 public Object set(Field f, Object newValue) throws Exception {
      Object oldValue = f.get(this);
      f.set(this,newValue);
      return oldValue;
 }
 

Specified by:
set in interface ReflectionSetter
Overrides:
set in class AbstractMeterComponent
Throws:
java.lang.Exception
See Also:
ReflectionSetter.set(Field, Object)

EchoPoint
1.0