borland Packages Class Hierarchy dbswing Package
java.lang.Object +----com.borland.dbswing.DBSliderDataBinder
Constructors Properties Methods
Implements DBDataBinder, AccessListener, ColumnAware, DataChangeListener, DataSetAware, Designable, NavigationListener, PropertyChangeListener, Serializable, EventListener, ChangeListener
DBSliderDataBinder
maps the state of a JSlider's
BoundedRangeModel
to a value in a DataSet
numeric type Column
. JdbSlider
automatically uses a DBSliderDataBinder
, and therefore it becomes a data-aware component.
There are two ways to hook up a JSlider
to a DBSliderDataBinder
. The easier way is to set the JSlider
property to a JSlider
or a subclass of JSlider
. The second way is to make any component using a BoundedRangeModel
data-aware by setting DBSliderDataBinder's
boundedRangeModel
property to the component's model. Note that when you use this approach, you are responsible for opening the DataSet
before using it.
You must also set the DBSliderDataBinder's
dataSet
and columnName
properties to specify the DataSet
and Column
from which the slider value (its current position) is read and to which the slider value is written.
If you set the JSlider
property, DBSliderDataBinder
binds the background
, foreground
, and font
properties from those defined on Column
columnName
, if one exists. This does not happen if these properties are set explicitly on DBSliderDataBinder
itself.
Besides writing a value to a DataSet
when a slider is adjusted, DBSliderDataBinder
also ensures that the position of the slider is consistent with the current value of the DataSet
Column
to which it is attached. If the value in the DataSet
is outside the range of DBSliderDataBinder's
bounds, DBSliderDataBinder
moves the slider to whichever value is closest to the DataSet's
value. You can set the unknownDataValueMode
property, however, to one of the following values to specify different behavior:
DataSet's
actual value if the value is outside the valid range of the slider's model.
DataSet
value is outside the valid range of the slider's model.
DataSet
value if it doesn't fall within the valid range of the slider's model.
JSlider jSlider = new JSlider(); DBSliderDataBinder dBSliderDataBinder = new DBSliderDataBinder(); // attach the slider to DBSliderDataBinder dBSliderDataBinder.setJSlider(jSlider); // set the target DataSet and Column dBSliderDataBinder.setDataSet(dataSet); dBSliderDataBinder.setColumnName("Quantity")
JdbSlider
public DBSliderDataBinder()Creates a
DBSliderDataBinder
. Calls the null
constructor of its superclass.
public DBSliderDataBinder(JSlider slider)Creates a
DBSliderDataBinder
and specifies the JSlider
it makes data aware. Calls the null
constructor of its superclass.
slider
JSlider
to which DBSliderDataBinder
binds to make it data-aware.
public BoundedRangeModel getBoundedRangeModel() public void setBoundedRangeModel(BoundedRangeModel boundedRangeModel)Returns and sets the model of the component that
DBSliderDataBinder
makes data-aware. When you set this property, you are responsible for opening the DataSet
before using it. Specifying the model binds the DBSliderDataBinder
to the component the model supplies data values to.
public String getColumnName() public void setColumnName(String columnName)Returns and sets the column name of the
DataSet
from which data values are to be read and to which data values are to be written.
DataSet
public DataSet getDataSet() public void setDataSet(DataSet dataSet)Returns and sets the
DataSet
from which data values are to be read and to which data values are to be written.
columnName
public JSlider getJSlider() public void setJSlider(JSlider slider)Returns and specifies the slider component to which
DBSliderDataBinder
binds to make it data-aware.
slider
JSlider
that DBSliderDataBinder
makes data-aware.
public int getUnknownDataValueMode() public void setUnknownDataValueMode(int mode)Returns and sets the policy for setting slider position when synchronizing a slider with a DataSet value outside its bounded model's range. These are the possible values:
DataSet
value is less than the slider's minimum value, the slider is set to the minimum value; if the value is greater than the slider's maximum value, the slider is set to the maximum value.
DataSet
is cleared.