org.argouml.uml.ui
Class UMLModelElementListModel2

java.lang.Object
  |
  +--javax.swing.AbstractListModel
        |
        +--javax.swing.DefaultListModel
              |
              +--org.argouml.uml.ui.UMLModelElementListModel2
All Implemented Interfaces:
java.util.EventListener, javax.swing.ListModel, ru.novosoft.uml.MElementListener, java.io.Serializable, TargetChangedListener
Direct Known Subclasses:
UMLAssociationAssociationRoleListModel, UMLAssociationConnectionListModel, UMLAssociationEndAssociationListModel, UMLAssociationEndRoleBaseListModel, UMLAssociationEndSpecificationListModel, UMLAssociationLinkListModel, UMLAssociationRoleAssociationEndRoleListModel, UMLAssociationRoleMessageListModel, UMLAttributeInitialValueListModel, UMLCallEventOperationListModel, UMLClassifierAssociationEndListModel, UMLClassifierClassifierInStateListModel, UMLClassifierClassifierRoleListModel, UMLClassifierCollaborationListModel, UMLClassifierCreateActionListModel, UMLClassifierFeatureListModel, UMLClassifierInstanceListModel, UMLClassifierObjectFlowStateListModel, UMLClassifierParameterListModel, UMLClassifierParticipantListModel, UMLClassifierPowertypeRangeListModel, UMLClassifierRoleAvailableContentsListModel, UMLClassifierRoleAvailableFeaturesListModel, UMLClassifierRoleBaseListModel, UMLClassifierStructuralFeatureListModel, UMLCollaborationConstrainingElementListModel, UMLCollaborationInteractionListModel, UMLCollaborationRepresentedClassifierListModel, UMLCollaborationRepresentedOperationListModel, UMLCompositeStateSubvertexListModel, UMLDependencyClientListModel, UMLDependencySupplierListModel, UMLEventParameterListModel, UMLExtendExtensionPointListModel, UMLExtensionPointExtendListModel, UMLExtensionPointUseCaseListModel, UMLFeatureOwnerListModel, UMLGeneralizableElementGeneralizationListModel, UMLGeneralizableElementSpecializationListModel, UMLGuardTransitionListModel, UMLInteractionContextListModel, UMLInteractionMessagesListModel, UMLMessageActionListModel, UMLMessageInteractionListModel, UMLMessagePredecessorListModel, UMLMessageReceiverListModel, UMLMessageSenderListModel, UMLModelElementClientDependencyListModel, UMLModelElementConstraintListModel, UMLModelElementElementResidenceListModel, UMLModelElementNamespaceListModel, UMLModelElementSourceFlowListModel, UMLModelElementSupplierDependencyListModel, UMLModelElementTargetFlowListModel, UMLNamespaceOwnedElementListModel, UMLStateDeferrableEventListModel, UMLStateDoActivityListModel, UMLStateEntryListModel, UMLStateExitListModel, UMLStateInternalTransition, UMLStateMachineContextListModel, UMLStateMachineSubmachineStateListModel, UMLStateMachineTopListModel, UMLStateMachineTransitionListModel, UMLStateVertexContainerListModel, UMLStateVertexIncomingListModel, UMLStateVertexOutgoingListModel, UMLTransitionEffectListModel, UMLTransitionGuardListModel, UMLTransitionSourceListModel, UMLTransitionStateListModel, UMLTransitionStatemachineListModel, UMLTransitionTargetListModel, UMLTransitionTriggerListModel, UMLUseCaseExtendListModel, UMLUseCaseExtensionPointListModel, UMLUseCaseIncludeListModel

public abstract class UMLModelElementListModel2
extends javax.swing.DefaultListModel
implements TargetChangedListener, ru.novosoft.uml.MElementListener

The model for a list that Mbases contains. The state of the MBase is still kept in the Mbase itself. This list is only to be used as the model for some GUI element like UMLLinkedList

Since:
Oct 2, 2002
See Also:
Serialized Form

Field Summary
protected  java.lang.Object _target
           
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
UMLModelElementListModel2()
          Constructor to be used if the subclass does not depend on the MELementListener methods and setTarget method implemented in this class
UMLModelElementListModel2(java.lang.String eventName)
          Constructor for UMLModelElementListModel2.
 
Method Summary
protected  void addAll(java.util.Collection col)
          Utility method to add the contents of the given collection to the element list.
 void addElement(java.lang.Object obj)
           
protected abstract  void buildModelList()
          Builds the list of elements.
 boolean contains(java.lang.Object elem)
           
protected  java.lang.Object getChangedElement(ru.novosoft.uml.MElementEvent e)
          Utility method to get the changed element from some event e
protected  java.lang.Object getTarget()
          Utility method to get the target.
protected abstract  boolean isValidElement(ru.novosoft.uml.MBase element)
          Returns true if the given element is valid, i.e. it may be added to the list of elements.
protected  boolean isValidEvent(ru.novosoft.uml.MElementEvent e)
          Returns true if some event is valid.
 void listRoleItemSet(ru.novosoft.uml.MElementEvent e)
           
 void propertySet(ru.novosoft.uml.MElementEvent e)
           
 void recovered(ru.novosoft.uml.MElementEvent e)
           
 void removed(ru.novosoft.uml.MElementEvent e)
           
 void roleAdded(ru.novosoft.uml.MElementEvent e)
           
 void roleRemoved(ru.novosoft.uml.MElementEvent e)
           
