All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sgi.sysadm.ui.taskData.StringJComboBoxBinder

java.lang.Object
   |
   +----com.sgi.sysadm.ui.taskData.TaskDataBinder
           |
           +----com.sgi.sysadm.ui.taskData.StringJComboBoxBinder

public class StringJComboBoxBinder
extends TaskDataBinder
StringJComboBoxBinder is used to keep string 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 heartbeat = new JComboBox();
	String hbOn = rs.getString("MainPage.hbOn");
	String hbOff = rs.getString("MainPage.hbOff");
	heartbeat.addItem(hbOn);
	heartbeat.addItem(hbOff);
	taskData.addTaskDataBinder(INVISIBLE_HB,
	    new StringJComboBoxBinder(heartbeat, hbOn, CLIKeys.TRUE_VALUE));
	taskData.addTaskDataBinder(INVISIBLE_HB,
	    new StringJComboBoxBinder(heartbeat, hbOff, CLIKeys.FALSE_VALUE));
 

Note: The item state won't change when the user types into the combobox until the user presses the Enter key or clicks the mouse pointer outside (focus leaves the combobox). To get more dynamic item state updates, use ItemFinder instead.


Constructor Index

 o StringJComboBoxBinder(JComboBox, Object, String)
Construct a StringJComboBoxBinder.

Method Index

 o bind(TaskData, String, JComboBox, Object, String)
Bind the Attribute name in taskData to box, so that when entry is selected in box the Attribute is changed to value, and vice versa. Deprecated.
 o taskDataChanged(TaskDataEvent)
Called when our task data changes.

Constructors

 o StringJComboBoxBinder
 public StringJComboBoxBinder(JComboBox box,
                              Object entry,
                              String value)
Construct a StringJComboBoxBinder. Add an ItemListener to box to keep it in sync with TaskData. If our task data is set to value, we make entry the selected entry in box. When entry is selected, we set our task data to value.

Note: The item state won't change when the user types into the combobox until the user presses the Enter key or clicks the mouse pointer outside (focus leaves the combobox). To get more dynamic item state updates, use ItemFinder instead.

Parameters:
box - JComboBox to keep synchronized.
entry - Entry to select when task data has value
value - Value to set when item is selected.

Methods

 o bind
 public static void bind(TaskData taskData,
                         String name,
                         JComboBox box,
                         Object entry,
                         String value)
Note: bind() is deprecated. Use taskData.addTaskDataBinder(name, new StringJComboBoxBinder(box, entry, value))

Bind the Attribute name in taskData to box, so that when entry 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.
entry - Entry to select when Attribute takes on value.
value - value to set Attribute to when entry is selected.
 o taskDataChanged
 public void taskDataChanged(TaskDataEvent event)
Called when our task data changes. Select our entry if The task data has the value that was passed to our constructor.

Parameters:
event - TaskDataEvent.
Overrides:
taskDataChanged in class TaskDataBinder

All Packages  Class Hierarchy  This Package  Previous  Next  Index