org.argouml.uml.ui
Class UMLAction

java.lang.Object
  extended byjavax.swing.AbstractAction
      extended byorg.argouml.uml.ui.UMLAction
All Implemented Interfaces:
Action, ActionListener, Cloneable, EventListener, Serializable
Direct Known Subclasses:
AbstractActionAddModelElement, AbstractActionNavigate, AbstractActionNewModelElement, AbstractActionRemoveElement, ActionAboutArgoUML, ActionAddAllClassesFromModel, ActionAddAttribute, ActionAddConcurrentRegion, ActionAddDiagram, ActionAddExistingEdge, ActionAddExistingNode, ActionAddExtensionPoint, ActionAddMessage, ActionAddNote, ActionAddOperation, ActionAddPackage, ActionAddTopLevelPackage, ActionAggregation, ActionAutoCritique, ActionAutoResize, ActionBooleanTaggedValue, ActionCompartmentDisplay, ActionDeleteConcurrentRegion, ActionDeleteFromDiagram, ActionEdgesDisplay, ActionExit, ActionExportXMI, ActionFind, ActionGenerateAll, ActionGenerateOne, ActionGenerateProjectCode, ActionGenerationSettings, ActionGoToCritique, ActionGoToDetails, ActionGotoDiagram, ActionGoToEdit, ActionImportFromSources, ActionLayout, ActionMultiplicity, ActionNavigability, ActionNewToDoItem, ActionNotation, ActionOpenBrowser, ActionOpenCritics, ActionOpenDecisions, ActionOpenGoals, ActionPageSetup, ActionPrint, ActionProperties, ActionRemoveFromModel, ActionSaveConfiguration, ActionSaveGraphics, ActionSequenceDiagram, ActionSetAssociationEndAggregation, ActionSetAssociationEndNavigable, ActionSetAssociationEndOrdering, ActionSetAssociationEndTargetScope, ActionSetAssociationEndType, ActionSetAssociationRoleBase, ActionSetBehavioralFeatureQuery, ActionSetChangeability, ActionSetClassActive, ActionSetClassifierInStateInState, ActionSetCompositeStateConcurrent, ActionSetElementOwnershipSpecification, ActionSetExtendBase, ActionSetExtendExtension, ActionSetFeatureOwner, ActionSetFeatureOwnerScope, ActionSetFlowSource, ActionSetGeneralizableElementAbstract, ActionSetGeneralizableElementLeaf, ActionSetGeneralizableElementRoot, ActionSetGeneralizationPowertype, ActionSetIncludeAddition, ActionSetIncludeBase, ActionSetMetaClass, ActionSetModelElementNamespace, ActionSetModelElementStereotype, ActionSetModelElementVisibility, ActionSetMultiplicity, ActionSetObjectFlowStateClassifier, ActionSetOperationConcurrencyKind, ActionSetParameterDirectionKind, ActionSetParameterType, ActionSetSourcePath, ActionSetStructuralFeatureTargetScope, ActionSetStructuralFeatureType, ActionSetStubStateReferenceState, ActionSetSubmachineStateSubmachine, ActionSettings, ActionSystemInfo, FigNodeModelElement.ActionModifierAbstract, FigNodeModelElement.ActionModifierActive, FigNodeModelElement.ActionModifierLeaf, FigNodeModelElement.ActionModifierRoot, FigNodeModelElement.ActionVisibilityPrivate, FigNodeModelElement.ActionVisibilityProtected, FigNodeModelElement.ActionVisibilityPublic, MoveDownAction, MoveUpAction, NavigateTargetBackAction, NavigateTargetForwardAction, NavigatorPane.ActionPerspectiveConfig, ToDoItemAction

public class UMLAction
extends AbstractAction

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
           
private static Logger LOG
           
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 name, boolean hasIcon)
          The constructor for a non-global action.
UMLAction(String name, boolean global, boolean hasIcon)
          The constructor.
 
Method Summary
 void actionPerformed(ActionEvent e)
          Perform the work the action is supposed to do.
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 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.
private static String stripJunk(String s)
           
 void updateEnabled()
          Enable the action if it should be enabled.
 void updateEnabled(Object target)
           
 
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

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
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 name,
                 boolean hasIcon)
The constructor for a non-global action.

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

UMLAction

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

Parameters:
hasIcon - true if an icon has to be shown
name - the (to be localized) description 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)

actionPerformed

public void actionPerformed(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...

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.

stripJunk

private static String stripJunk(String s)
Parameters:
s - the string to be stripped from junk
Returns:
the cleansed string

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-2004 (20050222)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook