Class SimpleTreeModel

java.lang.Object
org.zkoss.zul.AbstractTreeModel<org.zkoss.zul.TreeNode<E>>
org.zkoss.zul.DefaultTreeModel<Object>
org.adempiere.webui.component.SimpleTreeModel
All Implemented Interfaces:
Serializable, org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event>, org.zkoss.zul.ext.Openable<org.zkoss.zul.TreeNode<Object>>, org.zkoss.zul.ext.Pageable, org.zkoss.zul.ext.Selectable<org.zkoss.zul.TreeNode<Object>>, org.zkoss.zul.ext.Sortable<org.zkoss.zul.TreeNode<Object>>, org.zkoss.zul.ext.TreeOpenableModel, org.zkoss.zul.ext.TreeSelectableModel, org.zkoss.zul.PageableModel, org.zkoss.zul.TreeitemRenderer<Object>, org.zkoss.zul.TreeModel<org.zkoss.zul.TreeNode<Object>>
Direct Known Subclasses:
FavoriteSimpleTreeModel

public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> implements org.zkoss.zul.TreeitemRenderer<Object>, org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event>
DefaultTreeModel implementation that also implements the TreeitemRenderer interface.
Use by ADTreePanel.
Author:
Low Heng Sin
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.zkoss.zul.AbstractTreeModel

    org.zkoss.zul.AbstractTreeModel.DefaultSelectionControl<E extends Object>, org.zkoss.zul.AbstractTreeModel.Path
  • Field Summary

    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
    SimpleTreeModel(org.zkoss.zul.DefaultTreeNode<Object> root)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addNode(org.zkoss.zul.DefaultTreeNode<Object> newNode)
    Add new node to root
    org.zkoss.zul.DefaultTreeNode<Object>
    addNode(org.zkoss.zul.DefaultTreeNode<Object> newParent, org.zkoss.zul.DefaultTreeNode<Object> newNode, int index)
    Add newNode as children of newParent
    void
    addOnDropEventListener(org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> listener)
    Add listener for ON_DROP event
    Create model from MTreeNode structure
    org.zkoss.zul.DefaultTreeNode<Object>
    find(org.zkoss.zul.DefaultTreeNode<Object> fromNode, int recordId)
    Find node with Node_ID=recordId starting from fromNode or root node.
    org.zkoss.zul.DefaultTreeNode<Object>
    getParent(org.zkoss.zul.DefaultTreeNode<Object> treeNode)
    Find parent node for treeNode
    org.zkoss.zul.DefaultTreeNode<Object>
     
    initADTree(org.zkoss.zul.Tree tree, int AD_Tree_ID, int windowNo)
     
    initADTree(org.zkoss.zul.Tree tree, int AD_Tree_ID, int windowNo, boolean editable, String trxName)
     
    initADTree(org.zkoss.zul.Tree tree, int AD_Tree_ID, int windowNo, boolean editable, String trxName, String linkColName, int linkID)
    Create tree model from AD_Tree structure
    initADTree(org.zkoss.zul.Tree tree, int AD_Tree_ID, int windowNo, String linkColName, int linkID)
     
    boolean
     
    boolean
     
    boolean
     
    void
    nodeUpdated(org.zkoss.zul.DefaultTreeNode<Object> node)
    Fire CONTENTS_CHANGED event for node
    void
    onEvent(org.zkoss.zk.ui.event.Event event)
     
    void
    removeNode(org.zkoss.zul.DefaultTreeNode<Object> treeNode)
    Remove node from model
    void
    render(org.zkoss.zul.Treeitem ti, Object node, int index)
     
    void
    setIsValueDisplayed(boolean isValueDisplayed)
    Set whether Value is display
    void
    setItemDraggable(boolean b)
    Set draggable or not draggable for each tree node
    void
    setTreeDrivenByValue(boolean isTreeDrivenByValue)
    Set tree sorted by Value or Name

    Methods inherited from class org.zkoss.zul.DefaultTreeModel

    clone, 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, fireSelectionChanged, getActivePage, getChild, getOpenCount, getOpenObjects, getOpenPath, getOpenPaths, getPageCount, getPageSize, getSelection, getSelectionControl, getSelectionCount, getSelectionPath, getSelectionPaths, getTotalSize, getTreeDataListeners, isMultiple, isOpenEmpty, isPathOpened, isPathSelected, isSelectionEmpty, removeOpenPath, removeOpenPaths, removePagingEventListener, removeSelectionPath, removeSelectionPaths, removeTreeDataListener, setActivePage, setMultiple, setOpenObjects, setPageSize, setSelection, setSelectionControl

    Methods inherited from class java.lang.Object

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

    • SimpleTreeModel

      public SimpleTreeModel(org.zkoss.zul.DefaultTreeNode<Object> root)
      Parameters:
      root - Root node
  • Method Details

    • initADTree

      public static SimpleTreeModel initADTree(org.zkoss.zul.Tree tree, int AD_Tree_ID, int windowNo)
      Parameters:
      tree -
      AD_Tree_ID -
      windowNo -
      Returns:
      SimpleTreeModel
    • initADTree

      public static SimpleTreeModel initADTree(org.zkoss.zul.Tree tree, int AD_Tree_ID, int windowNo, String linkColName, int linkID)
      Parameters:
      tree -
      AD_Tree_ID -
      windowNo -
      linkColName -
      linkID -
      Returns:
      SimpleTreeModel
    • initADTree

      public static SimpleTreeModel initADTree(org.zkoss.zul.Tree tree, int AD_Tree_ID, int windowNo, boolean editable, String trxName)
      Parameters:
      tree -
      AD_Tree_ID -
      windowNo -
      editable -
      trxName -
      Returns:
      SimpleTreeModel
    • initADTree

      public static SimpleTreeModel initADTree(org.zkoss.zul.Tree tree, int AD_Tree_ID, int windowNo, boolean editable, String trxName, String linkColName, int linkID)
      Create tree model from AD_Tree structure
      Parameters:
      tree -
      AD_Tree_ID -
      windowNo -
      editable -
      trxName -
      linkColName -
      linkID -
      Returns:
      SimpleTreeModel
    • isTreeDrivenByValue

      public boolean isTreeDrivenByValue()
      Returns:
      true if sort by Value, false otherwise
    • setTreeDrivenByValue

      public void setTreeDrivenByValue(boolean isTreeDrivenByValue)
      Set tree sorted by Value or Name
      Parameters:
      isTreeDrivenByValue -
    • isValueDisplayed

      public boolean isValueDisplayed()
      Returns:
      true if Value is display in front of Name
    • setIsValueDisplayed

      public void setIsValueDisplayed(boolean isValueDisplayed)
      Set whether Value is display
      Parameters:
      isValueDisplayed -
    • createFrom

      public static SimpleTreeModel createFrom(MTreeNode root)
      Create model from MTreeNode structure
      Parameters:
      root - Root node
      Returns:
      SimpleTreeModel
    • render

      public void render(org.zkoss.zul.Treeitem ti, Object node, int index)
      Specified by:
      render in interface org.zkoss.zul.TreeitemRenderer<Object>
      Parameters:
      ti -
      node -
      index -
    • addNode

      public void addNode(org.zkoss.zul.DefaultTreeNode<Object> newNode)
      Add new node to root
      Parameters:
      newNode -
    • getRoot

      public org.zkoss.zul.DefaultTreeNode<Object> getRoot()
      Specified by:
      getRoot in interface org.zkoss.zul.TreeModel<org.zkoss.zul.TreeNode<Object>>
      Overrides:
      getRoot in class org.zkoss.zul.AbstractTreeModel<org.zkoss.zul.TreeNode<Object>>
    • removeNode

      public void removeNode(org.zkoss.zul.DefaultTreeNode<Object> treeNode)
      Remove node from model
      Parameters:
      treeNode -
    • setItemDraggable

      public void setItemDraggable(boolean b)
      Set draggable or not draggable for each tree node
      Parameters:
      b -
    • isItemDraggable

      public boolean isItemDraggable()
      Returns:
      true if tree item is draggable, false otherwise
    • addOnDropEventListener

      public void addOnDropEventListener(org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> listener)
      Add listener for ON_DROP event
      Parameters:
      listener -
    • onEvent

      public void onEvent(org.zkoss.zk.ui.event.Event event) throws Exception
      Specified by:
      onEvent in interface org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event>
      Parameters:
      event -
      Throws:
      Exception
      See Also:
      • EventListener.onEvent(Event)
    • getParent

      public org.zkoss.zul.DefaultTreeNode<Object> getParent(org.zkoss.zul.DefaultTreeNode<Object> treeNode)
      Find parent node for treeNode
      Parameters:
      treeNode -
      Returns:
      DefaultTreeNode or null if not found
    • addNode

      public org.zkoss.zul.DefaultTreeNode<Object> addNode(org.zkoss.zul.DefaultTreeNode<Object> newParent, org.zkoss.zul.DefaultTreeNode<Object> newNode, int index)
      Add newNode as children of newParent
      Parameters:
      newParent -
      newNode -
      index -
      Returns:
      parent node. this could be a new instance created to replace the newParent node parameter
    • find

      public org.zkoss.zul.DefaultTreeNode<Object> find(org.zkoss.zul.DefaultTreeNode<Object> fromNode, int recordId)
      Find node with Node_ID=recordId starting from fromNode or root node.
      Parameters:
      fromNode - Optional starting node. If null, start from Root node
      recordId - Node_ID
      Returns:
      DefaultTreeNode
    • nodeUpdated

      public void nodeUpdated(org.zkoss.zul.DefaultTreeNode<Object> node)
      Fire CONTENTS_CHANGED event for node
      Parameters:
      node - DefaultTreeNode