Package org.eclipse.draw2d
Class DefaultRangeModel
java.lang.Object
org.eclipse.draw2d.DefaultRangeModel
- All Implemented Interfaces:
RangeModel
Generic implementation for a RangeModel.
|<----extent--->|
----|-----------|---------------|---------------|----
min | max
value
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected PropertyChangeSupportListeners interested in the range model's property changes.Fields inherited from interface org.eclipse.draw2d.RangeModel
PROPERTY_EXTENT, PROPERTY_MAXIMUM, PROPERTY_MINIMUM, PROPERTY_VALUE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidRegisters the given listener as a PropertyChangeListener.protected voidfirePropertyChange(String string, int oldValue, int newValue) Notifies any listening PropertyChangeListeners that the property with the given id has changed.intReturns the extent.intReturns the maximum value in the range.intReturns the minimum value in the range.intgetValue()Returns the current value.booleanReturnstrueif this RangeModel is enabled.voidRemoves the given PropertyChangeListener from the list of listeners.voidsetAll(int min, int ext, int max) Sets min, extent, and max all at once.voidsetExtent(int extent) Sets this RangeModel's extent and fires a property change if the given value is different from the current extent.voidsetMaximum(int maximum) Sets this RangeModel's maximum value and fires a property change if the given value is different from the current maximum value.voidsetMinimum(int minimum) Sets this RangeModel's minimum value and fires a property change if the given value is different from the current minimum value.voidsetValue(int value) Sets this RangeModel's current value.toString()
-
Field Details
-
propertyListeners
Listeners interested in the range model's property changes.
-
-
Constructor Details
-
DefaultRangeModel
public DefaultRangeModel()
-
-
Method Details
-
addPropertyChangeListener
Registers the given listener as a PropertyChangeListener.- Specified by:
addPropertyChangeListenerin interfaceRangeModel- Parameters:
listener- the listener to be added- Since:
- 2.0
-
firePropertyChange
Notifies any listening PropertyChangeListeners that the property with the given id has changed.- Parameters:
string- the property nameoldValue- the old valuenewValue- the new value- Since:
- 2.0
-
getExtent
public int getExtent()Description copied from interface:RangeModelReturns the extent.- Specified by:
getExtentin interfaceRangeModel- Returns:
- the extent
-
getMaximum
public int getMaximum()Description copied from interface:RangeModelReturns the maximum value in the range.- Specified by:
getMaximumin interfaceRangeModel- Returns:
- the maximum value
-
getMinimum
public int getMinimum()Description copied from interface:RangeModelReturns the minimum value in the range.- Specified by:
getMinimumin interfaceRangeModel- Returns:
- the minimum value
-
getValue
public int getValue()Description copied from interface:RangeModelReturns the current value.- Specified by:
getValuein interfaceRangeModel- Returns:
- the current value
-
isEnabled
public boolean isEnabled()Description copied from interface:RangeModelReturnstrueif this RangeModel is enabled.- Specified by:
isEnabledin interfaceRangeModel- Returns:
- whether the extent is between the minimum and maximum values
-
removePropertyChangeListener
Removes the given PropertyChangeListener from the list of listeners.- Specified by:
removePropertyChangeListenerin interfaceRangeModel- Parameters:
listener- the listener to be removed
-
setAll
public void setAll(int min, int ext, int max) Description copied from interface:RangeModelSets min, extent, and max all at once.- Specified by:
setAllin interfaceRangeModel- Parameters:
min- the new mininumext- the new extentmax- the new maximum- See Also:
-
setExtent
public void setExtent(int extent) Sets this RangeModel's extent and fires a property change if the given value is different from the current extent.- Specified by:
setExtentin interfaceRangeModel- Parameters:
extent- the new extent value
-
setMaximum
public void setMaximum(int maximum) Sets this RangeModel's maximum value and fires a property change if the given value is different from the current maximum value.- Specified by:
setMaximumin interfaceRangeModel- Parameters:
maximum- the new maximum value
-
setMinimum
public void setMinimum(int minimum) Sets this RangeModel's minimum value and fires a property change if the given value is different from the current minimum value.- Specified by:
setMinimumin interfaceRangeModel- Parameters:
minimum- the new minumum value
-
setValue
public void setValue(int value) Sets this RangeModel's current value. If the given value is greater than the maximum, the maximum value is used. If the given value is less than the minimum, the minimum value is used. If the adjusted value is different from the current value, a property change is fired.- Specified by:
setValuein interfaceRangeModel- Parameters:
value- the new value
-
toString
-