JAPI 0_6-alpha-2
Yet another Java API
API Documentation

net.sf.japi.swing
Class ToggleAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by net.sf.japi.swing.ToggleAction
All Implemented Interfaces:
ActionListener, Serializable, Cloneable, EventListener, Action

public final class ToggleAction
extends AbstractAction

The ToggleAction works similar as an ReflectionAction. But it keeps track of the components. Be sure to use its factory methodsA

Author:
Christian Hujer
See Also:
Serialized Form

Field Summary
static String REFLECTION_PROPERTY_NAME
          The key used for storing the target object's boolean property name to find the methods Value Type: String.
static String REFLECTION_TARGET
          The key used for storing the target object to invoke the methods on.
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
ToggleAction()
           
 
Method Summary
 void actionPerformed(ActionEvent e)
          
protected  Object clone()
          
 JCheckBox createCheckBox()
          Create a JCheckBox for this action.
 JCheckBoxMenuItem createCheckBoxMenuItem()
          Create a JCheckBoxMenuItem.
 boolean isSelected()
          Returns the state of the action.
 void putValue(String key, Object newValue)
           This implementation checks the type of newValue if the key is REFLECTION_TARGET or REFLECTION_PROPERTY_NAME, so you'll know of errors quite soon.
 void setSelected(boolean selected)
          Update the selected state.
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REFLECTION_TARGET

public static final String REFLECTION_TARGET
The key used for storing the target object to invoke the methods on. Value Type: Object.

See Also:
Constant Field Values

REFLECTION_PROPERTY_NAME

public static final String REFLECTION_PROPERTY_NAME
The key used for storing the target object's boolean property name to find the methods Value Type: String.

See Also:
Constant Field Values
Constructor Detail

ToggleAction

public ToggleAction()
Method Detail

isSelected

public boolean isSelected()
Returns the state of the action.

Returns:
selected state of this action

actionPerformed

public void actionPerformed(ActionEvent e)


clone

protected Object clone()
                throws CloneNotSupportedException

Overrides:
clone in class AbstractAction
Throws:
CloneNotSupportedException

createCheckBox

public JCheckBox createCheckBox()
Create a JCheckBox for this action.

Returns:
JCheckBox for this action

createCheckBoxMenuItem

public JCheckBoxMenuItem createCheckBoxMenuItem()
Create a JCheckBoxMenuItem.

Returns:
JCheckBoxMenuItem for this action

putValue

public void putValue(String key,
                     Object newValue)
              throws IllegalArgumentException
This implementation checks the type of newValue if the key is REFLECTION_TARGET or REFLECTION_PROPERTY_NAME, so you'll know of errors quite soon.

Specified by:
putValue in interface Action
Overrides:
putValue in class AbstractAction
Throws:
IllegalArgumentException - if newValue is of the wrong type

setSelected

public void setSelected(boolean selected)
Update the selected state.

Parameters:
selected - new selected state

JAPI
Yet another Java API
API Documentation

© 2005-2006 Christian Hujer. All rights reserved. See copyright