|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.zkoss.zul.AbstractTreeModel<E>
public abstract class AbstractTreeModel<E>
A skeletal implementation for TreeModel
.
For introduction, please refer to ZK Developer's Reference: Tree Model.
Constructor Summary | |
---|---|
AbstractTreeModel(E root)
Creates a AbstractTreeModel . |
Method Summary | |
---|---|
void |
addSelection(E obj)
Add the specified object into selection. |
void |
addTreeDataListener(TreeDataListener l)
Add a listener to the tree that's notified each time a change to the data model occurs |
void |
clearOpen()
Clear all open status. |
void |
clearSelection()
Clear all selection. |
void |
fireEvent(E node,
int indexFrom,
int indexTo,
int evtType)
Fires a TreeDataEvent for all registered listener |
int |
getIndexOfChild(E parent,
E child)
Returns the index of child in parent. |
int[] |
getPath(Object parent,
Object lastNode)
Deprecated. As of release 5.0.6, it was replaced by getIndexOfChild(E, E) .
This method was implemented to provide backward compatibility. |
E |
getRoot()
Return the root of tree |
Set<E> |
getSelection()
Returns current selection. |
boolean |
isOpen(E obj)
Returns whether the specified object be opened. |
protected void |
removeAllSelection(Collection<? extends E> c)
|
void |
removeSelection(Object obj)
Remove the specified object from selection. |
void |
removeTreeDataListener(TreeDataListener l)
Remove a listener to the tree that's notified each time a change to the data model occurs |
protected void |
retainAllSelection(Collection<? extends E> c)
|
void |
setOpen(E obj,
boolean open)
Sets the specified object into open. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.zkoss.zul.TreeModel |
---|
getChild, getChildCount, isLeaf |
Constructor Detail |
---|
public AbstractTreeModel(E root)
AbstractTreeModel
.
root
- root of treeMethod Detail |
---|
public E getRoot()
getRoot
in interface TreeModel<E>
public void fireEvent(E node, int indexFrom, int indexTo, int evtType)
TreeDataEvent
for all registered listener
Note: you can invoke this method only in an event listener.
public int getIndexOfChild(E parent, E child)
The default implementation iterates through all children of parent
by invoking, and check if child
is part of them.
You could override it if you have a better algorithm.
TreeModel.getChild(E, int)
getIndexOfChild
in interface TreeModel<E>
parent
- a node in the tree, obtained from this data sourcechild
- the node we are interested in
public void addTreeDataListener(TreeDataListener l)
TreeModel
addTreeDataListener
in interface TreeModel<E>
l
- the listener to addpublic void removeTreeDataListener(TreeDataListener l)
TreeModel
removeTreeDataListener
in interface TreeModel<E>
l
- the listener to removepublic Set<E> getSelection()
Selectable
getSelection
in interface Selectable<E>
public void addSelection(E obj)
Selectable
Notice that this method is designed to be called by a component
(such as Listbox
).
If it is called by an application, the component's selection status
won't be changed.
addSelection
in interface Selectable<E>
obj
- the object to be as selection.public void removeSelection(Object obj)
Selectable
Notice that this method is designed to be called by a component
(such as Listbox
).
If it is called by an application, the component's selection status
won't be changed.
removeSelection
in interface Selectable<E>
obj
- the object to be remove from selection.public void clearSelection()
Selectable
Notice that this method is designed to be called by a component
(such as Listbox
).
If it is called by an application, the component's selection status
won't be changed.
clearSelection
in interface Selectable<E>
protected void removeAllSelection(Collection<? extends E> c)
protected void retainAllSelection(Collection<? extends E> c)
public void setOpen(E obj, boolean open)
Openable
Notice that this method is designed to be called by a component
(such as Treeitem
).
If it is called by an application, the component's open status
won't be changed.
setOpen
in interface Openable<E>
obj
- the object to be as open.open
- whether be openedpublic boolean isOpen(E obj)
Openable
isOpen
in interface Openable<E>
public void clearOpen()
Openable
Notice that this method is designed to be called by a component
(such as Tree
).
If it is called by an application, the component's open status
won't be changed.
clearOpen
in interface Openable<E>
public int[] getPath(Object parent, Object lastNode)
getIndexOfChild(E, E)
.
This method was implemented to provide backward compatibility.
getPath
in interface TreeModel<E>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |