yu.ac.bg.etf.javaqx.qswing
Class AbstractAction

java.lang.Object
  extended byyu.ac.bg.etf.javaqx.qswing.AbstractAction
All Implemented Interfaces:
AbstractActionProperties, Action, ActionListener, java.lang.Cloneable, java.util.EventListener
Direct Known Subclasses:
AboutQSwingAction, AboutQtAction, ClearAction, CopyAction, CutAction, DeleteAction, ExitAction, NewAction, OpenAction, PageSetupAction, PasteAction, PrintAction, RedoAction, SaveAction, SaveAsAction, SelectAllAction, UndoAction, WhatsThisAction

public abstract class AbstractAction
extends java.lang.Object
implements Action, java.lang.Cloneable, AbstractActionProperties

Abstract Action.

Version:
0.2.0
Author:
Slobodan Vrkacevic (slobodan.vrkacevic@gmail.com)

Field Summary
protected  PropertyChangeSupport changeSupport
           
protected  boolean enabled
           
protected  boolean selected
           
 
Fields inherited from interface yu.ac.bg.etf.javaqx.qswing.Action
ACCELERATOR_KEY, ACCELERATOR_KEY_NAME, ACTION_COMMAND_KEY, DEFAULT, HELP_DESCRIPTION, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON, SMALL_ICON_NAME
 
Fields inherited from interface yu.ac.bg.etf.javaqx.qswing.properties.AbstractActionProperties
PROPERTY_ENABLED, PROPERTY_SELECTED
 
Constructor Summary
AbstractAction()
          Constructs new AbstractAction object.
AbstractAction(java.lang.String name)
          Constructs new AbstractAction object.
AbstractAction(java.lang.String name, Icon icon)
          Constructs new AbstractAction object.
AbstractAction(java.lang.String name, Icon icon, int mnemonic, java.lang.String shortDescription)
          Constructs new AbstractAction object.
AbstractAction(java.lang.String name, Icon icon, int mnemonic, java.lang.String shortDescription, KeyStroke accelerator)
          Constructs new AbstractAction object.
AbstractAction(java.lang.String name, java.lang.String shortDescription)
          Constructs new AbstractAction object.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds property chage listener.
 java.lang.Object clone()
          
protected  void firePropertyChange(java.lang.String propertyName, boolean oldValue, boolean newValue)
          Fires a bound property change.
protected  void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
          Fires a bound property change.
 KeyStroke getAcceleratorKey()
          Returns the value of the accelerator key property.
 java.lang.String getAcceleratorKeyName()
          Returns the value of the accelerator key name property.
static java.lang.String getAcceleratorKeyName(Action action)
          Returns the value of the accelerator key name property for the specified action.
 java.lang.String getActionCommandKey()
          Returns the value of the action command key property.
 java.lang.String getHelpDescription()
          Returns the value of the help description property.
static java.lang.String getHelpDescription(Action action)
          Returns the value of the help description property for the specified action.
 java.util.Iterator getKeyIterator()
          Returns iterator over the keys.
 java.lang.Object[] getKeys()
          Returns the string array containing property names.
 java.lang.String getLongDescription()
          Returns the value of the long description property.
static java.lang.String getLongDescription(Action action)
          Returns the value of the long description property for the specified action.
 int getMnemonicKey()
          Returns the value of the mnemonic key property.
 java.lang.String getName()
          Returns the value of the name property.
static java.lang.String getName(Action action)
          Returns the value of the name property for the specified action.
 java.beans.PropertyChangeListener[] getPropertyChangeListeners()
          Returns property change listeners.
 java.lang.String getShortDescription()
          Returns the value of the short description property.
static java.lang.String getShortDescription(Action action)
          Returns the value of the short description property for the specified action.
 Icon getSmallIcon()
          Returns the value of the small icon property.
 java.lang.String getSmallIconName()
          Returns the value of the small icon name property.
static java.lang.String getSmallIconName(Action action)
          Returns the value of the small icon name property for the specified action.
