Package org.eclipse.graphiti.pattern.id
Class IdPatternHelper
- java.lang.Object
-
- org.eclipse.graphiti.pattern.id.IdPatternHelper
-
public class IdPatternHelper extends java.lang.ObjectSome helper methods to be used in ID patterns and related features.- Since:
- 0.18
-
-
Constructor Summary
Constructors Constructor Description IdPatternHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static PropertyContainerfindById(PictogramElement pictogramElement, java.lang.String idToFind)Searches for aPictogramElementthat has the given ID starting from the givenPictogramElement.static PropertyContainerfindByIdInGraphicsAlgorithmChildren(GraphicsAlgorithm graphicsAlgorithm, java.lang.String idToFind)Searches for aPictogramElementthat has the given ID starting from the givenPictogramElement.static java.lang.StringgetId(PropertyContainer container)Returns any ID that has been set for the givenPictogramElement; it can be anyPropertyContainer, especiallyShapes orGraphicsAlgorithms are allowed.static voidsetId(PropertyContainer container, java.lang.String id)Set the ID property (#PROPERTY_KEY_ID) for the givenPictogramElement; it can be anyPropertyContainer,especiallyShapes orGraphicsAlgorithms are allowed.
-
-
-
Method Detail
-
getId
public static java.lang.String getId(PropertyContainer container)
Returns any ID that has been set for the givenPictogramElement; it can be anyPropertyContainer, especiallyShapes orGraphicsAlgorithms are allowed.- Parameters:
container- ThePictogramElementto get the ID property from- Returns:
- A
Stringrepresenting the value of the property ornullin case the property is not set, seesetId(PropertyContainer, String).
-
setId
public static void setId(PropertyContainer container, java.lang.String id)
Set the ID property (#PROPERTY_KEY_ID) for the givenPictogramElement; it can be anyPropertyContainer,especiallyShapes orGraphicsAlgorithms are allowed. The used ID string can later be used to identify the shape, e.g. in the update or layout methods.- Parameters:
container- ThePictogramElementto set the ID property forid- TheStringID to set.
-
findById
public static PropertyContainer findById(PictogramElement pictogramElement, java.lang.String idToFind)
Searches for aPictogramElementthat has the given ID starting from the givenPictogramElement. First the given element is checked, then itsGraphicsAlgorithm; after that thePictogramElementchildren are checked recursively and last theGraphicsAlgorithmchildren also recursively. The firstPictogramElementthat has the given ID is returned, in case none is found in the tree spanned by the givenPictogramElement,nullis returned.- Parameters:
pictogramElement- ThePictogramElementat which the search shall start, anyShapes orGraphicsAlgorithms on top of this element are ignored.idToFind- AStringrepresenting the ID to search for- Returns:
- The
PictogramElementthat has the given ID property, in case none id foundnull.
-
findByIdInGraphicsAlgorithmChildren
public static PropertyContainer findByIdInGraphicsAlgorithmChildren(GraphicsAlgorithm graphicsAlgorithm, java.lang.String idToFind)
Searches for aPictogramElementthat has the given ID starting from the givenPictogramElement. ThePictogramElementchildren are checked recursively and last theGraphicsAlgorithmchildren also recursively. The firstPictogramElementthat has the given ID is returned, in case none is found in the tree spanned by the givenPictogramElement,nullis returned.- Parameters:
pictogramElement- ThePictogramElementat which the search shall start, anyShapes orGraphicsAlgorithms on top of this element are ignored.idToFind- AStringrepresenting the ID to search for- Returns:
- The
PictogramElementthat has the given ID property, in case none id foundnull.
-
-