EchoPoint
1.0

echopoint.meter
Class AbstractMeterComponent

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

public abstract class AbstractMeterComponent
extends EchoPointComponent

This abstract component class can be used as the base class for a component that has a range of values, a current value as well as a normal, warning and critical range.

The sub class needs to override the drawMeterImage method and return an image that is the visual representation of the meter.

Also when a property has changed, call the invalidate method to ensure that the component image is redraw.

See Also:
Serialized Form

Nested Class Summary
static class AbstractMeterComponent.NestedStyleInfo
          Nested public static StyleInfo class.
 
Field Summary
static java.lang.String COLORS_CHANGED_PROPERTY
           
protected  nextapp.echo.Color criticalColor
           
protected  int height
           
static java.lang.String HEIGHT_CHANGED_PROPERTY
           
protected  nextapp.echo.ImageReference image
           
static java.lang.String IMAGE_CHANGED_PROPERTY
           
protected  nextapp.echo.Insets insets
           
static java.lang.String INSETS_CHANGED_PROPERTY
           
protected  MeterModel model
           
static java.lang.String MODEL_CHANGED_PROPERTY
          Public property change names
protected  boolean needsRedraw
           
protected  nextapp.echo.Color normalColor
           
static java.lang.String STYLE_CRITICAL_COLOR
          A style constant for the Criticial Color property.
static java.lang.String STYLE_HEIGHT
          A style constant for the Height property.
static java.lang.String STYLE_INSETS
          A style constant for the Insets property.
static java.lang.String STYLE_NORMAL_COLOR
          A style constant for the Normal Color property.
static java.lang.String STYLE_VALUE_COLOR
          A style constant for the Value Color property.
static java.lang.String STYLE_VALUE_FONT
          A style constant for the Value Font property.
static java.lang.String STYLE_WARNING_COLOR
          A style constant for the Warning Color property.
static java.lang.String STYLE_WIDTH
          A style constant for the Width property.
protected  java.lang.String units
           
static java.lang.String UNITS_CHANGED_PROPERTY
           
protected  nextapp.echo.Color valueColor
           
protected  nextapp.echo.Font valueFont
           
protected  nextapp.echo.Color warningColor
           
protected  int width
           
static java.lang.String 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
AbstractMeterComponent()
          AbstractMeterComponent constructor comment.
 
Method Summary
 void addChangeListener(nextapp.echo.event.ChangeListener l)
          Adds a ChangeListener to the button.
 void applyStyle(nextapp.echo.Style style)
          Applies the provided style to the component.
protected abstract  nextapp.echo.ImageReference drawMeterImage()
          This is called to redraw the "image" repsentation if the meter.
 nextapp.echo.Color getCriticalColor()
          Gets the critical color used
 int getHeight()
          Returns the height.
 nextapp.echo.ImageReference getImage()
          This returns the "Image" representation of the meter.
 nextapp.echo.Insets getInsets()
          Returns the insets (margins) of the tabbed pane contents.
 java.lang.Number getMaximumCriticalValue()
          Returns the maximum critical value.
 java.lang.Number getMaximumNormalValue()
          Returns the maximum normal value.
 java.lang.Number getMaximumValue()
          Returns the maximum value.
 java.lang.Number getMaximumWarningValue()
          Returns the maximum warning value.
 java.lang.Number getMinimumCriticalValue()
          Returns the minimum critical value.
 java.lang.Number getMinimumNormalValue()
          Returns the minimum normal value.
 java.lang.Number getMinimumValue()
          Returns the minimum value.
 java.lang.Number getMinimumWarningValue()
          Returns the minimum warning value.
 MeterModel getModel()
          Gets the model in use.
 nextapp.echo.Color getNormalColor()
          Gets the normal color used by the meter
 java.lang.String getUnits()
          Returns the "units" string associated with the meter.
 java.lang.Number getValue()
          Returns the value.
 nextapp.echo.Color getValueColor()
          Gets the value color used by the meter
 nextapp.echo.Font getValueFont()
          Gets the value font used by the meter
 nextapp.echo.Color getWarningColor()
          Gets the warning color used by the meter
 int getWidth()
          Returns the width.
 void invalidate()
          Can be called to invalidate the Meter component so that it will redraw its internals when next rendered.
