Poseidon for UMLTM
  UMLdoc
 PREV  CLASSIFIER    NEXT  CLASSIFIER     FRAMES    NO FRAMES      
SUMMARY:   INNER | ATTR | ASSOC | CONSTR | METHOD     DETAIL:   INNER | ATTR | ASSOC | CONSTR | METHOD     DIAGRAMS:   COLLAB | SEQ | STATE | ACTIV

com.gentleware.jboogie.model_management

Class DiAccessory

com.gentleware.jboogie.model_management.DiAccessory

public class DiAccessory


Helper methods to query the MDR repository

Created : kelvin, Dec 10, 2002, 2:05:04 PM


 Association Summary
private DiagramInterchangePackage  _diPackage
 
private Project  _project
 
public ProjectImpl  projectImpl
 
arrow_up
 

 Constructor Summary
public   DiAccessory(Project project)
 
arrow_up
 

 Method Summary
public int   countContainedElements(Diagram diagram, List elementsToLookFor)
Counts how many of the given elements are in the given diagram. 
public DiagramElement   findCommonContainer(DiagramElement nodeA, DiagramElement nodeB)
Finds the nearest common ancestor container of two nodes. 
public GraphElement   findContainedWithTypeInfo(GraphElement container, SimpleTypeInfo typeInfo)
Looks for a descendant of the graph element that has a certain type info set. 
private GraphElement   findContainedWithTypeInfoInternal(GraphElement container, SimpleTypeInfo typeInfo, boolean allowUmlSemantic)
 
public GraphElement   findContainerWithTypeInfo(DiagramElement contained, SimpleTypeInfo typeInfo)
Searches up throug the container hierarchy to find a container with the given SimpleTypeInfo and return the first occurrence. 
private GraphElement   findContainerWithTypeInfoInternal(DiagramElement contained, SimpleTypeInfo typeInfo, boolean allowUmlSemantic)
 
public Diagram   findDiagramByOwner(RefObject owner)
 
public GraphElement   findFirstGraphElementInDiagram(Object semanticElement, Diagram diagram)
Finds one random DI element for the given element in the given diagram. 
public Collection   getAllContainerForSpecialTypeInfo(RefObject modelElement, SimpleTypeInfo typeInfo)
Returns a collection of GraphElements, which are container of a DiagramElement of a given modelElement. 
public List   getAllModelElements(Collection pNodes)
Returns all model elements connected to the specified PNode objects. 
public Set   getCommonContainerInfos(Collection diElementsA, Collection diElementsB)
 
public Set   getConnectingEdges(GraphElement a, GraphElement b)
 
public List   getContainedElements(GraphElement graphElement)
Returns the list of elements contained in the given graph element. 
public Diagram   getDiagram(DiagramElement element)
Returns the nearest Diagram ancestor of this element. 
public DiagramInterchangePackage   getDiagramInterchangePackage()
 
public SimpleTypeInfo   getDiagramTypeInfo(DiagramElement diElement)
Returns the type info of the diagram that the given DI element is in. 
public PNode   getDraggableOrMoveableNode(PNode testNode)
 
public String   getProperty(DiagramElement element, String key)
 
public final NodeResizeMode   getResizeMode(PNode node)
Can the piccolo element be dragged by mouse. 
public static PNode   getSelectableNode(PNode testNode, Project project)
 
public Set   getSelectedMoveableOrDraggableDiIds()
 
public SimpleTypeInfo   getSimpleTypeInfo(GraphElement element)
Retrieve the simple type info of an element. 
public static RefObject   getSmElement(DiagramElement diagramElement, boolean ascendContainers)
Retrieves the UML model element associated with a graph element. 
public boolean   includesAnyAncestor(Set containers, DiagramElement diagramElement)
Check if a given set of di elements contains a given di element or any of its ancestors  
public int   indexOfContainedWithTypeInfo(GraphElement container, SimpleTypeInfo typeInfo)
 
