JIDE 3.5.15

com.jidesoft.gauge
Class DefaultGaugeModel

java.lang.Object
  extended by com.jidesoft.gauge.DefaultGaugeModel
All Implemented Interfaces:
GaugeModel

public class DefaultGaugeModel
extends Object
implements GaugeModel

A default implementation of the GaugeModel interface. A GaugeModel is essentially a set of pairs, where the string names the needle and the Positionable defines its position. There can be any number of these pairs, so there is no limit to the number of needles that can be displayed on a dial.


Constructor Summary
DefaultGaugeModel()
          Create an empty DefaultGaugeModel
DefaultGaugeModel(String name)
          Create a DefaultGaugeModel using the supplied string as the name of the model
 
Method Summary
 void addGaugeModelListener(GaugeModelListener listener)
           
 void clearValues()
          Clears the values for all the needles
 boolean equals(Object o)
           
protected  void fireGaugeChanged(String needleName, Positionable pos)
           
 Positionable getValue(String needleName)
          returns the value of the needle with the supplied name
 int getValueCount()
          Returns the number of needles/values in the model
 int hashCode()
           
 void removeGaugeModelListener(GaugeModelListener listener)
           
 void setValue(String needleName, Double value)
          Specify the value for the given named needle.
 void setValue(String needleName, Positionable value)
          Specify the value for the given named needle
 void setValue(String needleName, Positionable value, boolean fireUpdate)
          Specify the value for the given named needle but also supply a boolean to indicate whether an event should be fired for the gauge to be updated.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultGaugeModel

public DefaultGaugeModel()
Create an empty DefaultGaugeModel


DefaultGaugeModel

public DefaultGaugeModel(String name)
Create a DefaultGaugeModel using the supplied string as the name of the model

Parameters:
name - the name of the model
Method Detail

addGaugeModelListener

public void addGaugeModelListener(GaugeModelListener listener)
Specified by:
addGaugeModelListener in interface GaugeModel

removeGaugeModelListener

public void removeGaugeModelListener(GaugeModelListener listener)
Specified by:
removeGaugeModelListener in interface GaugeModel

fireGaugeChanged

protected void fireGaugeChanged(String needleName,
                                Positionable pos)

getValue

public Positionable getValue(String needleName)
returns the value of the needle with the supplied name

Specified by:
getValue in interface GaugeModel
Parameters:
needleName - the name of the needle of interest
Returns:
the value of the needle

setValue

public void setValue(String needleName,
                     Double value)
Specify the value for the given named needle.

Parameters:
needleName - the name of the needle
value - the numeric value of the needle

setValue

public void setValue(String needleName,
                     Positionable value)
Specify the value for the given named needle

Specified by:
setValue in interface GaugeModel
Parameters:
needleName - the name of the needle
value - the value of the needle, expressed as a Positionable instance

setValue

public void setValue(String needleName,
                     Positionable value,
                     boolean fireUpdate)
Specify the value for the given named needle but also supply a boolean to indicate whether an event should be fired for the gauge to be updated. This can be useful to suppress updates until all changes have been made.

Specified by:
setValue in interface GaugeModel
Parameters:
needleName - the name of the needle
value - the value of the needle, expressed as a Positionable instance
fireUpdate - a boolean to indicate whether updates should be fired

getValueCount

public int getValueCount()
Returns the number of needles/values in the model

Specified by:
getValueCount in interface GaugeModel
Returns:
the number of the needles/values in the model

clearValues

public void clearValues()
Clears the values for all the needles

Specified by:
clearValues in interface GaugeModel

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

JIDE 3.5.15