Class PartUtils


  • public class PartUtils
    extends java.lang.Object
    Provides utilities needed in the context of IVisualParts.
    • 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 of IVisualParts 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 of IVisualParts 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 given IVisualParts.
      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 given IVisualPart which are registered under the specified role.
      static Rectangle getUnionedVisualBoundsInScene​(java.util.Collection<? extends IVisualPart<? extends javafx.scene.Node>> parts)
      Returns the unioned visual bounds of the given IVisualParts in the coordinate system of the Scene.
      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.
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PartUtils

        public PartUtils()
    • 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 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>> 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 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 java.util.List<IVisualPart<? extends javafx.scene.Node>> getAnchoreds​(java.util.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 java.util.Set<IVisualPart<? extends javafx.scene.Node>> getAnchoreds​(IVisualPart<? extends javafx.scene.Node> anchorage,
                                                                                           java.lang.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​(java.util.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.