Module xaos.ui

Class TreeItems


  • public class TreeItems
    extends Object
    Provides methods to manipulate trees made of TreeItems.
    Author:
    claudio.rosati@esss.se
    • Method Detail

      • expandAll

        public static <T> TreeItem<T> expandAll​(TreeItem<T> node,
                                                boolean expand)
        Expands/collapses the node and all its non-leaf children recursively.

        This method is not thread safe, and should be called from the JavaFX application thread.

        Type Parameters:
        T - The type of the value returned by TreeItem.getValue().
        Parameters:
        node - The TreeItem to be expanded or collapsed.
        expand - If true the node and its children will be expanded, if false they will be collapsed.
        Returns:
        The passed TreeItem node.
      • expandAll

        public static <T> TreeView<T> expandAll​(TreeView<T> tree,
                                                boolean expand)
        Expands/collapses the TreeView root node and all its non-leaf children recursively.

        This method is not thread safe, and should be called from the JavaFX application thread.

        Type Parameters:
        T - The type of the value returned by TreeItem.getValue().
        Parameters:
        tree - The TreeView whose root node has to be expanded or collapsed.
        expand - If true the node and its children will be expanded, if false they will be collapsed.
        Returns:
        The passed TreeView.
      • expandAll

        public static <T> TreeTableView<T> expandAll​(TreeTableView<T> treeTable,
                                                     boolean expand)
        Expands/collapses the TreeTableView root node and all its non-leaf children recursively.

        This method is not thread safe, and should be called from the JavaFX application thread.

        Type Parameters:
        T - The type of the value returned by TreeItem.getValue().
        Parameters:
        treeTable - The TreeTableView whose root node has to be expanded or collapsed.
        expand - If true the node and its children will be expanded, if false they will be collapsed.
        Returns:
        The passed TreeTableView.
      • find

        public static <T> Optional<TreeItem<T>> find​(TreeItem<T> root,
                                                     Predicate<? super TreeItem<T>> predicate)
        Return an Optional object possibly containing the first tree item from the tree rooted at the given root node, matching the given Predicate.
        Type Parameters:
        T - The type of the value returned by TreeItem.getValue().
        Parameters:
        root - The root TreeItem where the search is performed.
        predicate - The predicate used to select the visited tree item.
        Returns:
        The Optional object possibly containing the found tree items.
      • find

        public static <T> Optional<TreeItem<T>> find​(TreeView<T> tree,
                                                     Predicate<? super TreeItem<T>> predicate)
        Return an Optional object possibly containing the first tree item from the given tree, matching the given Predicate.
        Type Parameters:
        T - The type of the value returned by TreeItem.getValue().
        Parameters:
        tree - The TreeView where the search is performed.
        predicate - The predicate used to select the visited tree item.
        Returns:
        The Optional object possibly containing the found tree items.
      • find

        public static <T> Optional<TreeItem<T>> find​(TreeTableView<T> tree,
                                                     Predicate<? super TreeItem<T>> predicate)
        Return an Optional object possibly containing the first tree item from the given tree table, matching the given Predicate.
        Type Parameters:
        T - The type of the value returned by TreeItem.getValue().
        Parameters:
        tree - The TreeTableView where the search is performed.
        predicate - The predicate used to select the visited tree item.
        Returns:
        The Optional object possibly containing the found tree items.
      • findValue

        public static <T> Optional<TreeItem<T>> findValue​(TreeItem<T> root,
                                                          Predicate<? super T> predicate)
        Return an Optional object possibly containing the first tree item from the tree rooted at the given root node, whose value is matching the given Predicate.
        Type Parameters:
        T - The type of the value returned by TreeItem.getValue().
        Parameters:
        root - The root TreeItem where the search is performed.
        predicate - The predicate used to select the visited tree item.
        Returns:
        The Optional object possibly containing the found tree items.
      • findValue

        public static <T> Optional<TreeItem<T>> findValue​(TreeView<T> tree,
                                                          Predicate<? super T> predicate)
        Return an Optional object possibly containing the first tree item from the given tree, whose value is matching the given Predicate.
        Type Parameters:
        T - The type of the value returned by TreeItem.getValue().
        Parameters:
        tree - The TreeView where the search is performed.
        predicate - The predicate used to select the visited tree item.
        Returns:
        The Optional object possibly containing the found tree items.
      • findValue

        public static <T> Optional<TreeItem<T>> findValue​(TreeTableView<T> tree,
                                                          Predicate<? super T> predicate)
        Return an Optional object possibly containing the first tree item from the given tree table, whose value is matching the given Predicate.
        Type Parameters:
        T - The type of the value returned by TreeItem.getValue().
        Parameters:
        tree - The TreeTableView where the search is performed.
        predicate - The predicate used to select the visited tree item.
        Returns:
        The Optional object possibly containing the found tree items.
      • search

        public static <T> List<TreeItem<T>> search​(TreeItem<T> root,
                                                   Predicate<? super TreeItem<T>> predicate)
        Return a List of the tree items from the tree rooted at the given root node, matching the given Predicate.
        Type Parameters:
        T - The type of the value returned by TreeItem.getValue().
        Parameters:
        root - The root TreeItem where the search is performed.
        predicate - The predicate used to select the visited tree item.
        Returns:
        The List of the found tree items.
      • search

        public static <T> List<TreeItem<T>> search​(TreeView<T> tree,
                                                   Predicate<? super TreeItem<T>> predicate)
        Return a List of the tree items from the given tree, matching the given Predicate.
        Type Parameters:
        T - The type of the value returned by TreeItem.getValue().
        Parameters:
        tree - The TreeView where the search is performed.
        predicate - The predicate used to select the visited tree item.
        Returns:
        The List of the found tree items.
      • search

        public static <T> List<TreeItem<T>> search​(TreeTableView<T> tree,
                                                   Predicate<? super TreeItem<T>> predicate)
        Return a List of the tree items from the given tree table, matching the given Predicate.
        Type Parameters:
        T - The type of the value returned by TreeItem.getValue().
        Parameters:
        tree - The TreeTableView where the search is performed.
        predicate - The predicate used to select the visited tree item.
        Returns:
        The List of the found tree items.
      • searchValue

        public static <T> List<TreeItem<T>> searchValue​(TreeItem<T> root,
                                                        Predicate<? super T> predicate)
        Return a List of the tree items from the tree rooted at the given root node, whose value is matching the given Predicate.
        Type Parameters:
        T - The type of the value returned by TreeItem.getValue().
        Parameters:
        root - The root TreeItem where the search is performed.
        predicate - The predicate used to select the visited tree item.
        Returns:
        The List of the found tree items.
      • searchValue

        public static <T> List<TreeItem<T>> searchValue​(TreeView<T> tree,
                                                        Predicate<? super T> predicate)
        Return a List of the tree items from the given tree, whose value is matching the given Predicate.
        Type Parameters:
        T - The type of the value returned by TreeItem.getValue().
        Parameters:
        tree - The TreeView where the search is performed.
        predicate - The predicate used to select the visited tree item.
        Returns:
        The List of the found tree items.
      • searchValue

        public static <T> List<TreeItem<T>> searchValue​(TreeTableView<T> tree,
                                                        Predicate<? super T> predicate)
        Return a List of the tree items from the given tree table, whose value is matching the given Predicate.
        Type Parameters:
        T - The type of the value returned by TreeItem.getValue().
        Parameters:
        tree - The TreeTableView where the search is performed.
        predicate - The predicate used to select the visited tree item.
        Returns:
        The List of the found tree items.