nextapp.echo
Class DefaultButtonModel

java.lang.Object
  extended by nextapp.echo.DefaultButtonModel
All Implemented Interfaces:
java.io.Serializable, ButtonModel
Direct Known Subclasses:
ToggleButton.ToggleButtonModel

public class DefaultButtonModel
extends java.lang.Object
implements ButtonModel, java.io.Serializable

The default implementation of a button's data model.

See Also:
Serialized Form

Field Summary
protected  EventListenerList listenerList
           
 
Constructor Summary
DefaultButtonModel()
          Creates a new default button model.
 
Method Summary
 void addActionListener(ActionListener l)
          Adds an ActionListener to the button.
 void addChangeListener(ChangeListener l)
          Adds a ChangeListener to the button.
 void addItemListener(ItemListener l)
          Adds a ItemListener to the button.
 void doAction()
          Processes a user action.
 void fireActionPerformed(ActionEvent e)
          Notifies all listeners that have registered for this event type.
 void fireItemStateChanged(ItemEvent e)
          Notifies all listeners that have registered for this event type.
 void fireStateChanged()
          Notifies all listeners that have registered for this event type.
 java.lang.String getActionCommand()
          Returns the action command for this button.
 ButtonGroup getGroup()
          Returns the ButtonGroup to which this button belongs, if any.
 boolean isSelected()
          Returns the button's selection state.
 void removeActionListener(ActionListener l)
          Removes an ActionListener from the button.
 void removeChangeListener(ChangeListener l)
          Removes a ChangeListener from the button.
 void removeItemListener(ItemListener l)
          Removes a ItemListener from the button.
 void setActionCommand(java.lang.String actionCommand)
          Sets the button's action command.
 void setGroup(ButtonGroup group)
          Sets the button's group.
 void setSelected(boolean selected)
          Sets the button's selection state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listenerList

protected EventListenerList listenerList
Constructor Detail

DefaultButtonModel

public DefaultButtonModel()
Creates a new default button model.

Method Detail

addActionListener

public void addActionListener(ActionListener l)
Description copied from interface: ButtonModel
Adds an ActionListener to the button.

Specified by:
addActionListener in interface ButtonModel
Parameters:
l - The ActionListener to be added.
See Also:
ButtonModel.addActionListener(ActionListener)

addChangeListener

public void addChangeListener(ChangeListener l)
Description copied from interface: ButtonModel
Adds a ChangeListener to the button.

Specified by:
addChangeListener in interface ButtonModel
Parameters:
l - The ChangeListener to be added.
See Also:
ButtonModel.addChangeListener(ChangeListener)

addItemListener

public void addItemListener(ItemListener l)
Description copied from interface: ButtonModel
Adds a ItemListener to the button.

Specified by:
addItemListener in interface ButtonModel
Parameters:
l - The ItemListener to be added.
See Also:
ButtonModel.addItemListener(ItemListener)

doAction

public void doAction()
Processes a user action.

Specified by:
doAction in interface ButtonModel

fireActionPerformed

public void fireActionPerformed(ActionEvent e)
Notifies all listeners that have registered for this event type.

Parameters:
e - The ActionEvent to send.

fireItemStateChanged

public void fireItemStateChanged(ItemEvent e)
Notifies all listeners that have registered for this event type.

Parameters:
e - The ItemEvent to send.

fireStateChanged

public void fireStateChanged()
Notifies all listeners that have registered for this event type.


getActionCommand

public java.lang.String getActionCommand()
Description copied from interface: ButtonModel
Returns the action command for this button.

Specified by:
getActionCommand in interface ButtonModel
Returns:
The action command for this button.
See Also:
ButtonModel.getActionCommand()

getGroup

public ButtonGroup getGroup()
Returns the ButtonGroup to which this button belongs, if any.

Specified by:
getGroup in interface ButtonModel
Returns:
The group which contains this button.

isSelected

public boolean isSelected()
Description copied from interface: ButtonModel
Returns the button's selection state.

Specified by:
isSelected in interface ButtonModel
Returns:
The button's selection state.
See Also:
ButtonModel.isSelected()

removeActionListener

public void removeActionListener(ActionListener l)
Description copied from interface: ButtonModel
Removes an ActionListener from the button.

Specified by:
removeActionListener in interface ButtonModel
Parameters:
l - The ActionListener to be removed.
See Also:
ButtonModel.removeActionListener(ActionListener)

removeChangeListener

public void removeChangeListener(ChangeListener l)
Description copied from interface: ButtonModel
Removes a ChangeListener from the button.

Specified by:
removeChangeListener in interface ButtonModel
Parameters:
l - The ChangeListener to be removed.
See Also:
ButtonModel.removeChangeListener(ChangeListener)

removeItemListener

public void removeItemListener(ItemListener l)
Description copied from interface: ButtonModel
Removes a ItemListener from the button.

Specified by:
removeItemListener in interface ButtonModel
Parameters:
l - The ItemListener to be removed.
See Also:
ButtonModel.removeItemListener(ItemListener)

setActionCommand

public void setActionCommand(java.lang.String actionCommand)
Description copied from interface: ButtonModel
Sets the button's action command.

Specified by:
setActionCommand in interface ButtonModel
Parameters:
actionCommand - The new action command for this button.
See Also:
ButtonModel.setActionCommand(String)

setSelected

public void setSelected(boolean selected)
Description copied from interface: ButtonModel
Sets the button's selection state.

Specified by:
setSelected in interface ButtonModel
Parameters:
selected - The new selection state of the button.
See Also:
ButtonModel.setSelected(boolean)

setGroup

public void setGroup(ButtonGroup group)
Description copied from interface: ButtonModel
Sets the button's group. (Needed for radio buttons)

Specified by:
setGroup in interface ButtonModel
Parameters:
group - The button's new group.
See Also:
ButtonModel.setGroup(ButtonGroup)