public boolean   isAncestorOfAny(DiagramElement possibleAncestor, Collection nodes)
 
public final boolean   isDraggable(PNode node)
 
public boolean   isModelBridgeStillValid(SemanticModelBridge bridge)
Tests, if the model bridge is still a valid object of the repository. 
public final boolean   isModelElementStillValid(RefObject element)
 
public final boolean   isMoveable(PNode node)
 
public final boolean   isSelectable(PNode node)
Can the piccolo element be selected by mouse. 
public Collection   removeContainedElements(Collection diElements)
This method takes a collection of diagramelements, and removes any elements that are recursively contained inside any other element of the collection, leaving behind only the outermost elements. 
public Collection   replaceNotSelfContainedElements(Collection diElements)
Replaces any graph element which is not self-contained. 
arrow_up
 

Tagged Values
static false
gentleware-imported-line-number 34
gentleware-imported-package-statement-line-number 5
 

 Association Detail

_diPackage

private DiagramInterchangePackage _diPackage

arrow_up


_project

private Project _project

arrow_up


projectImpl

public ProjectImpl projectImpl

arrow_up
 Constructor Detail

DiAccessory

public com.gentleware.jboogie.model_management.DiAccessory DiAccessory(Project project)

Parameters:
project -
Returns:
arrow_up
 Method Detail

countContainedElements

public int countContainedElements(Diagram diagram, List elementsToLookFor)


Counts how many of the given elements are in the given diagram. This method is probably expensive.  
Parameters:
diagram -
elementsToLookFor -
Returns:
Zero or some number.
arrow_up


findCommonContainer

public DiagramElement findCommonContainer(DiagramElement nodeA, DiagramElement nodeB)


Finds the nearest common ancestor container of two nodes.  
Parameters:
nodeA -
nodeB -
Returns:
arrow_up


findContainedWithTypeInfo

public GraphElement findContainedWithTypeInfo(GraphElement container, SimpleTypeInfo typeInfo)


Looks for a descendant of the graph element that has a certain type info set. The search is depth-first, but search on a branch will stop if a graph element is encountered that has an associated Uml1SemanticModelBridge or CoreSemanticModelBridge (because type infos of any further descendants are associated to those nodes.) E.g. the graph node that represent a UML class has a descendant graph node with associated type info = "name", which itself has a contained text element that holds the name of the class:
GraphNode -> Uml14SemanticBridge -> UmlClass
GraphNode (header compartment)
GraphNode -> SimpleSemanticModelElement -> "name"
TextElement "ClassName"
...
 
Parameters:
container -
typeInfo -
Returns:
arrow_up


findContainedWithTypeInfoInternal

private GraphElement findContainedWithTypeInfoInternal(GraphElement container, SimpleTypeInfo typeInfo, boolean allowUmlSemantic)

Parameters:
container -
typeInfo -
allowUmlSemantic -
Returns:
arrow_up


findContainerWithTypeInfo

public GraphElement findContainerWithTypeInfo(DiagramElement contained, SimpleTypeInfo typeInfo)


Searches up throug the container hierarchy to find a container with the given SimpleTypeInfo and return the first occurrence. If none is found, null is returned.  
Parameters:
contained - Element from which the search is started
typeInfo -
Returns:
the container with the given SimpleTypeInfo or null if no one is found
arrow_up


findContainerWithTypeInfoInternal

private GraphElement findContainerWithTypeInfoInternal(DiagramElement contained, SimpleTypeInfo typeInfo, boolean allowUmlSemantic)

Parameters:
contained -
typeInfo -
allowUmlSemantic -
Returns:
arrow_up


findDiagramByOwner

public Diagram findDiagramByOwner(RefObject owner)

Parameters:
owner -
Returns:
arrow_up


findFirstGraphElementInDiagram

public GraphElement findFirstGraphElementInDiagram(Object semanticElement, Diagram diagram)


