Package org.eclipse.gef.mvc.fx.parts
Class PartUtils
- java.lang.Object
-
- org.eclipse.gef.mvc.fx.parts.PartUtils
-
public class PartUtils extends java.lang.ObjectProvides utilities needed in the context ofIVisualParts.
-
-
Constructor Summary
Constructors Constructor Description PartUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends IVisualPart<? extends javafx.scene.Node>>
java.util.List<T>filterParts(java.util.Collection<? extends IVisualPart<? extends javafx.scene.Node>> parts, java.lang.Class<T> type)Searches the given collection ofIVisualParts for elements of the specified type.static <T extends IVisualPart<? extends javafx.scene.Node>>
java.util.List<T>filterParts(java.util.Collection<? extends IVisualPart<? extends javafx.scene.Node>> parts, java.util.function.Predicate<? super IVisualPart<? extends javafx.scene.Node>> filter)Searches the given collection ofIVisualParts for elements of the specified type.static java.util.List<IVisualPart<? extends javafx.scene.Node>>getAnchoreds(java.util.Collection<? extends IVisualPart<? extends javafx.scene.Node>> anchorages)Collects the anchoreds of all givenIVisualParts.static java.util.Set<IVisualPart<? extends javafx.scene.Node>>getAnchoreds(IVisualPart<? extends javafx.scene.Node> anchorage, java.lang.String role)Collects the anchoreds of the givenIVisualPartwhich are registered under the specified role.static RectanglegetUnionedVisualBoundsInScene(java.util.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.
-
-
-
Method Detail
-
filterParts
public static <T extends IVisualPart<? extends javafx.scene.Node>> java.util.List<T> filterParts(java.util.Collection<? extends IVisualPart<? extends javafx.scene.Node>> parts, java.lang.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>> java.util.List<T> filterParts(java.util.Collection<? extends IVisualPart<? extends javafx.scene.Node>> parts, java.util.function.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 java.util.List<IVisualPart<? extends javafx.scene.Node>> getAnchoreds(java.util.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 java.util.Set<IVisualPart<? extends javafx.scene.Node>> getAnchoreds(IVisualPart<? extends javafx.scene.Node> anchorage, java.lang.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(java.util.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.
-
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.
-
-