de.kleopatra.view.presentation
Class DelegateAction

java.lang.Object
  extended byjavax.swing.AbstractAction
      extended byde.kleopatra.view.presentation.DelegateAction
All Implemented Interfaces:
javax.swing.Action, java.awt.event.ActionListener, java.lang.Cloneable, java.util.EventListener, java.io.Serializable

public class DelegateAction
extends javax.swing.AbstractAction

Delegates the action performed to another ActionListener.

Version:
1.6 04/16/03
Author:
Mark Davidson Added support for Action as delegate. This will guarantee enabled property to be in synch., Jeanette Winzenburg
See Also:
Serialized Form

Field Summary
 
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
DelegateAction()
           
DelegateAction(java.lang.String name)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent evt)
           
 void addAction(javax.swing.Action action)
          add action as actionListener.
 void addActionListener(java.awt.event.ActionListener listener)
          add actionListener as delegate and set handler to null.
 void addActionListener(java.awt.event.ActionListener listener, java.lang.Object handler)
          add actionListener as delegate and set handler.
 java.awt.event.ActionListener[] getActionListeners()
           
 java.lang.Object getHandler()
          used in testing only.
protected  java.util.Map getValueMap()
           
 void removeActionListener(java.awt.event.ActionListener listener)
          remove actionListener and handler, if any.
 void setEnabled(boolean enabled)
           
 java.lang.String toString()
          convenience: returns list of properties.
protected  void updateEnabledFromDelegate(boolean delegateEnabled)
           
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DelegateAction

public DelegateAction(java.lang.String name)

DelegateAction

public DelegateAction()
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent evt)

setEnabled

public void setEnabled(boolean enabled)

addActionListener

public void addActionListener(java.awt.event.ActionListener listener,
                              java.lang.Object handler)
add actionListener as delegate and set handler.

PENDING: do we really need access to the handler? internally used for testing only


addActionListener

public void addActionListener(java.awt.event.ActionListener listener)
add actionListener as delegate and set handler to null.

Parameters:
listener -

addAction

public void addAction(javax.swing.Action action)
add action as actionListener.

guarantees synch of enabled property between this and the action.

Parameters:
action -

removeActionListener

public void removeActionListener(java.awt.event.ActionListener listener)
remove actionListener and handler, if any. does nothing if the listener is not the same as the delegate


getActionListeners

public java.awt.event.ActionListener[] getActionListeners()

getHandler

public java.lang.Object getHandler()
used in testing only. Should remove?

Returns:

toString

public java.lang.String toString()
convenience: returns list of properties.


updateEnabledFromDelegate

protected void updateEnabledFromDelegate(boolean delegateEnabled)

getValueMap

protected java.util.Map getValueMap()


Copyright © 2003, 2004 SwingEmpire Jeanette Winzenburg. All Rights Reserved.