Package org.eclipse.graphiti.pattern.id
Class IdPatternHelper
java.lang.Object
org.eclipse.graphiti.pattern.id.IdPatternHelper
Some helper methods to be used in ID patterns and related features.
- Since:
- 0.18
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PropertyContainerfindById(PictogramElement pictogramElement, String idToFind) Searches for aPictogramElementthat has the given ID starting from the givenPictogramElement.static PropertyContainerfindByIdInGraphicsAlgorithmChildren(GraphicsAlgorithm graphicsAlgorithm, String idToFind) Searches for aPictogramElementthat has the given ID starting from the givenPictogramElement.static 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, String id) Set the ID property (#PROPERTY_KEY_ID) for the givenPictogramElement; it can be anyPropertyContainer,especiallyShapes orGraphicsAlgorithms are allowed.
-
Constructor Details
-
IdPatternHelper
public IdPatternHelper()
-
-
Method Details
-
getId
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
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
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, 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.
-