Modelers

org.topcased.modeler.diagrams.model.util
Class DiagramsUtils

java.lang.Object
  extended by org.topcased.modeler.diagrams.model.util.DiagramsUtils

public final class DiagramsUtils
extends java.lang.Object

A Helper class used to facilitate Diagrams management.
Creation 6 oct. 06


Method Summary
static java.util.List<Diagram> findAllDiagrams(Diagrams rootDiagrams)
          Return all the Diagram model objects that are defined in the Diagrams file.
static java.util.List<Diagram> findAllExistingDiagram(Diagrams rootDiagrams, EObject modelObject)
          This method return the list of Diagram model objects that are defined for a given EObject.
static Diagrams findNearestContainerDiagrams(Diagrams rootDiagrams, EObject modelObject)
          This method returns the nearest Diagrams in the hierarchy that should contains a Diagram associated with the given modelObject.
static Diagrams findRootDiagrams(Diagrams diagrams)
          Retrieve the root Diagrams model object
static GraphElement getNearestCommonParentGraphElement(GraphElement elt1, GraphElement elt2)
          This method is used to retrieve the first GraphElement that both contains (directly or not) the two passed GraphElements.
static Diagram getRootDiagram(Diagrams diagrams)
          Retrieve the root Diagram from a Diagrams element : we search in the hierarchy (subtree) of the Diagrams element.
static void updateDI(Diagrams rootDiagrams)
          This method is used to update a Diagrams model to be compliant with the new Diagrams metamodel (nsURI=0.11).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

findRootDiagrams

public static Diagrams findRootDiagrams(Diagrams diagrams)
Retrieve the root Diagrams model object

Parameters:
diagrams - a Diagrams model object
Returns:
the root model object of that Diagrams

getRootDiagram

public static Diagram getRootDiagram(Diagrams diagrams)
Retrieve the root Diagram from a Diagrams element : we search in the hierarchy (subtree) of the Diagrams element.

Parameters:
diagrams - the Diagrams where to search
Returns:
the root Diagram if it exists, otherwise return null.

findAllDiagrams

public static java.util.List<Diagram> findAllDiagrams(Diagrams rootDiagrams)
Return all the Diagram model objects that are defined in the Diagrams file. This method iterates recursively on all the subDiagrams.

Parameters:
rootDiagrams - the root Diagrams model object
Returns:
List The list contents are of type org.topcased.modeler.di.model.Diagram.

findAllExistingDiagram

public static java.util.List<Diagram> findAllExistingDiagram(Diagrams rootDiagrams,
                                                             EObject modelObject)
This method return the list of Diagram model objects that are defined for a given EObject.
These diagrams are contained by a single Diagrams model objects.

Parameters:
rootDiagrams - the root Diagrams model object
modelObject - the model object
Returns:
List The list of the available Diagram model objects associated with the modelObject. Returns an empty list when none is defined.

findNearestContainerDiagrams

public static Diagrams findNearestContainerDiagrams(Diagrams rootDiagrams,
                                                    EObject modelObject)
This method returns the nearest Diagrams in the hierarchy that should contains a Diagram associated with the given modelObject.
If the Diagrams is associated with the exact type of the modelObject, then it should directly contains the Diagram, otherwise it mean that a new Diagrams should be first created (and the children Diagrams should be then moved into the newly created Diagrams).

Parameters:
rootDiagrams - a Diagrams
modelObject - the modelObject
Returns:
the nearest Diagrams that should contains a Diagram associated with the given modelObject

updateDI

public static void updateDI(Diagrams rootDiagrams)
This method is used to update a Diagrams model to be compliant with the new Diagrams metamodel (nsURI=0.11).
It first checks whether the Diagrams model is flattened (old version of the Diagrams metamodel) and create the necessary Diagrams objects that transform the model into a hierarchical one.
This method should be called before the opening of the Diagrams in the editor. It should then be removed in a further version. (1.0 ?)

Parameters:
rootDiagrams - the rootDiagrams

getNearestCommonParentGraphElement

public static GraphElement getNearestCommonParentGraphElement(GraphElement elt1,
                                                              GraphElement elt2)
This method is used to retrieve the first GraphElement that both contains (directly or not) the two passed GraphElements. This method is particularly used to retrieve the first GraphElement that should contains an Edge between two GraphElements : we assume that this is the first parent ancestor common to the two GraphElements.

Parameters:
elt1 - The first GraphElement
elt2 - The second GraphElement
Returns:
the nearest common ancestor

Modelers

Copyright (c) 2005 TOPCASED Contributors 2005 - 2007. All rights reserved.