org.argouml.uml.ui
Class UMLAction

java.lang.Object
  extended byjavax.swing.AbstractAction
      extended byorg.tigris.gef.undo.UndoableAction
          extended byorg.argouml.uml.ui.UMLAction
All Implemented Interfaces:
Action, ActionListener, Cloneable, EventListener, Serializable
Direct Known Subclasses:
AbstractActionAddModelElement, AbstractActionCheckBoxMenuItem, AbstractActionNavigate, AbstractActionNewModelElement, AbstractActionRadioMenuItem, AbstractActionRemoveElement, ActionAboutArgoUML, ActionAddAllClassesFromModel, ActionAddConcurrentRegion, ActionAddDiagram, ActionAddExistingEdge, ActionAddExistingNode, ActionAddExtensionPoint, ActionAddMessage, ActionAddNote, ActionAddPackage, ActionAddStereotype, ActionAddTopLevelPackage, ActionAggregation, ActionAutoCritique, ActionAutoResize, ActionBaseDelete, ActionBooleanTaggedValue, ActionCompartmentDisplay, ActionDeleteConcurrentRegion, ActionEdgesDisplay, ActionExit, ActionFind, ActionGenerateAll, ActionGenerateOne, ActionGenerateProjectCode, ActionGenerationSettings, ActionGoToCritique, ActionGotoDiagram, ActionImportFromSources, ActionLayout, ActionMultiplicity, ActionNavigability, ActionNewToDoItem, ActionNotation, ActionOpenBrowser, ActionOpenCritics, ActionOpenDecisions, ActionOpenGoals, ActionProperties, ActionRESequenceDiagram, ActionSaveAllGraphics, ActionSaveConfiguration, ActionSaveGraphics, ActionSequenceDiagram, ActionSetActionAsynchronous, ActionSetAssociationEndAggregation, ActionSetAssociationEndNavigable, ActionSetAssociationEndOrdering, ActionSetAssociationEndTargetScope, ActionSetAssociationEndType, ActionSetAssociationRoleBase, ActionSetBehavioralFeatureQuery, ActionSetChangeability, ActionSetClassActive, ActionSetClassifierInStateInState, ActionSetCompositeStateConcurrent, ActionSetContextStateMachine, ActionSetElementOwnershipSpecification, ActionSetFeatureOwner, ActionSetFeatureOwnerScope, ActionSetFlowSource, ActionSetGeneralizableElementAbstract, ActionSetGeneralizableElementLeaf, ActionSetGeneralizableElementRoot, ActionSetGeneralizationPowertype, ActionSetLinkAssociation, ActionSetMetaClass, ActionSetModelElementNamespace, ActionSetModelElementStereotype, ActionSetModelElementVisibility, ActionSetMultiplicity, ActionSetObjectFlowStateClassifier, ActionSetOperationConcurrencyKind, ActionSetParameterDirectionKind, ActionSetParameterType, ActionSetPath, ActionSetSourcePath, ActionSetStructuralFeatureTargetScope, ActionSetStructuralFeatureType, ActionSetStubStateReferenceState, ActionSetSubmachineStateSubmachine, ActionSetTagDefinitionNamespace, ActionSetTagDefinitionOwner, ActionSetTagDefinitionType, ActionSettings, ActionSystemInfo, MoveDownAction, MoveUpAction, NavigateTargetBackAction, NavigateTargetForwardAction, NavigatorPane.ActionPerspectiveConfig, ToDoItemAction

public class UMLAction
extends org.tigris.gef.undo.UndoableAction

The prototype of all actions within ArgoUML.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.AbstractAction
 
Field Summary
static boolean HAS_ICON
          Constant for determining the icon.
private  String iconName
          The key for the icon name.
private static Logger LOG
          Logger.
static boolean NO_ICON
          Constant for determining the icon.
 
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
UMLAction(String name)
          The constructor for a non-global action with icon.
UMLAction(String key, boolean hasIcon)
          The constructor for a non-global action.
UMLAction(String key, boolean global, boolean hasIcon)
          The constructor.
 
Method Summary
static String getMnemonic(String key)
          This function returns a localized string corresponding to the specified key.
 Object getValue(String key)
          Gets one of this object's properties using the associated key.
 boolean isEnabled()
           
 void oldActionPerformed(ActionEvent e)
          Perform the work the action is supposed to do.
 void putValue(String key, Object value)
          Sets one of this object's properties using the associated key.
 boolean shouldBeEnabled()
          Return true if this action should be available to the user.
 void updateEnabled()
          Enable the action if it should be enabled.
 void updateEnabled(Object target)
           
 
Methods inherited from class org.tigris.gef.undo.UndoableAction
actionPerformed
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final Logger LOG
Logger.


HAS_ICON

public static final boolean HAS_ICON
Constant for determining the icon.

See Also:
Constant Field Values

NO_ICON

public static final boolean NO_ICON
Constant for determining the icon.

See Also:
Constant Field Values

iconName

private String iconName
The key for the icon name.

Constructor Detail

UMLAction

public UMLAction(String name)
The constructor for a non-global action with icon.

Parameters:
name - the (to be localized) description of the action

UMLAction

public UMLAction(String key,
                 boolean hasIcon)
The constructor for a non-global action.

Parameters:
key - the (to be localized) name of the action
hasIcon - true if an icon is to be shown

UMLAction

public UMLAction(String key,
                 boolean global,
                 boolean hasIcon)
The constructor.

Parameters:
hasIcon - true if an icon has to be shown
key - the (to be localized) name of the action
global - the action is global, i.e. implements shouldBeEnabled(), and listens to Target changes
Method Detail

putValue

public void putValue(String key,
                     Object value)
Sets one of this object's properties using the associated key. If the value has changed, a PropertyChangeEvent is sent to listeners.

Parameters:
key - a String containing the key.
value - an Object value.

getValue

public Object getValue(String key)
Gets one of this object's properties using the associated key.

Parameters:
key - the name of the property.
Returns:
the value of the property.
See Also:
putValue(String, Object)

oldActionPerformed

public void oldActionPerformed(ActionEvent e)
Perform the work the action is supposed to do. This method needs to be overridden by all actions, since it only shows a fake progressbar... TODO: I suspect the above comment may well not be true. We need to some how get rid of this anyway. If we find everything works then delete it otherwise we find a way to fix.

See Also:
ActionListener.actionPerformed(java.awt.event.ActionEvent)

updateEnabled

public void updateEnabled(Object target)
Parameters:
target - the action to be enabled

updateEnabled

public void updateEnabled()
Enable the action if it should be enabled.


shouldBeEnabled

public boolean shouldBeEnabled()
Return true if this action should be available to the user. This method should examine the ProjectBrowser that owns it. Subclass implementations of this method should always call super.shouldBeEnabled first, and AND it with their own condition.

"Global" actions shall implement this function! - Otherwise it is not usefull to make them global...

Returns:
true if the action should be available.

getMnemonic

public static final String getMnemonic(String key)
This function returns a localized string corresponding to the specified key.

Parameters:
key - the given key
Returns:
a localized string corresponding to the given key

isEnabled

public boolean isEnabled()
See Also:
Action.isEnabled()


ArgoUML © 1996-2005ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook