Package org.adempiere.webui.component
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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add new node to rootorg.zkoss.zul.DefaultTreeNode<Object>
addNode
(org.zkoss.zul.DefaultTreeNode<Object> newParent, org.zkoss.zul.DefaultTreeNode<Object> newNode, int index) Add newNode as children of newParentvoid
addOnDropEventListener
(org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> listener) Add listener for ON_DROP eventstatic SimpleTreeModel
createFrom
(MTreeNode root) Create model fromMTreeNode
structureorg.zkoss.zul.DefaultTreeNode<Object>
Find node with Node_ID=recordId starting from fromNode or root node.org.zkoss.zul.DefaultTreeNode<Object>
Find parent node for treeNodeorg.zkoss.zul.DefaultTreeNode<Object>
getRoot()
static SimpleTreeModel
initADTree
(org.zkoss.zul.Tree tree, int AD_Tree_ID, int windowNo) static SimpleTreeModel
initADTree
(org.zkoss.zul.Tree tree, int AD_Tree_ID, int windowNo, boolean editable, String trxName) 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 structurestatic SimpleTreeModel
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 nodevoid
onEvent
(org.zkoss.zk.ui.event.Event event) void
removeNode
(org.zkoss.zul.DefaultTreeNode<Object> treeNode) Remove node from modelvoid
void
setIsValueDisplayed
(boolean isValueDisplayed) Set whether Value is displayvoid
setItemDraggable
(boolean b) Set draggable or not draggable for each tree nodevoid
setTreeDrivenByValue
(boolean isTreeDrivenByValue) Set tree sorted by Value or NameMethods 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
-
Constructor Details
-
SimpleTreeModel
- Parameters:
root
- Root node
-
-
Method Details
-
initADTree
- 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
Create model fromMTreeNode
structure- Parameters:
root
- Root node- Returns:
- SimpleTreeModel
-
render
- Specified by:
render
in interfaceorg.zkoss.zul.TreeitemRenderer<Object>
- Parameters:
ti
-node
-index
-
-
addNode
Add new node to root- Parameters:
newNode
-
-
getRoot
-
removeNode
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
- Specified by:
onEvent
in interfaceorg.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 noderecordId
- Node_ID- Returns:
- DefaultTreeNode
-
nodeUpdated
Fire CONTENTS_CHANGED event for node- Parameters:
node
- DefaultTreeNode
-