org.argouml.uml.diagram.ui
Class ActionCompartmentDisplay

java.lang.Object
  extended byjavax.swing.AbstractAction
      extended byorg.argouml.uml.ui.UMLAction
          extended byorg.argouml.uml.diagram.ui.ActionCompartmentDisplay
All Implemented Interfaces:
Action, ActionListener, Cloneable, EventListener, Serializable

public class ActionCompartmentDisplay
extends UMLAction

A class to implement the actions involved in hiding and showing compartments on interfaces, classes and use cases.

This implementation extended to handle compartments for extension points on use cases.

The class declares a number of static instances, each with an actionPerformed method that performs the required action.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.AbstractAction
 
Field Summary
private  String compartment
          A string indicating the action desired.
private  boolean display
          A flag to indicate whether the action should show or hide the relevant compartment.
private static UMLAction HIDE_ALL_COMPARTMENTS
          Static instance to hide both compartments of a class.
private static UMLAction HIDE_ATTR_COMPARTMENT
          Static instance to hide the attribute compartment of a class.
private static UMLAction HIDE_EXTPOINT_COMPARTMENT
          Static instance to hide the extension point compartment of a use case.
private static UMLAction HIDE_OPER_COMPARTMENT
          Static instance to hide the operation compartment of a class.
private static UMLAction SHOW_ALL_COMPARTMENTS
          Static instance to show both compartments of a class.
private static UMLAction SHOW_ATTR_COMPARTMENT
          Static instance to show the attribute compartment of a class.
private static UMLAction SHOW_EXTPOINT_COMPARTMENT
          Static instance to show the extension point compartment of a use case.
private static UMLAction SHOW_OPER_COMPARTMENT
          Static instance to show the operation compartment of a class.
 
Fields inherited from class org.argouml.uml.ui.UMLAction
HAS_ICON, NO_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
protected ActionCompartmentDisplay(boolean d, String c)
          Constructor for a new instance.
 
Method Summary
 void actionPerformed(ActionEvent ae)
          Action method invoked when an event triggers this action.
static UMLAction hideAllCompartments()
           
static UMLAction hideAttrCompartment()
           
static UMLAction hideExtPointCompartment()
           
static UMLAction hideOperCompartment()
           
 boolean shouldBeEnabled()
          Indicate whether this action should be enabled.
static UMLAction showAllCompartments()
           
static UMLAction showAttrCompartment()
           
static UMLAction showExtPointCompartment()
           
static UMLAction showOperCompartment()
           
 
Methods inherited from class org.argouml.uml.ui.UMLAction
getMnemonic, getValue, isEnabled, putValue, updateEnabled, updateEnabled
 
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

display

private boolean display

A flag to indicate whether the action should show or hide the relevant compartment.


compartment

private String compartment

A string indicating the action desired.


SHOW_ATTR_COMPARTMENT

private static final UMLAction SHOW_ATTR_COMPARTMENT
Static instance to show the attribute compartment of a class.


HIDE_ATTR_COMPARTMENT

private static final UMLAction HIDE_ATTR_COMPARTMENT
Static instance to hide the attribute compartment of a class.


SHOW_OPER_COMPARTMENT

private static final UMLAction SHOW_OPER_COMPARTMENT
Static instance to show the operation compartment of a class.


HIDE_OPER_COMPARTMENT

private static final UMLAction HIDE_OPER_COMPARTMENT
Static instance to hide the operation compartment of a class.


SHOW_EXTPOINT_COMPARTMENT

private static final UMLAction SHOW_EXTPOINT_COMPARTMENT
Static instance to show the extension point compartment of a use case.


HIDE_EXTPOINT_COMPARTMENT

private static final UMLAction HIDE_EXTPOINT_COMPARTMENT
Static instance to hide the extension point compartment of a use case.


SHOW_ALL_COMPARTMENTS

private static final UMLAction SHOW_ALL_COMPARTMENTS
Static instance to show both compartments of a class.


HIDE_ALL_COMPARTMENTS

private static final UMLAction HIDE_ALL_COMPARTMENTS
Static instance to hide both compartments of a class.

Constructor Detail

ActionCompartmentDisplay

protected ActionCompartmentDisplay(boolean d,
                                   String c)
Constructor for a new instance. Can only be called by this class or its children, since used to create static instances only.

Parameters:
d - true if the compartment is to be shown, false if it is to be hidden.
c - The text to be displayed for this action.
Method Detail

actionPerformed

public void actionPerformed(ActionEvent ae)

Action method invoked when an event triggers this action.

The compartment instance variable defines the action to take, and the display instance variable whether it should set visibility or note.

Note. The display instance variable is really redundant. Its value is implied by the operation.

Specified by:
actionPerformed in interface ActionListener
Overrides:
actionPerformed in class UMLAction
Parameters:
ae - The event that triggered us.
See Also:
ActionListener.actionPerformed(java.awt.event.ActionEvent)

shouldBeEnabled

public boolean shouldBeEnabled()

Indicate whether this action should be enabled.

Always returns true in this implementation.

Overrides:
shouldBeEnabled in class UMLAction
Returns:
true if the action should be enabled, false otherwise. Always returns true in this implementation.

showAttrCompartment

public static UMLAction showAttrCompartment()
Returns:
the action to show the attribute compartment

hideAttrCompartment

public static UMLAction hideAttrCompartment()
Returns:
the action to hide the attribute compartment

showOperCompartment

public static UMLAction showOperCompartment()
Returns:
the action to show the operation compartment

hideOperCompartment

public static UMLAction hideOperCompartment()
Returns:
the action to hide the operation compartment

showExtPointCompartment

public static UMLAction showExtPointCompartment()
Returns:
the action to show the extension point compartment

hideExtPointCompartment

public static UMLAction hideExtPointCompartment()
Returns:
the action to hide the extension point compartment

showAllCompartments

public static UMLAction showAllCompartments()
Returns:
the action to show all the compartments

hideAllCompartments

public static UMLAction hideAllCompartments()
Returns:
the action to hide all compartments


ArgoUML © 1996-2004 (20050222)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook