Class DefaultTristateTreeModel<E>

  • All Implemented Interfaces:
    java.io.Serializable, org.zkoss.zul.ext.Openable<org.zkoss.zul.TreeNode<E>>, org.zkoss.zul.ext.Pageable, org.zkoss.zul.ext.Selectable<org.zkoss.zul.TreeNode<E>>, org.zkoss.zul.ext.Sortable<org.zkoss.zul.TreeNode<E>>, org.zkoss.zul.ext.TreeOpenableModel, org.zkoss.zul.ext.TreeSelectableModel, org.zkoss.zul.ext.TristateModel<E>, org.zkoss.zul.PageableModel, org.zkoss.zul.TreeModel<org.zkoss.zul.TreeNode<E>>

    public class DefaultTristateTreeModel<E>
    extends org.zkoss.zul.DefaultTreeModel<E>
    implements org.zkoss.zul.ext.TristateModel<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:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      protected class  DefaultTristateTreeModel.Path  
      • Nested classes/interfaces inherited from class org.zkoss.zul.AbstractTreeModel

        org.zkoss.zul.AbstractTreeModel.DefaultSelectionControl<E extends java.lang.Object>
      • Nested classes/interfaces inherited from interface org.zkoss.zul.ext.TristateModel

        org.zkoss.zul.ext.TristateModel.State
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Set<DefaultTristateTreeModel.Path> _partial
      The partial selection.
      • Fields inherited from class org.zkoss.zul.AbstractTreeModel

        _opens, _selection
      • Fields inherited from interface org.zkoss.zul.PageableModel

        INTERNAL_EVENT
    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultTristateTreeModel​(org.zkoss.zul.TreeNode<E> root)
      Creates a tristate tree with the specified note as the root.
      DefaultTristateTreeModel​(org.zkoss.zul.TreeNode<E> root, boolean emptyChildAsLeaf)
      Creates a tristate tree with the specified note as the root.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean addPartialPath​(int[] path)  
      boolean addPartialPaths​(int[][] paths)  
      boolean addToPartial​(E child)  
      void clearPartial()  
      java.lang.Object clone()  
      protected void fireSelectionChanged​(int[] path)  
      protected void fireTristateSelectionChanged​(int[] path)  
      int[] getPartialPath()  
      int[][] getPartialPaths()  
      java.util.Set<E> getPartials()  
      boolean isPartial​(java.lang.Object child)  
      boolean isPathPartial​(int[] path)  
      boolean removeFromPartial​(java.lang.Object child)  
      boolean removePartialPath​(int[] path)  
      boolean removePartialPaths​(int[][] paths)  
      void setMultiple​(boolean multiple)  
      • Methods inherited from class org.zkoss.zul.DefaultTreeModel

        getChild, getChildCount, getIndexOfChild, getPath, getSortDirection, isLeaf, isObjectOpened, isSelected, removeFromSelection, removeOpenObject, sort, sort
      • Methods 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
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultTristateTreeModel

        public DefaultTristateTreeModel​(org.zkoss.zul.TreeNode<E> root)
        Creates a tristate tree with the specified note as the root.
        Parameters:
        root - the root (cannot be null).
      • DefaultTristateTreeModel

        public DefaultTristateTreeModel​(org.zkoss.zul.TreeNode<E> root,
                                        boolean emptyChildAsLeaf)
        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 Detail

      • fireSelectionChanged

        protected void fireSelectionChanged​(int[] path)
        Overrides:
        fireSelectionChanged in class org.zkoss.zul.AbstractTreeModel<org.zkoss.zul.TreeNode<E>>
      • fireTristateSelectionChanged

        protected void fireTristateSelectionChanged​(int[] path)
      • clone

        public java.lang.Object clone()
        Overrides:
        clone in class org.zkoss.zul.DefaultTreeModel<E>
      • setMultiple

        public void setMultiple​(boolean multiple)
        Specified by:
        setMultiple in interface org.zkoss.zul.ext.Selectable<E>
        Specified by:
        setMultiple in interface org.zkoss.zul.ext.TreeSelectableModel
        Overrides:
        setMultiple in class org.zkoss.zul.AbstractTreeModel<org.zkoss.zul.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

        public java.util.Set<E> getPartials()
        Specified by:
        getPartials in interface org.zkoss.zul.ext.TristateModel<E>
      • isPartial

        public boolean isPartial​(java.lang.Object child)
        Specified by:
        isPartial in interface org.zkoss.zul.ext.TristateModel<E>
      • addToPartial

        public boolean addToPartial​(E child)
      • removeFromPartial

        public boolean removeFromPartial​(java.lang.Object child)