| java.lang.Object com.jgoodies.binding.adapter.BoundedRangeAdapter
BoundedRangeAdapter | final public class BoundedRangeAdapter implements BoundedRangeModel,Serializable(Code) | | Converts a ValueModel to the BoundedRangeModel interface.
Honors an upper and lower bound and returns the adapter's minimum
in case the subject value is null .
Example:
int minSaturation = 0;
int maxSaturation = 255;
PresentationModel pm = new PresentationModel(settings);
ValueModel saturationModel = pm.getModel("saturation");
JSlider saturationSlider = new JSlider(
new BoundedRangeAdapter(saturationModel,
0,
minSaturation,
maxSaturation));
author: Karsten Lentzsch version: $Revision: 1.6 $ See Also: javax.swing.JSlider |
Constructor Summary | |
public | BoundedRangeAdapter(ValueModel subject, int extent, int min, int max) Constructs a BoundedRangeAdapter on the given subject
using the specified extend, minimum and maximum values. |
Method Summary | |
public void | addChangeListener(ChangeListener l) Adds a ChangeListener. | protected void | fireStateChanged() Runs each ChangeListeners stateChanged() method. | public int | getExtent() Returns this model's extent. | public int | getMaximum() Returns this model's upper bound, the maximum. | public int | getMinimum() Returns this model's lower bound, the minimum. | public int | getValue() Returns the current subject value, or the minimum if
the subject value is null . | public boolean | getValueIsAdjusting() Returns true if the value is in the process of changing
as a result of actions being taken by the user. | public void | removeChangeListener(ChangeListener l) Removes a ChangeListener. | public void | setExtent(int n) Sets the extent to n. | public void | setMaximum(int n) Sets the maximum to n. | public void | setMinimum(int n) Sets the minimum to n. | public void | setRangeProperties(int newValue, int newExtent, int newMin, int newMax, boolean adjusting) Sets all of the BoundedRangeModel properties after forcing
the arguments to obey the usual constraints:
minimum <= value <= value+extent <= maximum
At most, one ChangeEvent is generated. | public void | setValue(int n) Sets the current value of the model. | public void | setValueIsAdjusting(boolean b) Sets the valueIsAdjusting property. | public String | toString() Returns a string that displays all of the BoundedRangeModel properties. |
BoundedRangeAdapter | public BoundedRangeAdapter(ValueModel subject, int extent, int min, int max)(Code) | | Constructs a BoundedRangeAdapter on the given subject
using the specified extend, minimum and maximum values.
Parameters: subject - the underlying ValueModel that provides the value Parameters: extent - the extent to be set Parameters: min - the minimum to be set Parameters: max - the maximum to be set throws: IllegalArgumentException - if the following constraints aren'tsatisfied: min <= initial subject value <= value+extent <= max |
setExtent | public void setExtent(int n)(Code) | | Sets the extent to n. Ensures that n
is greater than or equal to zero and falls within the adapter's
constraints:
minimum <= value <= value+extent <= maximum
Parameters: n - the new extent before ensuring a non-negative number See Also: BoundedRangeModel.setExtent(int) |
setMaximum | public void setMaximum(int n)(Code) | | Sets the maximum to n. Ensures that n
and the other three properties obey this adapter's constraints:
minimum <= value <= value+extent <= maximum
Parameters: n - the new maximum before ensuring this adapter's constraints See Also: BoundedRangeModel.setMaximum(int) |
setValue | public void setValue(int n)(Code) | | Sets the current value of the model. For a slider, that
determines where the knob appears. Ensures that the new
value, n falls within the model's constraints:
minimum <= value <= value+extent <= maximum
Parameters: n - the new value before ensuring constraints See Also: BoundedRangeModel.setValue(int) |
toString | public String toString()(Code) | | Returns a string that displays all of the BoundedRangeModel properties.
a string representation of the properties |
|
|