static java.lang.String getStringValue(Action action, java.lang.String key)
          Returns the string value of the key property for the specified action.
 java.lang.String getStringValue(java.lang.String key)
          Returns the string value of the property specified by the key.
 java.lang.Object getValue(java.lang.String key)
          Returns the value of the property specified by the key.
 boolean isEnabled()
          Returns enabled state of the action.
 boolean isSelected()
          Returns selected state of the action.
 void putValue(java.lang.String key, java.lang.Object value)
          Sets the value of the property specified by the key.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes property chage listener.
 void setAcceleratorKey(KeyStroke accelerator)
          Sets the value of the accelerator key property.
 void setAcceleratorKey(java.lang.String acceleratorName)
          Sets the value of the accelerator key property.
 void setActionCommandKey(java.lang.String actionCommandKey)
          Sets the value of the action command key property.
 void setEnabled(boolean enabled)
          Sets enabled state of the action.
 void setHelpDescription(java.lang.String helpDescription)
          Sets the value of the help description property.
 void setLongDescription(java.lang.String longDescription)
          Sets the value of the long description property.
 void setMnemonicKey(int mnemonic)
          Sets the value of the mnemonic key property.
 void setName(java.lang.String name)
          Sets the value of the name property.
 void setProperties(java.lang.String name, Icon icon)
          Sets group of the action's properties.
 void setProperties(java.lang.String name, Icon icon, int mnemonic, java.lang.String shortDescription, KeyStroke accelerator)
          Sets group of the action's properties.
 void setProperties(java.lang.String name, Icon icon, int mnemonic, java.lang.String shortDescription, java.lang.String longDescription, KeyStroke accelerator)
          Sets group of the action's properties.
 void setProperties(java.lang.String name, java.lang.String shortDescription)
          Sets group of the action's properties.
 void setSelected(boolean selected)
          Sets selected state of the action.
 void setShortDescription(java.lang.String shortDescription)
          Sets the value of the short description property.
 void setSmallIcon(Icon icon)
          Sets the value of the small icon property.
 void setSmallIconName(java.lang.String iconName)
          Sets the value of the small icon name property.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface yu.ac.bg.etf.javaqx.qswing.events.ActionListener
actionPerformed
 

Field Detail

enabled

protected boolean enabled

selected

protected boolean selected

changeSupport

protected PropertyChangeSupport changeSupport
Constructor Detail

AbstractAction

public AbstractAction()
Constructs new AbstractAction object.


AbstractAction

public AbstractAction(java.lang.String name)
Constructs new AbstractAction object.

Parameters:
name - the action name

AbstractAction

public AbstractAction(java.lang.String name,
                      java.lang.String shortDescription)
Constructs new AbstractAction object.

Parameters:
name - the action name
shortDescription - the short description

AbstractAction

public AbstractAction(java.lang.String name,
                      Icon icon)
Constructs new AbstractAction object.

Parameters:
name - the action name
icon - the icon

AbstractAction

public AbstractAction(java.lang.String name,
                      Icon icon,
                      int mnemonic,
                      java.lang.String shortDescription)
Constructs new AbstractAction object.

Parameters:
name - the action name
icon - the icon
mnemonic - the mnemonic
shortDescription - the short description

AbstractAction

public AbstractAction(java.lang.String name,
                      Icon icon,
                      int mnemonic,
                      java.lang.String shortDescription,
                      KeyStroke accelerator)
Constructs new AbstractAction object.

Parameters:
name - the action name
icon - the icon
mnemonic - the mnemonic
shortDescription - the short description
accelerator - the accelerator
Method Detail

getStringValue

public static java.lang.String getStringValue(Action action,
                                              java.lang.String key)
Returns the string value of the key property for the specified action.

Parameters:
action - the action
key - the name of the property
Returns:
the string value of the key property
Throws:
java.lang.NullPointerException - if the action is null

getName

public static java.lang.String getName(Action action)
Returns the value of the name property for the specified action.

