Class PartUtils

java.lang.Object
org.eclipse.gef.mvc.fx.parts.PartUtils

public class PartUtils extends Object
Provides utilities needed in the context of IVisualParts.
  • 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 of IVisualParts 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 of IVisualParts 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 given IVisualParts.
      Parameters:
      anchorages - The collection of IVisualParts 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 given IVisualPart which are registered under the specified role.
      Parameters:
      anchorage - The IVisualPart 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 given IVisualParts in the coordinate system of the Scene.
      Parameters:
      parts - The IVisualParts for which the unioned bounds are computed.
      Returns:
      The unioned visual bounds of the given IVisualParts in the coordinate system of the Scene.
    • retrieveViewer

      public static IViewer retrieveViewer(IDomain domain, javafx.scene.Node target)
      Returns the IViewer of the given IDomain in which the given Node is contained, or null if the given Node is not contained within an IViewer of the given IDomain.
      Parameters:
      domain - The IDomain that contains the IViewers that are tested to contain the given target Node.
      target - The Node for which to determine the containg IViewer.
      Returns:
      The IViewer in which the given target Node is contained, or null.
    • retrieveVisualPart

      public static IVisualPart<? extends javafx.scene.Node> retrieveVisualPart(IViewer viewer, javafx.scene.Node target)
      Returns the first IVisualPart in the visual hierarchy of the given Node. If no IVisualPart can be found within the visual hierarchy of the Node, the IRootPart of the given IViewer is returned.
      Parameters:
      viewer - The IViewer in which the IVisualPart is searched.
      target - The Node for which the corresponding IVisualPart is to be returned.
      Returns:
      The first IVisualPart in the visual hierarchy of the given Node, or the IRootPart of the given IViewer.