Quaqua 7.4.2 2011-07-05

ch.randelshofer.quaqua
Class QuaquaUIAction

java.lang.Object
  extended by ch.randelshofer.quaqua.QuaquaUIAction
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, javax.swing.Action

public abstract class QuaquaUIAction
extends java.lang.Object
implements javax.swing.Action

QuaquaUIAction is the basis of all of basic's action classes that are used in an ActionMap. Subclasses need to override actionPerformed.

A typical subclass will look like:

    private static class Actions extends UIAction {
        Actions(String name) {
            super(name);
        }

        public void actionPerformed(ActionEvent ae) {
            if (getName() == "selectAll") {
                selectAll();
            }
            else if (getName() == "cancelEditing") {
                cancelEditing();
            }
        }
    }
 

Subclasses that wish to conditionalize the enabled state should override isEnabled(Component), and be aware that the passed in Component may be null.

Author:
Werner Randelshofer  @version 1.0 Jan 25, 2008 Created.

Field Summary
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
QuaquaUIAction(java.lang.String name)
           
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 java.lang.String getName()
           
 java.lang.Object getValue(java.lang.String key)
           
 boolean isEnabled()
          Cover method for isEnabled(null).
 boolean isEnabled(java.lang.Object sender)
          Subclasses that need to conditionalize the enabled state should override this.
 void putValue(java.lang.String key, java.lang.Object value)
           
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 void setEnabled(boolean b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.awt.event.ActionListener
actionPerformed
 

Constructor Detail

QuaquaUIAction

public QuaquaUIAction(java.lang.String name)
Method Detail

getName

public final java.lang.String getName()

getValue

public java.lang.Object getValue(java.lang.String key)
Specified by:
getValue in interface javax.swing.Action

putValue

public void putValue(java.lang.String key,
                     java.lang.Object value)
Specified by:
putValue in interface javax.swing.Action

setEnabled

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

isEnabled

public final boolean isEnabled()
Cover method for isEnabled(null).

Specified by:
isEnabled in interface javax.swing.Action

isEnabled

public boolean isEnabled(java.lang.Object sender)
Subclasses that need to conditionalize the enabled state should override this. Be aware that sender may be null.

Parameters:
sender - Widget enabled state is being asked for, may be null.

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Specified by:
addPropertyChangeListener in interface javax.swing.Action

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Specified by:
removePropertyChangeListener in interface javax.swing.Action

Copyright 2003-2007 (c) Werner Randelshofer.
All rights reserved.