Finds one random DI element for the given element in the given diagram.  
Parameters:
semanticElement - Not null and instancceof Element!
diagram - Must not be null!
Returns:
The first DI element. A better solution would be to allow several di elements for the same semantic element in the same diagram, and return a collection.
arrow_up


getAllContainerForSpecialTypeInfo

public Collection getAllContainerForSpecialTypeInfo(RefObject modelElement, SimpleTypeInfo typeInfo)


Returns a collection of GraphElements, which are container of a DiagramElement of a given modelElement. The GraphElements musst have a given SimpleTypeInfo. With this method you can get for example all NamespaceCompartments where the given ModelElement is part of the namespaces with the call getAllContainerForSpecialTypeInfo(modelElement, SimpleTypeInfo.NAMESPACE_COMPARTMENT)  
Parameters:
modelElement -
typeInfo -
Returns:
a may be emtpy list of GraphElements which contains (recursive) a DiagramElement of the given modelElement
arrow_up


getAllModelElements

public List getAllModelElements(Collection pNodes)


Returns all model elements connected to the specified PNode objects.  
Parameters:
pNodes - list of PNode objects
Returns:
model elements connected pNodes
arrow_up


getCommonContainerInfos

public Set getCommonContainerInfos(Collection diElementsA, Collection diElementsB)

Parameters:
diElementsA -
diElementsB -
Returns:
the set of all common container infos where the container contains one di element of each lists
arrow_up


getConnectingEdges

public Set getConnectingEdges(GraphElement a, GraphElement b)

Parameters:
a -
b -
Returns:
All diagram elements that connect a and b.
arrow_up


getContainedElements

public List getContainedElements(GraphElement graphElement)


Returns the list of elements contained in the given graph element.  
Parameters:
graphElement -
Returns:
an unmodifiable list of diagram elements contained in the graph element
arrow_up


getDiagram

public Diagram getDiagram(DiagramElement element)


Returns the nearest Diagram ancestor of this element. There must be a Diagram at the base of the container hierarchy (put differently only diagrams are allowed to have a null container). (I am not sure if diagrams are allowed to be nested.)  
Parameters:
element -
Returns:
the nearest Diagram ancestor of the given DI element or null if there is none
arrow_up


getDiagramInterchangePackage

public DiagramInterchangePackage getDiagramInterchangePackage()

Returns:
arrow_up


getDiagramTypeInfo

public SimpleTypeInfo getDiagramTypeInfo(DiagramElement diElement)


Returns the type info of the diagram that the given DI element is in.  
Parameters:
diElement - the DI element whose containing diagram type is queried
Returns:
the type info from the diagram that contains the DI element
Exceptions:
IllegalStateException if the DI element is not contained in a diagram or the diagram has no type info
arrow_up


getDraggableOrMoveableNode

public PNode getDraggableOrMoveableNode(PNode testNode)

Parameters:
testNode -
Returns:
testNode itself or the nearest container that is draggable, (i.e. can be moved and dropped to a new container) or moveable (can be moved, but always stays in the same container [e.g. adornments]). null if there is no such node
arrow_up


getProperty

public String getProperty(DiagramElement element, String key)

Parameters:
element -
key -
Returns:
the property value for the property with the given key that is stored at the element or any of its containers or "" if not found
arrow_up


getResizeMode

public final NodeResizeMode getResizeMode(PNode node)


Can the piccolo element be dragged by mouse. Delegates to the specific controller.  
Parameters:
node -
Returns:
arrow_up


getSelectableNode

public static PNode getSelectableNode(PNode testNode, Project project)

Parameters:
testNode -
project -
Returns:
arrow_up


getSelectedMoveableOrDraggableDiIds

public Set getSelectedMoveableOrDraggableDiIds()

Returns:
arrow_up


getSimpleTypeInfo

public SimpleTypeInfo getSimpleTypeInfo(GraphElement element)


