Module MaterialFX.materialfx.main
Class TreeCheckModel<T>
java.lang.Object
io.github.palexdev.materialfx.selection.TreeSelectionModel<T>
io.github.palexdev.materialfx.selection.TreeCheckModel<T>
- All Implemented Interfaces:
ITreeCheckModel<T>,ITreeSelectionModel<T>
public class TreeCheckModel<T> extends TreeSelectionModel<T> implements ITreeCheckModel<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 Constructor Description TreeCheckModel() -
Method Summary
Modifier and Type Method Description voidcheck(MFXCheckTreeItem<T> item, MFXCheckTreeItem.CheckTreeItemEvent<?> event)This method is called byMFXCheckTreeItemSkinwhen the checkbox is fired.voidclearChecked()Resets every item in the list to checked false and then clears the list.ListProperty<MFXCheckTreeItem<T>>getCheckedItems()voidscanTree(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, setAllowsMultipleSelectionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
scanTreein interfaceITreeCheckModel<T>
-
check
This method is called byMFXCheckTreeItemSkinwhen 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:
checkin interfaceITreeCheckModel<T>
-
clearChecked
public void clearChecked()Resets every item in the list to checked false and then clears the list.- Specified by:
clearCheckedin interfaceITreeCheckModel<T>
-
getCheckedItems
- Specified by:
getCheckedItemsin interfaceITreeCheckModel<T>- Returns:
- the ListProperty which contains all the checked items.
-