Class DefaultRangeModel

java.lang.Object
org.eclipse.draw2d.DefaultRangeModel
All Implemented Interfaces:
RangeModel

public class DefaultRangeModel extends Object implements RangeModel
Generic implementation for a RangeModel.
                    |<----extent--->|
    ----|-----------|---------------|---------------|----
       min          |                              max
                  value
 
  • Field Details

    • propertyListeners

      protected PropertyChangeSupport propertyListeners
      Listeners interested in the range model's property changes.
  • Constructor Details

    • DefaultRangeModel

      public DefaultRangeModel()
  • Method Details

    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener listener)
      Registers the given listener as a PropertyChangeListener.
      Specified by:
      addPropertyChangeListener in interface RangeModel
      Parameters:
      listener - the listener to be added
      Since:
      2.0
    • firePropertyChange

      protected void firePropertyChange(String string, int oldValue, int newValue)
      Notifies any listening PropertyChangeListeners that the property with the given id has changed.
      Parameters:
      string - the property name
      oldValue - the old value
      newValue - the new value
      Since:
      2.0
    • getExtent

      public int getExtent()
      Description copied from interface: RangeModel
      Returns the extent.
      Specified by:
      getExtent in interface RangeModel
      Returns:
      the extent
    • getMaximum

      public int getMaximum()
      Description copied from interface: RangeModel
      Returns the maximum value in the range.
      Specified by:
      getMaximum in interface RangeModel
      Returns:
      the maximum value
    • getMinimum

      public int getMinimum()
      Description copied from interface: RangeModel
      Returns the minimum value in the range.
      Specified by:
      getMinimum in interface RangeModel
      Returns:
      the minimum value
    • getValue

      public int getValue()
      Description copied from interface: RangeModel
      Returns the current value.
      Specified by:
      getValue in interface RangeModel
      Returns:
      the current value
    • isEnabled

      public boolean isEnabled()
      Description copied from interface: RangeModel
      Returns true if this RangeModel is enabled.
      Specified by:
      isEnabled in interface RangeModel
      Returns:
      whether the extent is between the minimum and maximum values
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener listener)
      Removes the given PropertyChangeListener from the list of listeners.
      Specified by:
      removePropertyChangeListener in interface RangeModel
      Parameters:
      listener - the listener to be removed
    • setAll

      public void setAll(int min, int ext, int max)
      Description copied from interface: RangeModel
      Sets min, extent, and max all at once.
      Specified by:
      setAll in interface RangeModel
      Parameters:
      min - the new mininum
      ext - the new extent
      max - 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:
      setExtent in interface RangeModel
      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:
      setMaximum in interface RangeModel
      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:
      setMinimum in interface RangeModel
      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:
      setValue in interface RangeModel
      Parameters:
      value - the new value
    • toString

      public String toString()
      Overrides:
      toString in class Object
      See Also: