Package org.eclipse.gef.mvc.fx.parts
Class PartUtils
java.lang.Object
org.eclipse.gef.mvc.fx.parts.PartUtils
Provides utilities needed in the context of
IVisualPart
s.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends IVisualPart<? extends javafx.scene.Node>>
List<T>filterParts
(Collection<? extends IVisualPart<? extends javafx.scene.Node>> parts, Class<T> type) Searches the given collection ofIVisualPart
s for elements of the specified type.static <T extends IVisualPart<? extends javafx.scene.Node>>
List<T>filterParts
(Collection<? extends IVisualPart<? extends javafx.scene.Node>> parts, Predicate<? super IVisualPart<? extends javafx.scene.Node>> filter) Searches the given collection ofIVisualPart
s for elements of the specified type.static List<IVisualPart<? extends javafx.scene.Node>>
getAnchoreds
(Collection<? extends IVisualPart<? extends javafx.scene.Node>> anchorages) Collects the anchoreds of all givenIVisualPart
s.static Set<IVisualPart<? extends javafx.scene.Node>>
getAnchoreds
(IVisualPart<? extends javafx.scene.Node> anchorage, String role) Collects the anchoreds of the givenIVisualPart
which are registered under the specified role.static Rectangle
getUnionedVisualBoundsInScene
(Collection<? extends IVisualPart<? extends javafx.scene.Node>> parts) Returns the unioned visual bounds of the givenIVisualPart
s in the coordinate system of theScene
.static IViewer
retrieveViewer
(IDomain domain, javafx.scene.Node target) static IVisualPart<? extends javafx.scene.Node>
retrieveVisualPart
(IViewer viewer, javafx.scene.Node target) Returns the firstIVisualPart
in the visual hierarchy of the givenNode
.
-
Constructor Details
-
PartUtils
public PartUtils()
-
-
Method Details
-
filterParts
public static <T extends IVisualPart<? extends javafx.scene.Node>> List<T> filterParts(Collection<? extends IVisualPart<? extends javafx.scene.Node>> parts, Class<T> type) Searches the given collection ofIVisualPart
s for elements of the specified type.- Type Parameters:
T
- The type of returned elements.- Parameters:
parts
- The collection of parts which is filtered.type
- The type of returned elements.- Returns:
- A list of all elements of the specified type.
-
filterParts
public static <T extends IVisualPart<? extends javafx.scene.Node>> List<T> filterParts(Collection<? extends IVisualPart<? extends javafx.scene.Node>> parts, Predicate<? super IVisualPart<? extends javafx.scene.Node>> filter) Searches the given collection ofIVisualPart
s for elements of the specified type.- Type Parameters:
T
- The type of returned elements.- Parameters:
parts
- The collection of parts which is filtered.filter
- The type of returned elements.- Returns:
- A list of all elements of the specified type.
-
getAnchoreds
public static List<IVisualPart<? extends javafx.scene.Node>> getAnchoreds(Collection<? extends IVisualPart<? extends javafx.scene.Node>> anchorages) Collects the anchoreds of all givenIVisualPart
s.- Parameters:
anchorages
- The collection ofIVisualPart
s for which the anchoreds are collected.- Returns:
- A list of all the anchoreds of all the given
IVisualPart
s.
-
getAnchoreds
public static Set<IVisualPart<? extends javafx.scene.Node>> getAnchoreds(IVisualPart<? extends javafx.scene.Node> anchorage, String role) Collects the anchoreds of the givenIVisualPart
which are registered under the specified role.- Parameters:
anchorage
- TheIVisualPart
for which the anchoreds are collected.role
- The role under which the anchoreds have to be registered to be collected.- Returns:
- A list of the anchoreds of the given
IVisualPart
which are registered under the specified role.
-
getUnionedVisualBoundsInScene
public static Rectangle getUnionedVisualBoundsInScene(Collection<? extends IVisualPart<? extends javafx.scene.Node>> parts) Returns the unioned visual bounds of the givenIVisualPart
s in the coordinate system of theScene
.- Parameters:
parts
- TheIVisualPart
s for which the unioned bounds are computed.- Returns:
- The unioned visual bounds of the given
IVisualPart
s in the coordinate system of theScene
.
-
retrieveViewer
-
retrieveVisualPart
public static IVisualPart<? extends javafx.scene.Node> retrieveVisualPart(IViewer viewer, javafx.scene.Node target) Returns the firstIVisualPart
in the visual hierarchy of the givenNode
. If noIVisualPart
can be found within the visual hierarchy of theNode
, theIRootPart
of the givenIViewer
is returned.- Parameters:
viewer
- TheIViewer
in which theIVisualPart
is searched.target
- TheNode
for which the correspondingIVisualPart
is to be returned.- Returns:
- The first
IVisualPart
in the visual hierarchy of the givenNode
, or theIRootPart
of the givenIViewer
.
-