edu.rice.cs.util.swing
Class DelegatingAction

java.lang.Object
  |
  +--edu.rice.cs.util.swing.DelegatingAction
All Implemented Interfaces:
Action, ActionListener, EventListener

public class DelegatingAction
extends Object
implements Action


Field Summary
private  Action _delegatee
          The action to delegate to.
private  LinkedList _listenerList
           
private  HashMap _localProperties
           
private static String[] KEYS_TO_DELEGATE
          These keys will be copied from the delegatee.
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
DelegatingAction()
           
 
Method Summary
private  void _checkState()
           
private  boolean _isDelegatedKey(String key)
           
 void actionPerformed(ActionEvent ae)
           
 void addPropertyChangeListener(PropertyChangeListener listener)
           
 Object getValue(String key)
          Returns value of the key, from delegatee is it's in KEYS_TO_DELEGATE or from this if not.
 boolean isEnabled()
           
 void putValue(String key, Object value)
           
 void removePropertyChangeListener(PropertyChangeListener listener)
           
 void setDelegatee(Action newDelegatee)
           
 void setEnabled(boolean b)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

KEYS_TO_DELEGATE

private static final String[] KEYS_TO_DELEGATE
These keys will be copied from the delegatee. All other keys are held in this action itself.

_localProperties

private HashMap _localProperties

_delegatee

private Action _delegatee
The action to delegate to. If it's null, this action is disabled and all method calls will result in IllegalStateExceptions.

_listenerList

private final LinkedList _listenerList
Constructor Detail

DelegatingAction

public DelegatingAction()
Method Detail

getValue

public Object getValue(String key)
Returns value of the key, from delegatee is it's in KEYS_TO_DELEGATE or from this if not.
Specified by:
getValue in interface Action

_isDelegatedKey

private boolean _isDelegatedKey(String key)

putValue

public void putValue(String key,
                     Object value)
Specified by:
putValue in interface Action

setEnabled

public void setEnabled(boolean b)
Specified by:
setEnabled in interface Action

isEnabled

public boolean isEnabled()
Specified by:
isEnabled in interface Action

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Specified by:
addPropertyChangeListener in interface Action

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Specified by:
removePropertyChangeListener in interface Action

actionPerformed

public void actionPerformed(ActionEvent ae)
Specified by:
actionPerformed in interface ActionListener

setDelegatee

public void setDelegatee(Action newDelegatee)

_checkState

private void _checkState()