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
IVisualParts.-
Constructor Summary
Constructors -
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 ofIVisualParts 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 ofIVisualParts 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 givenIVisualParts.static Set<IVisualPart<? extends javafx.scene.Node>>getAnchoreds(IVisualPart<? extends javafx.scene.Node> anchorage, String role) Collects the anchoreds of the givenIVisualPartwhich are registered under the specified role.static RectanglegetUnionedVisualBoundsInScene(Collection<? extends IVisualPart<? extends javafx.scene.Node>> parts) Returns the unioned visual bounds of the givenIVisualParts in the coordinate system of theScene.static IViewerretrieveViewer(IDomain domain, javafx.scene.Node target) static IVisualPart<? extends javafx.scene.Node>retrieveVisualPart(IViewer viewer, javafx.scene.Node target) Returns the firstIVisualPartin 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 ofIVisualParts 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 ofIVisualParts 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 givenIVisualParts.- Parameters:
anchorages- The collection ofIVisualParts for which the anchoreds are collected.- Returns:
- A list of all the anchoreds of all the given
IVisualParts.
-
getAnchoreds
public static Set<IVisualPart<? extends javafx.scene.Node>> getAnchoreds(IVisualPart<? extends javafx.scene.Node> anchorage, String role) Collects the anchoreds of the givenIVisualPartwhich are registered under the specified role.- Parameters:
anchorage- TheIVisualPartfor 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
IVisualPartwhich 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 givenIVisualParts in the coordinate system of theScene.- Parameters:
parts- TheIVisualParts for which the unioned bounds are computed.- Returns:
- The unioned visual bounds of the given
IVisualParts in the coordinate system of theScene.
-
retrieveViewer
-
retrieveVisualPart
public static IVisualPart<? extends javafx.scene.Node> retrieveVisualPart(IViewer viewer, javafx.scene.Node target) Returns the firstIVisualPartin the visual hierarchy of the givenNode. If noIVisualPartcan be found within the visual hierarchy of theNode, theIRootPartof the givenIVieweris returned.- Parameters:
viewer- TheIViewerin which theIVisualPartis searched.target- TheNodefor which the correspondingIVisualPartis to be returned.- Returns:
- The first
IVisualPartin the visual hierarchy of the givenNode, or theIRootPartof the givenIViewer.
-