java.lang.Object
javafx.scene.control.TreeItem<T>
com.iamsoft.util.ui.javafx.LazyTreeItem<T,U>
- Type Parameters:
T- item typeU- Type from which tree items are created.
- All Implemented Interfaces:
javafx.event.EventTarget
public class LazyTreeItem<T,U>
extends javafx.scene.control.TreeItem<T>
Tree item whose children are calculated lazily.
-
Property Summary
Properties inherited from class javafx.scene.control.TreeItem
expanded, graphic, leaf, parent, value -
Nested Class Summary
Nested classes/interfaces inherited from class javafx.scene.control.TreeItem
javafx.scene.control.TreeItem.TreeModificationEvent<T extends Object> -
Constructor Summary
ConstructorsConstructorDescriptionLazyTreeItem(T pItem, Callable<Collection<U>> pChildElementsCallable, Function<U, javafx.scene.control.TreeItem<T>> pElementToTreeItemFunction) If callable is null, node is considered a leaf. -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermines whether the loading of children is finished.javafx.collections.ObservableList<javafx.scene.control.TreeItem<T>>protected booleanbooleanisLeaf()voidvoidloadAllDescendants(Runnable pOnFinish) voidloadAllDescendants(Runnable pOnFinish, BooleanSupplier pAbort) voidloadChildren(Runnable pOnLoadHandler) If this tree item is not a leaf and children are loaded, the specified handler is invoked immediately.voidloadRecursively(Function<LazyTreeItem<T, U>, Boolean> pSelector, boolean pProcessAll) voidloadRecursively(Function<LazyTreeItem<T, U>, Boolean> pSelector, boolean pProcessAll, Runnable pOnFinish) voidloadRecursively(Function<LazyTreeItem<T, U>, Boolean> pSelector, boolean pProcessAll, Runnable pOnFinish, BooleanSupplier pAbort) protected voidInvoked on the JavaFX thread if failed to calculate children (before onFinished() is invoked).protected voidInvoked on the JavaFX thread after children are calculated, no matter if the task fails.javafx.collections.ObservableList<javafx.scene.control.TreeItem<T>>Provides access to children without triggering child elements loading in case they are not loaded, yet.protected voidsubmitTask(javafx.concurrent.Task<Collection<U>> pTask) Methods inherited from class javafx.scene.control.TreeItem
addEventHandler, branchCollapsedEvent, branchExpandedEvent, buildEventDispatchChain, childrenModificationEvent, expandedItemCountChangeEvent, expandedProperty, getGraphic, getParent, getValue, graphicChangedEvent, graphicProperty, isExpanded, leafProperty, nextSibling, nextSibling, parentProperty, previousSibling, previousSibling, removeEventHandler, setExpanded, setGraphic, setValue, toString, treeNotificationEvent, valueChangedEvent, valueProperty
-
Constructor Details
-
LazyTreeItem
public LazyTreeItem(T pItem, Callable<Collection<U>> pChildElementsCallable, Function<U, javafx.scene.control.TreeItem<T>> pElementToTreeItemFunction) If callable is null, node is considered a leaf.- Parameters:
pItem- Tree item.pChildElementsCallable- Callable, which will be invoked on a background thread to provide list of child elements. Note that elements must be immutable, or effectively immutable.pElementToTreeItemFunction- Function, which will be invoked on the JavaFX thread to create children.
-
-
Method Details
-
isGetChildrenCalled
protected boolean isGetChildrenCalled() -
isLeaf
public boolean isLeaf()- Overrides:
isLeafin classjavafx.scene.control.TreeItem<T>
-
childrenLoaded
public boolean childrenLoaded()Determines whether the loading of children is finished. -
loadChildren
If this tree item is not a leaf and children are loaded, the specified handler is invoked immediately. -
getChildren
- Overrides:
getChildrenin classjavafx.scene.control.TreeItem<T>
-
peekChildren
Provides access to children without triggering child elements loading in case they are not loaded, yet. -
submitTask
-
onFailed
Invoked on the JavaFX thread if failed to calculate children (before onFinished() is invoked). -
onFinished
protected void onFinished()Invoked on the JavaFX thread after children are calculated, no matter if the task fails. -
loadAllDescendants
public void loadAllDescendants() -
loadAllDescendants
-
loadAllDescendants
-
loadRecursively
- Parameters:
pSelector- The selector returnstrueif the children of the specified tree item should be loaded.pProcessAll- Iftrueall children are processed, regardless of the selector results. Otherwise, children of specific tree item are processed until the specified selector returnstruefor an item. For example, in case where one should ensure that tree items for a specific path are loaded.
-
loadRecursively
public void loadRecursively(Function<LazyTreeItem<T, U>, Boolean> pSelector, boolean pProcessAll, Runnable pOnFinish) - Parameters:
pSelector- The selector returnstrueif the children of the specified tree item should be loaded.pProcessAll- Iftrueall children are processed, regardless of the selector results. Otherwise, children of specific tree item are processed until the specified selector returnstruefor an item. For example, in case where one should ensure that tree items for a specific path are loaded.
-
loadRecursively
public void loadRecursively(Function<LazyTreeItem<T, U>, Boolean> pSelector, boolean pProcessAll, Runnable pOnFinish, BooleanSupplier pAbort) - Parameters:
pSelector- The selector returnstrueif the children of the specified tree item should be loaded.pProcessAll- Iftrueall children are processed, regardless of the selector results. Otherwise, children of specific tree item are processed until the specified selector returnstruefor an item. For example, in case where one should ensure that tree items for a specific path are loaded.
-