org.argouml.uml.ui
Class UMLModelElementOrderedListModel2

java.lang.Object
  extended byjavax.swing.AbstractListModel
      extended byjavax.swing.DefaultListModel
          extended byorg.argouml.uml.ui.UMLModelElementListModel2
              extended byorg.argouml.uml.ui.UMLModelElementOrderedListModel2
All Implemented Interfaces:
EventListener, ListModel, ru.novosoft.uml.MElementListener, Serializable, TargetListener
Direct Known Subclasses:
UMLAssociationConnectionListModel, UMLAssociationEndQualifiersListModel, UMLAssociationRoleAssociationEndRoleListModel, UMLClassAttributeListModel, UMLClassifierFeatureListModel, UMLClassifierParameterListModel, UMLClassOperationListModel, UMLLinkConnectionListModel, UMLUseCaseExtensionPointListModel

public abstract class UMLModelElementOrderedListModel2
extends UMLModelElementListModel2

This class resembles UMLModelElementListModel2, but is for those associations in the metamodel (see UML standard) that have a {ordered} constraint.

This adds the functionality of a popup menu with the items "Move Up" and "Move Down".

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.argouml.uml.ui.UMLModelElementListModel2
 
Fields inherited from class javax.swing.DefaultListModel
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
UMLModelElementOrderedListModel2()
          The constructor.
UMLModelElementOrderedListModel2(String name)
          The constructor.
 
Method Summary
protected abstract  void buildModelList()
          Builds the list of elements.
 boolean buildPopup(JPopupMenu popup, int index)
          Override this if you want a popup menu.
protected abstract  boolean isValidElement(Object element)
          Returns true if the given element is valid, i.e.
abstract  void swap(int index1, int index2)
          This function should swap two elements in the UML model.
 
Methods inherited from class org.argouml.uml.ui.UMLModelElementListModel2
addAll, addElement, contains, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getChangedElement, getEventName, getTarget, isValidEvent, listRoleItemSet, propertySet, recovered, removed, roleAdded, roleRemoved, setAllElements, setBuildingModel, setEventName, setListTarget, setTarget, targetAdded, targetRemoved, targetSet
 
Methods inherited from class javax.swing.DefaultListModel
add, capacity, clear, copyInto, elementAt, elements, ensureCapacity, firstElement, get, getElementAt, getSize, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, removeAllElements, removeElement, removeElementAt, removeRange, set, setElementAt, setSize, size, toArray, toString, trimToSize
 
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, getListDataListeners, getListeners, removeListDataListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UMLModelElementOrderedListModel2

public UMLModelElementOrderedListModel2()
The constructor.


UMLModelElementOrderedListModel2

public UMLModelElementOrderedListModel2(String name)
The constructor.

Parameters:
name - the name
Method Detail

buildModelList

protected abstract void buildModelList()
Description copied from class: UMLModelElementListModel2
Builds the list of elements. Called from targetChanged every time the target of the proppanel is changed.

Specified by:
buildModelList in class UMLModelElementListModel2
See Also:
UMLModelElementListModel2.buildModelList()

isValidElement

protected abstract boolean isValidElement(Object element)
Description copied from class: UMLModelElementListModel2
Returns true if the given element is valid, i.e. it may be added to the list of elements.

Specified by:
isValidElement in class UMLModelElementListModel2
Parameters:
element - the element to be tested
Returns:
true if valid
See Also:
UMLModelElementListModel2.isValidElement(java.lang.Object)

swap

public abstract void swap(int index1,
                          int index2)
This function should swap two elements in the UML model. The list will then be updated by the events/listener mechanism.

Parameters:
index1 - the 1st element
index2 - the 2nd element

buildPopup

public boolean buildPopup(JPopupMenu popup,
                          int index)
Description copied from class: UMLModelElementListModel2
Override this if you want a popup menu. See for an example UMLModelElementOrderedListModel2.

Overrides:
buildPopup in class UMLModelElementListModel2
Parameters:
popup - the popup menu
index - the selected item in the list at the moment the mouse was clicked
Returns:
true if a popup menu is created, and needs to be shown
See Also:
UMLModelElementListModel2.buildPopup( javax.swing.JPopupMenu, int)


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