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
-
Method Summary
Modifier and TypeMethodDescriptionstatic PropertyContainer
findById
(PictogramElement pictogramElement, String idToFind) Searches for aPictogramElement
that has the given ID starting from the givenPictogramElement
.static PropertyContainer
findByIdInGraphicsAlgorithmChildren
(GraphicsAlgorithm graphicsAlgorithm, String idToFind) Searches for aPictogramElement
that has the given ID starting from the givenPictogramElement
.static String
getId
(PropertyContainer container) Returns any ID that has been set for the givenPictogramElement
; it can be anyPropertyContainer
, especiallyShape
s orGraphicsAlgorithm
s are allowed.static void
setId
(PropertyContainer container, String id) Set the ID property (#PROPERTY_KEY_ID
) for the givenPictogramElement
; it can be anyPropertyContainer
,especiallyShape
s orGraphicsAlgorithm
s are allowed.
-
Constructor Details
-
IdPatternHelper
public IdPatternHelper()
-
-
Method Details
-
getId
Returns any ID that has been set for the givenPictogramElement
; it can be anyPropertyContainer
, especiallyShape
s orGraphicsAlgorithm
s are allowed.- Parameters:
container
- ThePictogramElement
to get the ID property from- Returns:
- A
String
representing the value of the property ornull
in case the property is not set, seesetId(PropertyContainer, String)
.
-
setId
Set the ID property (#PROPERTY_KEY_ID
) for the givenPictogramElement
; it can be anyPropertyContainer
,especiallyShape
s orGraphicsAlgorithm
s are allowed. The used ID string can later be used to identify the shape, e.g. in the update or layout methods.- Parameters:
container
- ThePictogramElement
to set the ID property forid
- TheString
ID to set.
-
findById
Searches for aPictogramElement
that has the given ID starting from the givenPictogramElement
. First the given element is checked, then itsGraphicsAlgorithm
; after that thePictogramElement
children are checked recursively and last theGraphicsAlgorithm
children also recursively. The firstPictogramElement
that has the given ID is returned, in case none is found in the tree spanned by the givenPictogramElement
,null
is returned.- Parameters:
pictogramElement
- ThePictogramElement
at which the search shall start, anyShape
s orGraphicsAlgorithm
s on top of this element are ignored.idToFind
- AString
representing the ID to search for- Returns:
- The
PictogramElement
that has the given ID property, in case none id foundnull
.
-
findByIdInGraphicsAlgorithmChildren
public static PropertyContainer findByIdInGraphicsAlgorithmChildren(GraphicsAlgorithm graphicsAlgorithm, String idToFind) Searches for aPictogramElement
that has the given ID starting from the givenPictogramElement
. ThePictogramElement
children are checked recursively and last theGraphicsAlgorithm
children also recursively. The firstPictogramElement
that has the given ID is returned, in case none is found in the tree spanned by the givenPictogramElement
,null
is returned.- Parameters:
pictogramElement
- ThePictogramElement
at which the search shall start, anyShape
s orGraphicsAlgorithm
s on top of this element are ignored.idToFind
- AString
representing the ID to search for- Returns:
- The
PictogramElement
that has the given ID property, in case none id foundnull
.
-