Class NodeQueryUtils


  • public final class NodeQueryUtils
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private NodeQueryUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static <T> boolean applyPredicateSafely​(java.util.function.Predicate<T> predicate, T input)  
      static java.util.function.Function<javafx.scene.Node,​java.util.Set<javafx.scene.Node>> byMatcher​(org.hamcrest.Matcher<javafx.scene.Node> matcher)
      Returns a function that returns a Set of all Nodes that match the given matcher.
      static java.util.function.Function<javafx.scene.Node,​java.util.Set<javafx.scene.Node>> byPredicate​(java.util.function.Predicate<javafx.scene.Node> predicate)
      Returns a function that returns a Set of all Nodes that pass the given predicate.
      static java.util.function.Function<javafx.scene.Node,​java.util.Set<javafx.scene.Node>> bySelector​(java.lang.String selector)
      Returns a function that calls Node.lookup(String) on each given node.
      static java.util.function.Function<javafx.scene.Node,​java.util.Set<javafx.scene.Node>> byText​(java.lang.String text)
      Returns a function that returns a Set of all Labels, TextInputControls, or any of their subclasses that have the given text.
      static java.util.function.Function<javafx.scene.Node,​java.util.Set<javafx.scene.Node>> combine​(java.util.function.Function<javafx.scene.Node,​java.util.Set<javafx.scene.Node>> function0, java.util.function.Function<javafx.scene.Node,​java.util.Set<javafx.scene.Node>> function1)
      Returns a function that returns a Set of all Nodes that maps the given node by function0 and then by function1).
      private static <T> java.util.Set<T> combine​(T input, java.util.Collection<java.util.function.Function<T,​java.util.Set<T>>> functions)  
      private static javafx.scene.Parent fromPopupControl​(javafx.scene.control.PopupControl popupControl)  
      private static javafx.scene.Parent fromScene​(javafx.scene.Scene scene)  
      private static javafx.scene.Parent fromStage​(javafx.stage.Stage stage)  
      private static javafx.scene.Parent fromWindow​(javafx.stage.Window window)  
      static java.util.function.Predicate<javafx.scene.Node> hasId​(java.lang.String id)
      Returns a predicate that returns true if the node's id equals the given id.
      private static boolean hasNodeText​(javafx.scene.Node node, java.lang.String text)  
      static java.util.function.Predicate<javafx.scene.Node> hasText​(java.lang.String text)
      Returns a predicate that returns true if the node is a Label, TextInputControl, or any of their subclasses whose text equals the given text.
      private static boolean isNodeVisible​(javafx.scene.Node node)  
      private static boolean isNodeWithinSceneBounds​(javafx.scene.Node node)  
      static java.util.function.Predicate<javafx.scene.Node> isVisible()
      Returns a predicate that returns true if the given node is visible, the given tree is visible, or the node's local bounds are within its scene's bounds
      private static java.util.Set<javafx.scene.Node> lookupWithPredicate​(javafx.scene.Node parentNode, java.util.function.Predicate<javafx.scene.Node> predicate)  
      private static java.util.Set<javafx.scene.Node> lookupWithSelector​(javafx.scene.Node parentNode, java.lang.String selector)  
      static java.util.function.Predicate<javafx.scene.Node> matchesMatcher​(org.hamcrest.Matcher<javafx.scene.Node> matcher)
      Returns a predicate that returns true if the given node matches the given matcher.
      private static boolean matchesNodeMatcher​(javafx.scene.Node node, org.hamcrest.Matcher matcher)  
      static java.util.Set<javafx.scene.Node> rootOfPopupControl​(javafx.scene.control.PopupControl... popupControls)
      Returns a set of the given popup controls' scenes' root nodes.
      static java.util.Set<javafx.scene.Node> rootOfScene​(javafx.scene.Scene... scenes)
      Returns a set of the given scenes' root nodes.
      static java.util.Set<javafx.scene.Node> rootOfStage​(javafx.stage.Stage... stages)
      Returns a set of the given stages' scenes' root nodes.
      static java.util.Set<javafx.scene.Node> rootOfWindow​(javafx.stage.Window... windows)
      Returns a set of the given windows' scenes' root nodes.
      static java.util.Set<javafx.scene.Node> rootsOfWindows​(java.util.Collection<javafx.stage.Window> windows)
      Returns a set of the given windows' scenes' root nodes.
      • Methods inherited from class java.lang.Object

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

      • NodeQueryUtils

        private NodeQueryUtils()
    • Method Detail

      • rootsOfWindows

        public static java.util.Set<javafx.scene.Node> rootsOfWindows​(java.util.Collection<javafx.stage.Window> windows)
        Returns a set of the given windows' scenes' root nodes.
      • rootOfWindow

        public static java.util.Set<javafx.scene.Node> rootOfWindow​(javafx.stage.Window... windows)
        Returns a set of the given windows' scenes' root nodes.
      • rootOfStage

        public static java.util.Set<javafx.scene.Node> rootOfStage​(javafx.stage.Stage... stages)
        Returns a set of the given stages' scenes' root nodes.
      • rootOfScene

        public static java.util.Set<javafx.scene.Node> rootOfScene​(javafx.scene.Scene... scenes)
        Returns a set of the given scenes' root nodes.
      • rootOfPopupControl

        public static java.util.Set<javafx.scene.Node> rootOfPopupControl​(javafx.scene.control.PopupControl... popupControls)
        Returns a set of the given popup controls' scenes' root nodes.
      • bySelector

        public static java.util.function.Function<javafx.scene.Node,​java.util.Set<javafx.scene.Node>> bySelector​(java.lang.String selector)
        Returns a function that calls Node.lookup(String) on each given node.
      • byPredicate

        public static java.util.function.Function<javafx.scene.Node,​java.util.Set<javafx.scene.Node>> byPredicate​(java.util.function.Predicate<javafx.scene.Node> predicate)
        Returns a function that returns a Set of all Nodes that pass the given predicate.
      • byMatcher

        public static java.util.function.Function<javafx.scene.Node,​java.util.Set<javafx.scene.Node>> byMatcher​(org.hamcrest.Matcher<javafx.scene.Node> matcher)
        Returns a function that returns a Set of all Nodes that match the given matcher.
      • byText

        public static java.util.function.Function<javafx.scene.Node,​java.util.Set<javafx.scene.Node>> byText​(java.lang.String text)
        Returns a function that returns a Set of all Labels, TextInputControls, or any of their subclasses that have the given text.
      • hasId

        public static java.util.function.Predicate<javafx.scene.Node> hasId​(java.lang.String id)
        Returns a predicate that returns true if the node's id equals the given id.
      • hasText

        public static java.util.function.Predicate<javafx.scene.Node> hasText​(java.lang.String text)
        Returns a predicate that returns true if the node is a Label, TextInputControl, or any of their subclasses whose text equals the given text.
      • matchesMatcher

        public static java.util.function.Predicate<javafx.scene.Node> matchesMatcher​(org.hamcrest.Matcher<javafx.scene.Node> matcher)
        Returns a predicate that returns true if the given node matches the given matcher.
      • isVisible

        public static java.util.function.Predicate<javafx.scene.Node> isVisible()
        Returns a predicate that returns true if the given node is visible, the given tree is visible, or the node's local bounds are within its scene's bounds
      • combine

        public static java.util.function.Function<javafx.scene.Node,​java.util.Set<javafx.scene.Node>> combine​(java.util.function.Function<javafx.scene.Node,​java.util.Set<javafx.scene.Node>> function0,
                                                                                                                    java.util.function.Function<javafx.scene.Node,​java.util.Set<javafx.scene.Node>> function1)
        Returns a function that returns a Set of all Nodes that maps the given node by function0 and then by function1).
      • fromWindow

        private static javafx.scene.Parent fromWindow​(javafx.stage.Window window)
      • fromStage

        private static javafx.scene.Parent fromStage​(javafx.stage.Stage stage)
      • fromScene

        private static javafx.scene.Parent fromScene​(javafx.scene.Scene scene)
      • fromPopupControl

        private static javafx.scene.Parent fromPopupControl​(javafx.scene.control.PopupControl popupControl)
      • lookupWithSelector

        private static java.util.Set<javafx.scene.Node> lookupWithSelector​(javafx.scene.Node parentNode,
                                                                           java.lang.String selector)
      • lookupWithPredicate

        private static java.util.Set<javafx.scene.Node> lookupWithPredicate​(javafx.scene.Node parentNode,
                                                                            java.util.function.Predicate<javafx.scene.Node> predicate)
      • applyPredicateSafely

        private static <T> boolean applyPredicateSafely​(java.util.function.Predicate<T> predicate,
                                                        T input)
      • hasNodeText

        private static boolean hasNodeText​(javafx.scene.Node node,
                                           java.lang.String text)
      • matchesNodeMatcher

        private static boolean matchesNodeMatcher​(javafx.scene.Node node,
                                                  org.hamcrest.Matcher matcher)
      • isNodeVisible

        private static boolean isNodeVisible​(javafx.scene.Node node)
      • isNodeWithinSceneBounds

        private static boolean isNodeWithinSceneBounds​(javafx.scene.Node node)
      • combine

        private static <T> java.util.Set<T> combine​(T input,
                                                    java.util.Collection<java.util.function.Function<T,​java.util.Set<T>>> functions)