Package org.zkoss.zkmax.zul
Class DefaultTristateTreeModel<E>
java.lang.Object
org.zkoss.zul.AbstractTreeModel<TreeNode<E>>
org.zkoss.zul.DefaultTreeModel<E>
org.zkoss.zkmax.zul.DefaultTristateTreeModel<E>
- All Implemented Interfaces:
Serializable,Openable<TreeNode<E>>,Pageable,Selectable<TreeNode<E>>,Sortable<TreeNode<E>>,TreeOpenableModel,TreeSelectableModel,TristateModel<E>,PageableModel,TreeModel<TreeNode<E>>
A simple tristate tree data model that uses
TreeNode to represent a tree.
Thus the whole tree of data must be loaded into memory, and each node
must be represented by TreeNode.
If you want to implement a huge tristate tree that only a visible part shall
be loaded, it is better to implement it by extending from
AbstractTreeModel, TristateModel.
This Model is dependent on DefaultTreeModel, for more information please refer it.
- Since:
- 10.0.0
- Author:
- Jamson Chan
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.zkoss.zul.AbstractTreeModel
AbstractTreeModel.DefaultSelectionControl<E>Nested classes/interfaces inherited from interface org.zkoss.zul.ext.TristateModel
TristateModel.State -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Set<DefaultTristateTreeModel<E>.Path>The partial selection.Fields inherited from class org.zkoss.zul.AbstractTreeModel
_opens, _selectionFields inherited from interface org.zkoss.zul.PageableModel
INTERNAL_EVENT -
Constructor Summary
ConstructorsConstructorDescriptionDefaultTristateTreeModel(TreeNode<E> root) Creates a tristate tree with the specified note as the root.DefaultTristateTreeModel(TreeNode<E> root, boolean emptyChildAsLeaf) Creates a tristate tree with the specified note as the root. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddPartialPath(int[] path) booleanaddPartialPaths(int[][] paths) booleanaddToPartial(E child) voidclone()protected voidfireSelectionChanged(int[] path) Fires aTreeDataEventfor all registered listener when selection status has changed.protected voidfireTristateSelectionChanged(int[] path) int[]int[][]Returns the current partial selection.booleanReturns whether the item is partially selected.booleanisPathPartial(int[] path) booleanremoveFromPartial(Object child) booleanremovePartialPath(int[] path) booleanremovePartialPaths(int[][] paths) voidsetMultiple(boolean multiple) Sets the selection mode to be multiple.Methods inherited from class org.zkoss.zul.DefaultTreeModel
getChild, getChildCount, getIndexOfChild, getPath, getSortDirection, isLeaf, isObjectOpened, isSelected, removeFromSelection, removeOpenObject, sort, sortMethods inherited from class org.zkoss.zul.AbstractTreeModel
addOpenObject, addOpenPath, addOpenPaths, addPagingEventListener, addSelectionPath, addSelectionPaths, addToSelection, addTreeDataListener, afterSort, beforeSort, clearOpen, clearSelection, fireEvent, fireEvent, fireEvent, fireOpenChanged, getActivePage, getChild, getOpenCount, getOpenObjects, getOpenPath, getOpenPaths, getPageCount, getPageSize, getRoot, getSelection, getSelectionControl, getSelectionCount, getSelectionPath, getSelectionPaths, getTotalSize, getTreeDataListeners, isMultiple, isOpenEmpty, isPathOpened, isPathSelected, isSelectionEmpty, removeOpenPath, removeOpenPaths, removePagingEventListener, removeSelectionPath, removeSelectionPaths, removeTreeDataListener, setActivePage, setOpenObjects, setPageSize, setSelection, setSelectionControl
-
Field Details
-
_partial
The partial selection.
-
-
Constructor Details
-
DefaultTristateTreeModel
Creates a tristate tree with the specified note as the root.- Parameters:
root- the root (cannot be null).
-
DefaultTristateTreeModel
Creates a tristate tree with the specified note as the root.- Parameters:
root- the root (cannot be null).emptyChildAsLeaf- whether to treat the zero size of children node as a leaf node.
-
-
Method Details
-
fireSelectionChanged
protected void fireSelectionChanged(int[] path) Description copied from class:AbstractTreeModelFires aTreeDataEventfor all registered listener when selection status has changed.- Overrides:
fireSelectionChangedin classAbstractTreeModel<TreeNode<E>>
-
fireTristateSelectionChanged
protected void fireTristateSelectionChanged(int[] path) -
clone
- Overrides:
clonein classDefaultTreeModel<E>
-
setMultiple
public void setMultiple(boolean multiple) Description copied from interface:TreeSelectableModelSets the selection mode to be multiple.- Specified by:
setMultiplein interfaceSelectable<E>- Specified by:
setMultiplein interfaceTreeSelectableModel- Overrides:
setMultiplein classAbstractTreeModel<TreeNode<E>>
-
addPartialPath
public boolean addPartialPath(int[] path) -
addPartialPaths
public boolean addPartialPaths(int[][] paths) -
removePartialPath
public boolean removePartialPath(int[] path) -
removePartialPaths
public boolean removePartialPaths(int[][] paths) -
isPathPartial
public boolean isPathPartial(int[] path) -
getPartialPath
public int[] getPartialPath() -
getPartialPaths
public int[][] getPartialPaths() -
clearPartial
public void clearPartial() -
getPartials
Description copied from interface:TristateModelReturns the current partial selection.- Specified by:
getPartialsin interfaceTristateModel<E>
-
isPartial
Description copied from interface:TristateModelReturns whether the item is partially selected.- Specified by:
isPartialin interfaceTristateModel<E>- Parameters:
child- a data item
-
addToPartial
-
removeFromPartial
-