Parameters:
action - the action
Returns:
the value of the name property
Throws:
java.lang.NullPointerException - if the action is null

getShortDescription

public static java.lang.String getShortDescription(Action action)
Returns the value of the short description property for the specified action.

Parameters:
action - the action
Returns:
the value of the short description property
Throws:
java.lang.NullPointerException - if the action is null

getLongDescription

public static java.lang.String getLongDescription(Action action)
Returns the value of the long description property for the specified action.

Parameters:
action - the action
Returns:
the value of the long description property
Throws:
java.lang.NullPointerException - if the action is null

getHelpDescription

public static java.lang.String getHelpDescription(Action action)
Returns the value of the help description property for the specified action.

Parameters:
action - the action
Returns:
the value of the help description property
Throws:
java.lang.NullPointerException - if the action is null

getSmallIconName

public static java.lang.String getSmallIconName(Action action)
Returns the value of the small icon name property for the specified action.

Parameters:
action - the action
Returns:
the value of the small icon name property
Throws:
java.lang.NullPointerException - if the action is null

getAcceleratorKeyName

public static java.lang.String getAcceleratorKeyName(Action action)
Returns the value of the accelerator key name property for the specified action.

Parameters:
action - the action
Returns:
the value of the accelerator key name property
Throws:
java.lang.NullPointerException - if the action is null

getStringValue

public java.lang.String getStringValue(java.lang.String key)
Returns the string value of the property specified by the key.

Parameters:
key - the name of the property
Returns:
the string value of the key property

getName

public java.lang.String getName()
Returns the value of the name property.

Returns:
the value of the name property

setName

public void setName(java.lang.String name)
Sets the value of the name property.

Parameters:
name - the new value of the name property

getSmallIcon

public Icon getSmallIcon()
Returns the value of the small icon property.

Returns:
the value of the small icon property

setSmallIcon

public void setSmallIcon(Icon icon)
Sets the value of the small icon property.

Parameters:
icon - the new value of the small icon property

getSmallIconName

public java.lang.String getSmallIconName()
Returns the value of the small icon name property.

Returns:
the value of the small icon name property

setSmallIconName

public void setSmallIconName(java.lang.String iconName)
Sets the value of the small icon name property.

Parameters:
iconName - the new value of the small icon name property

getMnemonicKey

public int getMnemonicKey()
Returns the value of the mnemonic key property.

Returns:
the value of the mnemonic key property

setMnemonicKey

public void setMnemonicKey(int mnemonic)
Sets the value of the mnemonic key property.

Parameters:
mnemonic - the new value of the mnemonic key property

getShortDescription

public java.lang.String getShortDescription()
Returns the value of the short description property.

Returns:
the value of the short description property

setShortDescription

public void setShortDescription(java.lang.String shortDescription)
Sets the value of the short description property.

Parameters:
shortDescription - the new value of the short description property

getLongDescription

public java.lang.String getLongDescription()
Returns the value of the long description property.

Returns:
the value of the long description property

setLongDescription

public void setLongDescription(java.lang.String longDescription)
Sets the value of the long description property.

Parameters:
longDescription - the new value of the long description property

getHelpDescription

public java.lang.String getHelpDescription()
Returns the value of the help description property.

Returns:
the value of the help description property

setHelpDescription

public void setHelpDescription(java.lang.String helpDescription)
Sets the value of the help description property.

Parameters:
helpDescription - the new value of the help description property

getAcceleratorKey

public KeyStroke getAcceleratorKey()
Returns the value of the accelerator key property.

Returns:
the value of accelerator key property

setAcceleratorKey

public void setAcceleratorKey(KeyStroke accelerator)
Sets the value of the accelerator key property.

Parameters:
accelerator - the new value of the accelerator key property

getAcceleratorKeyName

public java.lang.String getAcceleratorKeyName()
Returns the value of the accelerator key name property.

Returns:
the value of accelerator key name property

setAcceleratorKey

