java.lang.Object
io.github.palexdev.materialfx.selection.TreeSelectionModel<T>
io.github.palexdev.materialfx.selection.TreeCheckModel<T>
- All Implemented Interfaces:
ITreeCheckModel<T>
,ITreeSelectionModel<T>
Concrete implementation of the
ITreeCheckModel
interface.
This provides common methods for items check. Also, since it extends TreeSelectionModel it also provides all the methods for items selection.
The check should be handled internally only. This is because the mechanism is kind of tricky.
If you take a look at the MFXCheckTreeItem's skin, MFXCheckTreeItemSkin
,
you can see that when the checkbox is fired, a CHECK_EVENT is fired and "travels" up to the root. Each item then calls
check(MFXCheckTreeItem, CheckTreeItemEvent)
.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
check
(MFXCheckTreeItem<T> item, MFXCheckTreeItem.CheckTreeItemEvent<?> event) This method is called byMFXCheckTreeItemSkin
when the checkbox is fired.void
Resets every item in the list to checked false and then clears the list.void
scanTree
(MFXCheckTreeItem<T> item) If you set some item to be checked before the tree is laid out then it's needed to scan the tree and add all the checked items to the list.Methods inherited from class io.github.palexdev.materialfx.selection.TreeSelectionModel
allowsMultipleSelection, clearSelection, getSelectedItem, getSelectedItems, scanTree, select, select, setAllowsMultipleSelection
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.github.palexdev.materialfx.selection.base.ITreeSelectionModel
allowsMultipleSelection, clearSelection, getSelectedItem, getSelectedItems, scanTree, select, setAllowsMultipleSelection
-
Constructor Details
-
TreeCheckModel
public TreeCheckModel()
-
-
Method Details
-
scanTree
If you set some item to be checked before the tree is laid out then it's needed to scan the tree and add all the checked items to the list.- Specified by:
scanTree
in interfaceITreeCheckModel<T>
-
check
This method is called byMFXCheckTreeItemSkin
when the checkbox is fired. We need the event as a parameter to distinguish between the item on which the CHECK_EVENT was fired and the parent items.If the event is null we call the other
check(MFXCheckTreeItem)
method.- Specified by:
check
in interfaceITreeCheckModel<T>
-
clearChecked
public void clearChecked()Resets every item in the list to checked false and then clears the list.- Specified by:
clearChecked
in interfaceITreeCheckModel<T>
-
getCheckedItems
- Specified by:
getCheckedItems
in interfaceITreeCheckModel<T>
- Returns:
- the ListProperty which contains all the checked items.
-