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.
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
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 needlevalue
- 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 needlevalue
- 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 needlevalue
- the value of the needle, expressed as a Positionable instancefireUpdate
- 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