protected abstract  boolean isImageRepresentation()
          Subclasses can overrride this method to indicate that a "image" representation is NOT required.
 void removeChangeListener(nextapp.echo.event.ChangeListener l)
          Removes a ChangeListener from the button.
 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 setCriticalColor(nextapp.echo.Color newCriticalColor)
          Sets the critical color used by the meter
 void setCriticalRange(java.lang.Number minCritical, java.lang.Number maxCritical)
          Sets the critical range for the dataset.
 void setHeight(int newValue)
          Sets the height of the displayed chart.
 void setInsets(nextapp.echo.Insets newValue)
          Sets the insets (margins) of the Thermometer
 void setModel(MeterModel newModel)
          Sets the model to be used.
 void setNormalColor(nextapp.echo.Color newNormalColor)
          Sets the normal color used by the meter
 void setNormalRange(java.lang.Number minNormal, java.lang.Number maxNormal)
          Sets the normal range for the dataset.
 void setRange(java.lang.Number min, java.lang.Number max)
          Sets the range for the dataset.
 void setUnits(java.lang.String newUnits)
          Sets the "units" string associated with the Meter.
 void setValue(double value)
          Sets the value.
 void setValue(java.lang.Number value)
          Sets the value for the dataset.
 void setValueColor(nextapp.echo.Color newValueColor)
          Sets the value color used by the meter
 void setValueFont(nextapp.echo.Font newValueFont)
          Sets the value font used by the meter
 void setWarningColor(nextapp.echo.Color newWarningColor)
          Sets the warning color used by the meter
 void setWarningRange(java.lang.Number minWarning, java.lang.Number maxWarning)
          Sets the warning range for the dataset.
 void setWidth(int newValue)
          Sets the width of the displayed chart.
 void validate()
          Validates this component.
 
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

STYLE_INSETS

public static final java.lang.String STYLE_INSETS
A style constant for the Insets property. Values of this key must be of type nextapp.echo.Insets.

See Also:
Constant Field Values

STYLE_HEIGHT

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

See Also:
Constant Field Values

STYLE_WIDTH

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

See Also:
Constant Field Values

STYLE_CRITICAL_COLOR

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

See Also:
Constant Field Values

STYLE_WARNING_COLOR

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

See Also:
Constant Field Values

STYLE_NORMAL_COLOR

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

See Also:
Constant Field Values

STYLE_VALUE_COLOR

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

See Also:
Constant Field Values

STYLE_VALUE_FONT

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

See Also:
Constant Field Values

MODEL_CHANGED_PROPERTY

public static final java.lang.String MODEL_CHANGED_PROPERTY
Public property change names

See Also:
Constant Field Values

HEIGHT_CHANGED_PROPERTY

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

WIDTH_CHANGED_PROPERTY

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

IMAGE_CHANGED_PROPERTY

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

INSETS_CHANGED_PROPERTY

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

COLORS_CHANGED_PROPERTY

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

UNITS_CHANGED_PROPERTY

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

model

protected MeterModel model

width

protected int width

height

protected int height

image

protected nextapp.echo.ImageReference image

insets

protected nextapp.echo.Insets insets

units

protected java.lang.String units

criticalColor

protected nextapp.echo.Color criticalColor

warningColor

protected nextapp.echo.Color warningColor

normalColor

protected nextapp.echo.Color normalColor

valueColor

protected nextapp.echo.Color valueColor

valueFont

protected nextapp.echo.Font valueFont

needsRedraw

protected boolean needsRedraw
Constructor Detail

AbstractMeterComponent

public AbstractMeterComponent()
AbstractMeterComponent constructor comment.

Method Detail

addChangeListener

public void addChangeListener(nextapp.echo.event.ChangeListener l)
Adds a ChangeListener to the button.

Parameters:
l - The ChangeListener to be added.

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 EchoPointComponent
See Also:
Component.applyStyle(nextapp.echo.Style)

drawMeterImage

protected abstract nextapp.echo.ImageReference drawMeterImage()
This is called to redraw the "image" repsentation if the meter.


getCriticalColor

public nextapp.echo.Color getCriticalColor()
Gets the critical color used

Returns:
nextapp.echo.Color

getHeight

public int getHeight()
Returns the height.

Returns:
The height.

getImage

public nextapp.echo.ImageReference getImage()
This returns the "Image" representation of the meter. There is no corresponding "setImage" method. The derived classes must implement drawMeterImage to create the required image.


getInsets

public nextapp.echo.Insets getInsets()
Returns the insets (margins) of the tabbed pane contents.

Returns:
The insets of the tabbed pane.

getMaximumCriticalValue

public java.lang.Number getMaximumCriticalValue()
Returns the maximum critical value.

Returns:
the maximum critical value.

getMaximumNormalValue

public java.lang.Number getMaximumNormalValue()
Returns the maximum normal value.

Returns:
the maximum normal value.

getMaximumValue

public java.lang.Number getMaximumValue()
Returns the maximum value.

Returns:
the maximum value.

getMaximumWarningValue

public java.lang.Number getMaximumWarningValue()
Returns the maximum warning value.

Returns:
the maximum warning value.

getMinimumCriticalValue

public java.lang.Number getMinimumCriticalValue()
Returns the minimum critical value.

Returns:
the minimum critical value.

getMinimumNormalValue

public java.lang.Number getMinimumNormalValue()
Returns the minimum normal value.

