All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sgi.sysadm.ui.taskData.AttributeAbstractButtonBinder

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

public class AttributeAbstractButtonBinder
extends TaskDataBinder
implements ChangeListener
AttributeAbstractButtonBinder binds an AbstractButton in a ButtonGroup to a piece of taskData. Whenever the button's state is set to true, the corresponding piece of taskData is set to the value passed to the constructor or bind method. Whenever the taskData changes to the value passed to the constructor or bind method, the state of the corresponding button is set to true.

To use AttributeAbstractButtonBinder, the caller adds the buttons to be bound to a button group, and then creates an AttributeAbstractButtonBinder, and passes the attribute name and that AttributeAbstractButtonBinder to TaskData.addTaskDataBinder. Each button must be bound separately. For example:

	JRadioButton roButton = new RRadioButton("Read Only");
	JRadioButton rwButton = new RRadioButton("Read/Write");
	ButtonGroup group = new ButtonGroup();
	group.add(roButton);
	group.add(rwButton);
	_taskData.addTaskDataBinder(AbstractRhinoExampleTask.WRITABLE,
	    new AttributeAbstractButtonBinder(roButton,
		new Attribute(AbstractRhinoExampleTask.WRITABLE, false)));
	_taskData.addTaskDataBinder(AbstractRhinoExampleTask.WRITABLE,
	    new AttributeAbstractButtonBinder(rwButton,
		new Attribute(AbstractRhinoExampleTask.WRITABLE, true)));
 


Constructor Index

 o AttributeAbstractButtonBinder(AbstractButton, Attribute)
Construct an AttributeAbstractButtonBinder.

Method Index

 o bind(TaskData, String, AbstractButton, Attribute)
Bind a Button to a piece of TaskData. Deprecated.
 o stateChanged(ChangeEvent)
Called when the state of the Button we're binding changes.
 o taskDataChanged(TaskDataEvent)
Called when Attribute we're binding changes.

Constructors

 o AttributeAbstractButtonBinder
 public AttributeAbstractButtonBinder(AbstractButton button,
                                      Attribute attr)
Construct an AttributeAbstractButtonBinder.

Parameters:
button - Button to bind to attr.
attr - Attribute to bind to button.

Methods

 o bind
 public static void bind(TaskData taskData,
                         String name,
                         AbstractButton button,
                         Attribute attr)
Note: bind() is deprecated. Use taskData.addTaskDataBinder(name, new AttributeAbstractButtonBinder(button, attr))

Bind a Button to a piece of TaskData.

Parameters:
taskData - TaskData to bind.
name - name of Attribute to bind.
button - Button to bind to attr.
attr - Attribute to bind to button.
 o taskDataChanged
 public void taskDataChanged(TaskDataEvent event)
Called when Attribute we're binding changes. Select our button if Attribute matches.

Parameters:
event - TaskDataEvent.
Overrides:
taskDataChanged in class TaskDataBinder
 o stateChanged
 public void stateChanged(ChangeEvent event)
Called when the state of the Button we're binding changes. Set our Attribute in TaskData if the Button is selected.

Parameters:
event - ChangeEvent.

All Packages  Class Hierarchy  This Package  Previous  Next  Index