Module xaos.ui

Class FilterableTreeItem<T>

  • Type Parameters:
    T - The type of the value returned by TreeItem.getValue().
    All Implemented Interfaces:
    EventTarget

    public class FilterableTreeItem<T>
    extends CheckBoxTreeItem<T>
    An extension of TreeItem with the possibility to filter its children. To enable filtering it is necessary to set the TreeItemPredicate. If a predicate is set, then the tree item will also use this predicate to filter its children (if they are of the type FilterableTreeItem). A tree item that has children will not be filtered. The predicate will only be evaluated, if the tree item is a leaf. Since the predicate is also set for the child tree items, the tree item in question can turn into a leaf if all its children are filtered. This class extends CheckBoxTreeItem so it can, but does not need to be, used in conjunction with CheckBoxTreeCell cells.
    Author:
    claudio.rosati@esss.se
    See Also:
    Filtering a JavaFX TreeView
    • Constructor Detail

      • FilterableTreeItem

        public FilterableTreeItem()
        Creates a new FilterableTreeItem with filtered children. To enable filtering sorting it is necessary to set the TreeItemPredicate. If no predicate is set, then the tree item will attempt so bind itself to the predicate of its parent.
      • FilterableTreeItem

        public FilterableTreeItem​(T value)
        Creates a new FilterableTreeItem with filtered children. To enable filtering sorting it is necessary to set the TreeItemPredicate. If no predicate is set, then the tree item will attempt so bind itself to the predicate of its parent.
        Parameters:
        value - The value of the tree item.
      • FilterableTreeItem

        public FilterableTreeItem​(T value,
                                  Node graphic)
        Creates a new FilterableTreeItem with filtered children.To enable filtering sorting it is necessary to set the TreeItemPredicate.If no predicate is set, then the tree item will attempt so bind itself to the predicate of its parent.
        Parameters:
        value - The value of the tree item.
        graphic - The Node to show in the TreeView next to this tree item.
      • FilterableTreeItem

        public FilterableTreeItem​(T value,
                                  Node graphic,
                                  boolean selected)
        Creates a new FilterableTreeItem with filtered children.To enable filtering sorting it is necessary to set the TreeItemPredicate.If no predicate is set, then the tree item will attempt so bind itself to the predicate of its parent.
        Parameters:
        value - The value of the tree item.
        graphic - The Node to show in the TreeView next to this tree item.
        selected - The initial value of the CheckBoxTreeItem.selectedProperty().