kawigi.cmd
Class GlobalActionAdapter

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by kawigi.cmd.DefaultAction
          extended by kawigi.cmd.GlobalActionAdapter
All Implemented Interfaces:
java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action

public class GlobalActionAdapter
extends DefaultAction

The idea here is to have an action that works as a global version of a local command. This can be useful when commands are positioned in global places (say a menu bar or toolbar or a macro) but have local scope (because they act on a code pane, for instance). This will use the Dispatcher to try and guess which local context they should act on.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class kawigi.cmd.DefaultAction
cmdid, COLOR, enableSet, FONT, LARGE_ICON, SELECTED, SPINNER_MODEL, SPINNER_VALUE, TEXT, visible, VISIBLE, visibleSet
 
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
GlobalActionAdapter(ActID cmdid)
          Constructs a new GlobalActionAdapter on the given ActID.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Executes the current local version of this action.
 DefaultAction getCurrentAction()
          Tries to find the most relevant local version of this action.
 java.lang.Object getValue(java.lang.String s)
          Tries to get the value of a property from the current local version of this action.
 boolean isEnabled()
          Returns true if it can get a local version of this action and that action is enabled.
 boolean isVisible()
          Returns false if it can get a local version of this action and that action is hidden.
 void putValue(java.lang.String s, java.lang.Object value)
          Tries to set the value of a property on the current local version of this action.
 
Methods inherited from class kawigi.cmd.DefaultAction
equals, getID, reportError, setVisible, UIRefresh
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GlobalActionAdapter

public GlobalActionAdapter(ActID cmdid)
Constructs a new GlobalActionAdapter on the given ActID.

Method Detail

getCurrentAction

public DefaultAction getCurrentAction()
Tries to find the most relevant local version of this action.


isEnabled

public boolean isEnabled()
Returns true if it can get a local version of this action and that action is enabled.

Specified by:
isEnabled in interface javax.swing.Action
Overrides:
isEnabled in class javax.swing.AbstractAction

isVisible

public boolean isVisible()
Returns false if it can get a local version of this action and that action is hidden.

Overrides:
isVisible in class DefaultAction

getValue

public java.lang.Object getValue(java.lang.String s)
Tries to get the value of a property from the current local version of this action.

Specified by:
getValue in interface javax.swing.Action
Overrides:
getValue in class javax.swing.AbstractAction

putValue

public void putValue(java.lang.String s,
                     java.lang.Object value)
Tries to set the value of a property on the current local version of this action.

Specified by:
putValue in interface javax.swing.Action
Overrides:
putValue in class javax.swing.AbstractAction

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Executes the current local version of this action.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Specified by:
actionPerformed in class DefaultAction