public void setAcceleratorKey(java.lang.String acceleratorName)
Sets the value of the accelerator key property.

Parameters:
acceleratorName - the new value of the accelerator key name property

getActionCommandKey

public java.lang.String getActionCommandKey()
Returns the value of the action command key property.

Returns:
the value of action command key property

setActionCommandKey

public void setActionCommandKey(java.lang.String actionCommandKey)
Sets the value of the action command key property.

Parameters:
actionCommandKey - the new value of the action command key property

setProperties

public void setProperties(java.lang.String name,
                          Icon icon,
                          int mnemonic,
                          java.lang.String shortDescription,
                          java.lang.String longDescription,
                          KeyStroke accelerator)
Sets group of the action's properties.

Parameters:
name - the value of the name property
icon - the value of the small icon property
mnemonic - the value of the mnemonic key property
shortDescription - the value of the short description property
longDescription - the value of the long description property
accelerator - the value of the accelerator key property

setProperties

public void setProperties(java.lang.String name,
                          Icon icon,
                          int mnemonic,
                          java.lang.String shortDescription,
                          KeyStroke accelerator)
Sets group of the action's properties.

Parameters:
name - the value of the name property
icon - the value of the small icon property
mnemonic - the value of the mnemonic key property
shortDescription - the value of the short description property
accelerator - the value of the accelerator key property

setProperties

public void setProperties(java.lang.String name,
                          java.lang.String shortDescription)
Sets group of the action's properties.

Parameters:
name - the value of the name property
shortDescription - the value of the short description property

setProperties

public void setProperties(java.lang.String name,
                          Icon icon)
Sets group of the action's properties.

Parameters:
name - the value of the name property
icon - the value of the small icon property

getKeys

public java.lang.Object[] getKeys()
Returns the string array containing property names.

Returns:
the string array containing property names

getKeyIterator

public java.util.Iterator getKeyIterator()
Returns iterator over the keys.

Returns:
iterator over the keys

getPropertyChangeListeners

public java.beans.PropertyChangeListener[] getPropertyChangeListeners()
Returns property change listeners.

Returns:
property change listeners

firePropertyChange

protected void firePropertyChange(java.lang.String propertyName,
                                  java.lang.Object oldValue,
                                  java.lang.Object newValue)
Fires a bound property change.

Parameters:
propertyName - the property name
oldValue - the old value of the property
newValue - the new value of the property

firePropertyChange

protected void firePropertyChange(java.lang.String propertyName,
                                  boolean oldValue,
                                  boolean newValue)
Fires a bound property change.

Parameters:
propertyName - the property name
oldValue - the old value of the property (as a boolean)
newValue - the new value of the property (as a boolean)

getValue

public java.lang.Object getValue(java.lang.String key)
Returns the value of the property specified by the key.

Specified by:
getValue in interface Action
Parameters:
key - the property key
Returns:
the value of this property or null if there is no such property

putValue

public void putValue(java.lang.String key,
                     java.lang.Object value)
Sets the value of the property specified by the key.

Specified by:
putValue in interface Action
Parameters:
key - the property key
value - the new property value

isEnabled

public boolean isEnabled()
Returns enabled state of the action.

Specified by:
isEnabled in interface Action
Returns:
enabled state of the action

setEnabled

public void setEnabled(boolean enabled)
Sets enabled state of the action.

Specified by:
setEnabled in interface Action
Parameters:
enabled - the new enabled state

isSelected

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

Specified by:
isSelected in interface Action
Returns:
selected state of the action

setSelected

public void setSelected(boolean selected)
Sets selected state of the action.

Specified by:
setSelected in interface Action
Parameters:
selected - the new selected state

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds property chage listener.

Specified by:
addPropertyChangeListener in interface Action
Parameters:
listener - the property chage listener

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes property chage listener.

Specified by:
removePropertyChangeListener in interface Action
Parameters:
listener - the property chage listener

clone

public java.lang.Object clone()



Copyright © 2007 ETF and contributors. All Rights Reserved.