Retrieve the simple type info of an element. Copied here to make the method available for the plugins.  
Parameters:
element - the element under consideration
Returns:
the simple type info or null
arrow_up


getSmElement

public static RefObject getSmElement(DiagramElement diagramElement, boolean ascendContainers)


Retrieves the UML model element associated with a graph element. If the graph element does not directly have a bridge to a model element, the container hierarchy can be traversed to find the model element of the nearest ancestor.  
Parameters:
diagramElement - the di element for which a UML model element is to be looked up
ascendContainers - if true the containers of the graph element will be traversed to look for an associated model element.
Returns:
a uml model element or null if the graph element (and none of its containers if ascendContainers is true) does not have an associated model element
arrow_up


includesAnyAncestor

public boolean includesAnyAncestor(Set containers, DiagramElement diagramElement)


Check if a given set of di elements contains a given di element or any of its ancestors  
Parameters:
containers - the set of di elements to search
diagramElement - this element and its containers are checked for containment in containers
Returns:
true if diagramElement or any of its container ancestors is contained in containers
arrow_up


indexOfContainedWithTypeInfo

public int indexOfContainedWithTypeInfo(GraphElement container, SimpleTypeInfo typeInfo)

Parameters:
container -
typeInfo -
Returns:
the index of the contained element with the given type info or -1 if not found
arrow_up


isAncestorOfAny

public boolean isAncestorOfAny(DiagramElement possibleAncestor, Collection nodes)

Parameters:
possibleAncestor -
nodes -
Returns:
true if any of the given nodes has the possibleAncestor as direct or indirect parent.
arrow_up


isDraggable

public final boolean isDraggable(PNode node)

Parameters:
node -
Returns:
arrow_up


isModelBridgeStillValid

public boolean isModelBridgeStillValid(SemanticModelBridge bridge)


Tests, if the model bridge is still a valid object of the repository.  
Parameters:
bridge - Bridge to be tested.
Returns:
True, if the bridge is still valid, otherwise false.
arrow_up


isModelElementStillValid

public final boolean isModelElementStillValid(RefObject element)

Parameters:
element -
Returns:
arrow_up


isMoveable

public final boolean isMoveable(PNode node)

Parameters:
node -
Returns:
arrow_up


isSelectable

public final boolean isSelectable(PNode node)


Can the piccolo element be selected by mouse. Delegates to the specific controller.  
Parameters:
node -
Returns:
arrow_up


removeContainedElements

public Collection removeContainedElements(Collection diElements)


This method takes a collection of diagramelements, and removes any elements that are recursively contained inside any other element of the collection, leaving behind only the outermost elements. for example, if the collection contains a graphnode for a class and a graphnode for an attribute of that class, then this method returns only the graphnode of the class  
Parameters:
diElements -
Returns:
arrow_up


replaceNotSelfContainedElements

public Collection replaceNotSelfContainedElements(Collection diElements)


Replaces any graph element which is not self-contained. Such elements are replaces by its container element. For example, an edge of a signal send element makes no sense without its container element.  
Parameters:
diElements -
Returns:
arrow_up
Created  2004 - 12 - 1

    Poseidon for UMLTM
  UMLdoc
 PREV  CLASSIFIER    NEXT  CLASSIFIER     FRAMES    NO FRAMES      
SUMMARY:   INNER | ATTR | ASSOC | CONSTR | METHOD     DETAIL:   INNER | ATTR | ASSOC | CONSTR | METHOD     DIAGRAMS:   COLLAB | SEQ | STATE | ACTIV

Generated with Poseidon for UMLTM.
Poseidon is a registered trademark of Gentleware AG in Germany, USA and other countries. Copyright 2003-2004 Gentleware AG, Schanzenstr. 70, 20357 Hamburg, Germany. All Rights Reserved.

UML is a trademark or registered trademark of Object Management Group, Inc. in the U.S. and other countries.