All Packages Class Hierarchy This Package Previous Next Index
Class com.sgi.sysadm.ui.taskData.LongJComboBoxBinder
java.lang.Object
|
+----com.sgi.sysadm.ui.taskData.TaskDataBinder
|
+----com.sgi.sysadm.ui.taskData.LongJComboBoxBinder
- public class LongJComboBoxBinder
- extends TaskDataBinder
LongJComboBoxBinder is used to keep long task data synchronized
with the items in a JComboBox.
The idea is that a binder should be created for each item in a
JComboBox. Each binder is created with a "value" different from
the other binders for the JComboBox. When the task data changes,
each binder will be notified, and the one whose "value" matches
the task data will make its item the current item. Conversely,
when one of the items is selected, its binder updates the task
data. For example:
JComboBox typeBox = new JComboBox();
String stringItem = rs.getString("DataPage.stringItem");
typeBox.addItem(stringItem);
taskData.addTaskDataBinder(RESKEY_DATATYPE_INT,
new LongJComboBoxBinder(typeBox, stringItem, STR_TYPE));
String intItem = rs.getString("DataPage.intItem");
typeBox.addItem(intItem);
taskData.addTaskDataBinder(RESKEY_DATATYPE_INT,
new LongJComboBoxBinder(typeBox, intItem, INT_TYPE));
-
LongJComboBoxBinder(JComboBox, Object, long)
- Construct a LongJComboBoxBinder.
-
bind(TaskData, String, JComboBox, Object, long)
- Bind the Attribute name in taskData to
box, so that when item is selected in
box the Attribute is changed to value, and
vice versa.
Deprecated.
-
taskDataChanged(TaskDataEvent)
- Called when our task data changes.
LongJComboBoxBinder
public LongJComboBoxBinder(JComboBox box,
Object item,
long value)
- Construct a LongJComboBoxBinder. Add an ItemListener
to box to keep it in sync with TaskData. If our task
data is set to value, we make item the
selected item in box. When item is selected,
we set our task data to value.
- Parameters:
- box - JComboBox to keep synchronized.
- item - Item to select when task data has value
- value - Value to set when item is selected.
bind
public static void bind(TaskData taskData,
String name,
JComboBox box,
Object item,
long value)
- Note: bind() is deprecated.
Use
taskData.addTaskDataBinder(name,
new LongJComboBoxBinder(box, item, value))
- Bind the Attribute name in taskData to
box, so that when item is selected in
box the Attribute is changed to value, and
vice versa.
- Parameters:
- taskData - TaskData to bind.
- name - name of Attribute to bind.
- box - JComboBox to bind.
- item - Item to select when Attribute takes on value.
- value - value to set Attribute to when
- is selected.
taskDataChanged
public void taskDataChanged(TaskDataEvent event)
- Called when our task data changes. Select our item the task
data has our value.
- Parameters:
- event - TaskDataEvent.
- Overrides:
- taskDataChanged in class TaskDataBinder
All Packages Class Hierarchy This Package Previous Next Index