protected  void setAllElements(java.util.Collection col)
          Utility method to set the elements of this list to the contents of the given collection.
protected  void setEventName(java.lang.String eventName)
          Sets the eventName.
 void setTarget(java.lang.Object target)
          Sets the target.
 void targetChanged(java.lang.Object newTarget)
          This method is called when a new target is selected, either by the program or by the user.
 void targetReasserted(java.lang.Object newTarget)
          This method is called when the navigation history is updated.
 
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, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListeners, removeListDataListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_target

protected java.lang.Object _target
Constructor Detail

UMLModelElementListModel2

public UMLModelElementListModel2(java.lang.String eventName)
Constructor for UMLModelElementListModel2.

UMLModelElementListModel2

public UMLModelElementListModel2()
Constructor to be used if the subclass does not depend on the MELementListener methods and setTarget method implemented in this class
Parameters:
container -  
Method Detail

listRoleItemSet

public void listRoleItemSet(ru.novosoft.uml.MElementEvent e)
Specified by:
listRoleItemSet in interface ru.novosoft.uml.MElementListener
See Also:
MElementListener.listRoleItemSet(ru.novosoft.uml.MElementEvent)

propertySet

public void propertySet(ru.novosoft.uml.MElementEvent e)
Specified by:
propertySet in interface ru.novosoft.uml.MElementListener
See Also:
MElementListener.propertySet(ru.novosoft.uml.MElementEvent)

recovered

public void recovered(ru.novosoft.uml.MElementEvent e)
Specified by:
recovered in interface ru.novosoft.uml.MElementListener
See Also:
MElementListener.recovered(ru.novosoft.uml.MElementEvent)

removed

public void removed(ru.novosoft.uml.MElementEvent e)
Specified by:
removed in interface ru.novosoft.uml.MElementListener
See Also:
MElementListener.removed(ru.novosoft.uml.MElementEvent)

roleAdded

public void roleAdded(ru.novosoft.uml.MElementEvent e)
Specified by:
roleAdded in interface ru.novosoft.uml.MElementListener
See Also:
MElementListener.roleAdded(ru.novosoft.uml.MElementEvent)

roleRemoved

public void roleRemoved(ru.novosoft.uml.MElementEvent e)
Specified by:
roleRemoved in interface ru.novosoft.uml.MElementListener
See Also:
MElementListener.roleRemoved(ru.novosoft.uml.MElementEvent)

buildModelList

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

setAllElements

protected void setAllElements(java.util.Collection col)
Utility method to set the elements of this list to the contents of the given collection.
Parameters:
col -  

addAll

protected void addAll(java.util.Collection col)
Utility method to add the contents of the given collection to the element list.
Parameters:
col -  

getTarget

protected java.lang.Object getTarget()
Utility method to get the target. Sets the _target if the _target is null via the method setTarget().
Returns:
MModelElement

getChangedElement

protected java.lang.Object getChangedElement(ru.novosoft.uml.MElementEvent e)
Utility method to get the changed element from some event e
Parameters:
e -  
Returns:
Object

contains

public boolean contains(java.lang.Object elem)
Overrides:
contains in class javax.swing.DefaultListModel
See Also:
DefaultListModel.contains(java.lang.Object)

setTarget

public void setTarget(java.lang.Object target)
Sets the target. If the old target is instanceof MBase, it also removes the model from the element listener list of the target. If the new target is instanceof MBase, the model is added as element listener to the new target.
Parameters:
target -  

isValidElement

protected abstract boolean isValidElement(ru.novosoft.uml.MBase element)
Returns true if the given element is valid, i.e. it may be added to the list of elements.
Parameters:
element -  

isValidEvent

protected boolean isValidEvent(ru.novosoft.uml.MElementEvent e)
Returns true if some event is valid. An event is valid if the element changed in the event is valid. This is determined via a call to isValidElement. This method can be overriden by subclasses if they cannot determine if it is a valid event just by checking the changed element.
Parameters:
e -  
Returns:
boolean

addElement

public void addElement(java.lang.Object obj)
Overrides:
addElement in class javax.swing.DefaultListModel
See Also:
DefaultListModel.addElement(java.lang.Object)

setEventName

protected void setEventName(java.lang.String eventName)
Sets the eventName. The eventName is the name of the MElementEvent to which the list should listen. The list is registred with UMLModelEventPump and only gets events that have a name like eventName. This method should be called in the constructor of every subclass.
Parameters:
eventName - The eventName to set

targetChanged

public void targetChanged(java.lang.Object newTarget)
Description copied from interface: TargetChangedListener
This method is called when a new target is selected, either by the program or by the user.
Specified by:
targetChanged in interface TargetChangedListener
See Also:
TargetChangedListener.targetChanged(java.lang.Object)

targetReasserted

public void targetReasserted(java.lang.Object newTarget)
Description copied from interface: TargetChangedListener
This method is called when the navigation history is updated.
Specified by:
targetReasserted in interface TargetChangedListener
See Also:
TargetChangedListener.targetReasserted(java.lang.Object)


ArgoUML (c) 1996-2002
ArgoUML Project Home
ArgoUML Cookbook