org.jppf.ui.actions
Class AbstractUpdatableAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by org.jppf.ui.actions.AbstractUpdatableAction
All Implemented Interfaces:
ActionListener, Serializable, Cloneable, EventListener, Action, UpdatableAction, ValueChangeListener
Direct Known Subclasses:
AbstractJobAction, AbstractTopologyAction

public abstract class AbstractUpdatableAction
extends AbstractAction
implements UpdatableAction

Abstract superclass for actions used in toolbars or popup menus.

Author:
Laurent Cohen
See Also:
Serialized Form

Field Summary
protected  String BASE
          The base location for internationalized messages.
protected  Point location
          Location at which to display any window or dialog created by this action.
protected  List<Object> selectedElements
          The list of selected elements.
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
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
AbstractUpdatableAction()
           
 
Method Summary
 Point getLocation()
          Get the location at which to display any window or dialog created by this action.
protected  String localize(String message)
          Get a localized message given its unique name and the current locale.
 void setLocation(Point location)
          Set the location at which to display any window or dialog created by this action.
protected  void setupIcon(String name)
          Set the icon for this action using the specified image file name.
protected  void setupNameAndTooltip(String name)
          Set the action name and tooltip text.
 void updateState(List<Object> selectedElements)
          Update this action's enabled state based on a list of selected elements.
 void valueChanged(ValueChangeEvent event)
          Method called when the action is triggered.
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.Action
addPropertyChangeListener, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from interface java.awt.event.ActionListener
actionPerformed
 

Field Detail

BASE

protected String BASE
The base location for internationalized messages.


selectedElements

protected List<Object> selectedElements
The list of selected elements.


location

protected Point location
Location at which to display any window or dialog created by this action.

Constructor Detail

AbstractUpdatableAction

public AbstractUpdatableAction()
Method Detail

getLocation

public Point getLocation()
Get the location at which to display any window or dialog created by this action.

Returns:
a Point instance.

setLocation

public void setLocation(Point location)
Set the location at which to display any window or dialog created by this action.

Parameters:
location - a Point instance.

updateState

public void updateState(List<Object> selectedElements)
Update this action's enabled state based on a list of selected elements.

Specified by:
updateState in interface UpdatableAction
Parameters:
selectedElements - a list of objects.
See Also:
UpdatableAction.updateState(java.util.List)

valueChanged

public void valueChanged(ValueChangeEvent event)
Method called when the action is triggered.

Specified by:
valueChanged in interface ValueChangeListener
Parameters:
event - the event encapsulating the source of the event.
See Also:
ValueChangeListener.valueChanged(org.jppf.ui.options.event.ValueChangeEvent)

setupIcon

protected void setupIcon(String name)
Set the icon for this action using the specified image file name.

Parameters:
name - the name of the icon image file.

setupNameAndTooltip

protected void setupNameAndTooltip(String name)
Set the action name and tooltip text.

Parameters:
name - the key to find the name and tooltip in the localized resource bundles.

localize

protected String localize(String message)
Get a localized message given its unique name and the current locale.

Parameters:
message - the unique name of the localized message.
Returns:
a message in the current locale, or the default locale if the localization for the current locale is not found.


Copyright © 2005-2010 JPPF Team.