org.argouml.uml.ui.behavior.use_cases
Class UMLIncludeListModel

java.lang.Object
  |
  +--javax.swing.AbstractListModel
        |
        +--org.argouml.uml.ui.UMLModelElementListModel
              |
              +--org.argouml.uml.ui.behavior.use_cases.UMLIncludeListModel
All Implemented Interfaces:
javax.swing.ListModel, NotationContext, java.io.Serializable, UMLUserInterfaceComponent

Deprecated. as of ArgoUml 0.13.5 (10-may-2003), replaced by ?, this class is part of the 'old'(pre 0.13.*) implementation of proppanels that used reflection a lot.

public class UMLIncludeListModel
extends UMLModelElementListModel

A list model for the include relationship on use case property panels.

Supports the full menu (Open, Add, Delete, Move Up, Move Down). Provides its own formatElement routine, to use the name of the base use case (where the container is a use case) or the extension use case (where the container is an extension point, rather than name of the extend relationship itself.

Note. There is a bug in NSUML, where the "include" and "include2" associations of a use case are back to front, i.e "include" is used as the opposite end of "addition" to point to an including use case, rather than an included use case. Fixed within the include relationship, rather than the use case, by reversing the use of access functions for the "base" and "addition" associations in the code.

See Also:
Serialized Form

Field Summary
protected static Category cat
          Deprecated.  
 
Fields inherited from class org.argouml.uml.ui.UMLModelElementListModel
_upper, NO_LIMIT
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
UMLIncludeListModel(UMLUserInterfaceContainer container, java.lang.String property, boolean showNone)
          Deprecated. Create a new list model.
 
Method Summary
 void add(int index)
          Deprecated. Implement the "add" function of the pop up menu.
 boolean buildPopup(javax.swing.JPopupMenu popup, int index)
          Deprecated. This method builds a context (pop-up) menu for the list.
 void delete(int index)
          Deprecated. Implement the "delete" function of the pop up menu.
 java.lang.Object formatElement(MModelElement element)
          Deprecated. Format a given model element.
protected  MModelElement getModelElementAt(int index)
          Deprecated. Get the element at a given offset in the model This method must be provided to override the abstract method in the parent.
 void moveDown(int index)
          Deprecated. The action that occurs with the "MoveDown" pop up.
 void moveUp(int index)
          Deprecated. Implement the action that occurs with the "MoveUp" pop up.
protected  int recalcModelElementSize()
          Deprecated. Compute the size of the list model.
 
Methods inherited from class org.argouml.uml.ui.UMLModelElementListModel
addAtUtil, elementAtUtil, getContainer, getContextNotation, getElementAt, getModelElementSize, getProperty, getSize, getTarget, getUpperBound, listRoleItemSet, moveDownUtil, moveUpUtil, navigateTo, open, propertySet, recovered, removed, resetSize, roleAdded, roleRemoved, setUpperBound, targetChanged, targetReasserted
 
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cat

protected static Category cat
Deprecated. 
Constructor Detail

UMLIncludeListModel

public UMLIncludeListModel(UMLUserInterfaceContainer container,
                           java.lang.String property,
                           boolean showNone)
Deprecated. 

Create a new list model.

Implementation is just an invocation of the parent constructor.

Parameters:
container - The container for this list - the use case property panel.
property - The name associated with the NSUML MElementEvent that we are tracking or null if we track them all. We probably want to just track the "include" event.
showNone - True if an empty list is represented by the keyword "none"
Method Detail

recalcModelElementSize

protected int recalcModelElementSize()
Deprecated. 

Compute the size of the list model. This method must be provided to override the abstract method in the parent.

Specified by:
recalcModelElementSize in class UMLModelElementListModel
Returns:
the number of elements the list model (0 if there are none).

getModelElementAt

protected MModelElement getModelElementAt(int index)
Deprecated. 

Get the element at a given offset in the model This method must be provided to override the abstract method in the parent.

The implementation makes use of the UMLModelElementListModel.elementAtUtil(java.util.Collection, int, java.lang.Class) method, which takes care of all unusual cases.

Specified by:
getModelElementAt in class UMLModelElementListModel
Parameters:
index - index of model element (zero based).
Returns:
the element at that index if there is one, otherwise null.

formatElement

public java.lang.Object formatElement(MModelElement element)
Deprecated. 

Format a given model element.

If there is no addition use case, use the default text ("(anon)"). Otherwise use the parent formatElement on the use case attached as addition to the extend relationship , which will ultimately invoke the format element method of PropPanel.

In this current implementation, more rigorously checks it is formatting an extend relationship.

Note. There is a bug in NSUML, where the "include" and "include2" associations of a use case are back to front, i.e "include" is used as the opposite end of "addition" to point to an including use case, rather than an included use case. Fixed within the include relationship, rather than the use case, by reversing the meaning of the "base" and "association" associations in the code.

Overrides:
formatElement in class UMLModelElementListModel
Parameters:
element - the model element to format
Returns:
an object (typically a string) representing the element.

add

public void add(int index)
Deprecated. 

Implement the "add" function of the pop up menu.

Pops up the UMLAddDialog. The user can include existing usecases to this model's target.

Note. There is a bug in NSUML, where the "include" and "include2" associations of a use case are back to front, i.e "include" is used as the opposite end of "addition" to point to an including use case, rather than an included use case. Fixed within the include relationship, rather than the use case, by reversing the use of access functions for the "base" and "addition" associations in the code.

Parameters:
index - Offset in the list of the element at which the pop-up was invoked.

delete

public void delete(int index)
Deprecated. 

Implement the "delete" function of the pop up menu. Delete the element at the given index.

Find the use cases at each end (note that NSUML uses the name "include2" for the use case doing the included, since it is unnamed in the standard). Delete their references to this include relationship. Also remove from the namespace.

Note. We don't actually need to check the target PropPanel is a use case—given an include relationship we can delete it.

Note. There is a bug in NSUML, where the "include" and "include2" associations of a use case are back to front, i.e "include" is used as the opposite end of "addition" to point to an including use case, rather than an included use case. Fixed within the include relationship, rather than the use case, by reversing the use of access functions for the "base" and "addition" associations in the code.

Overrides:
delete in class UMLModelElementListModel
Parameters:
index - Offset in the list of the element at which the pop-up was invoked and which is to be deleted.

moveUp

public void moveUp(int index)
Deprecated. 

Implement the action that occurs with the "MoveUp" pop up.

Move the include relationship at the given index in the list up one (unless it is already at the top). Since we use UMLModelElementListModel.moveUpUtil(java.util.Collection, int) there is no need to test for unusual cases.

Note. There is a bug in NSUML, where the "include" and "include2" associations of a use case are back to front, i.e "include" is used as the opposite end of "addition" to point to an including use case, rather than an included use case. Fixed within the include relationship, rather than the use case, by reversing the use of access functions for the "base" and "addition" associations in the code.

Parameters:
index - the index in the list of the include relationship to move up.

moveDown

public void moveDown(int index)
Deprecated. 

The action that occurs with the "MoveDown" pop up.

Move the include relationship at the given index in the list down one (unless it is already at the bottom). Since we use UMLModelElementListModel.moveUpUtil(java.util.Collection, int) there is no need to test for unusual cases.

Note. There is a bug in NSUML, where the "include" and "include2" associations of a use case are back to front, i.e "include" is used as the opposite end of "addition" to point to an including use case, rather than an included use case. Fixed within the include relationship, rather than the use case, by reversing the use of access functions for the "base" and "addition" associations in the code.

Parameters:
index - the index in the list of the include relationship to move down.

buildPopup

public boolean buildPopup(javax.swing.JPopupMenu popup,
                          int index)
Deprecated. 
Description copied from class: UMLModelElementListModel
This method builds a context (pop-up) menu for the list. This method may be overriden for lists that have additional menu items or when the default list of actions is inappropriate.

Overrides:
buildPopup in class UMLModelElementListModel
Parameters:
popup - popup menu
index - index of selected list item
Returns:
"true" if popup menu should be displayed
See Also:
UMLModelElementListModel.buildPopup(JPopupMenu, int)


ArgoUML © 1996-2003 (20040216)ArgoUML Project HomeArgoUML Cookbook