Returns:
the minimum normal value.

getMinimumValue

public java.lang.Number getMinimumValue()
Returns the minimum value.

Returns:
the minimum value.

getMinimumWarningValue

public java.lang.Number getMinimumWarningValue()
Returns the minimum warning value.

Returns:
the minimum warning value.

getModel

public MeterModel getModel()
Gets the model in use.

Returns:
echopoint.meter.MeterModel

getNormalColor

public nextapp.echo.Color getNormalColor()
Gets the normal color used by the meter

Returns:
nextapp.echo.Color

getUnits

public java.lang.String getUnits()
Returns the "units" string associated with the meter.

Returns:
java.lang.String

getValue

public java.lang.Number getValue()
Returns the value.

Returns:
the value.

getValueColor

public nextapp.echo.Color getValueColor()
Gets the value color used by the meter

Returns:
nextapp.echo.Color

getValueFont

public nextapp.echo.Font getValueFont()
Gets the value font used by the meter

Returns:
nextapp.echo.Font

getWarningColor

public nextapp.echo.Color getWarningColor()
Gets the warning color used by the meter

Returns:
nextapp.echo.Color

getWidth

public int getWidth()
Returns the width.

Returns:
The Width.

invalidate

public void invalidate()
Can be called to invalidate the Meter component so that it will redraw its internals when next rendered.


isImageRepresentation

protected abstract 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.


removeChangeListener

public void removeChangeListener(nextapp.echo.event.ChangeListener l)
Removes a ChangeListener from the button.

Parameters:
l - The ChangeListener to be removed.

setCriticalColor

public void setCriticalColor(nextapp.echo.Color newCriticalColor)
Sets the critical color used by the meter

Parameters:
newCriticalColor - nextapp.echo.Color

setCriticalRange

public void setCriticalRange(java.lang.Number minCritical,
                             java.lang.Number maxCritical)
Sets the critical range for the dataset. Registered listeners are notified of the change.

Parameters:
minCritical - the new minimum.
maxCritical - the new maximum.

setHeight

public void setHeight(int newValue)
Sets the height of the displayed chart.

Parameters:
newValue - The height.

setInsets

public void setInsets(nextapp.echo.Insets newValue)
Sets the insets (margins) of the Thermometer

Parameters:
newValue - An insets object that specifies the size of each margin of this Thermometer

setModel

public void setModel(MeterModel newModel)
Sets the model to be used.

Parameters:
newModel - echopoint.meter.MeterModel

setNormalColor

public void setNormalColor(nextapp.echo.Color newNormalColor)
Sets the normal color used by the meter

Parameters:
newNormalColor - nextapp.echo.Color

setNormalRange

public void setNormalRange(java.lang.Number minNormal,
                           java.lang.Number maxNormal)
Sets the normal range for the dataset. Registered listeners are notified of the change.

Parameters:
minNormal - the new minimum.
maxNormal - the new maximum.

setRange

public void setRange(java.lang.Number min,
                     java.lang.Number max)
Sets the range for the dataset. Registered listeners are notified of the change.

Parameters:
min - the new minimum.
max - the new maximum.

setUnits

public void setUnits(java.lang.String newUnits)
Sets the "units" string associated with the Meter.

Parameters:
newUnits - java.lang.String

setValue

public void setValue(double value)
Sets the value.

Parameters:
value - the new value.

setValue

public void setValue(java.lang.Number value)
Sets the value for the dataset.

Parameters:
value - the new value.

setValueColor

public void setValueColor(nextapp.echo.Color newValueColor)
Sets the value color used by the meter

Parameters:
newValueColor - nextapp.echo.Color

setValueFont

public void setValueFont(nextapp.echo.Font newValueFont)
Sets the value font used by the meter

Parameters:
newValueFont - nextapp.echo.Font

setWarningColor

public void setWarningColor(nextapp.echo.Color newWarningColor)
Sets the warning color used by the meter

Parameters:
newWarningColor - nextapp.echo.Color

setWarningRange

public void setWarningRange(java.lang.Number minWarning,
                            java.lang.Number maxWarning)
Sets the warning range for the dataset. Registered listeners are notified of the change.

Parameters:
minWarning - the new minimum.
maxWarning - the new maximum.

setWidth

public void setWidth(int newValue)
Sets the width of the displayed chart.

Parameters:
newValue - The width.

validate

public void validate()
Validates this component. This method will be called by the application container before the component is rendered. This method be overridden if the component needs to be updated before being rendered. Validation occurs from the top of the component hierarchy down.

Overrides:
validate in class EchoPointComponent
See Also:
Component.validate()

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;
 }
 

Parameters:
field - - the field to be set
newValue - - the new value to be set
Returns:
the oldValue of the field
Throws:
java.lang.Exception
See Also:
ReflectionSetter.set(Field, Object)

EchoPoint
1.0