-
Bug
-
Resolution: Done
-
Normal
-
None
-
None
-
None
-
ZK 6.0.0, Zul jsp 2.0
When creating a tree demo according to Small Talk http://books.zkoss.org/wiki/Small_Talks/2007/August/ZK_Tree_Model
the tree is created and displays the top-level nodes, but clicking on the nodes doesn't open it. Is it a problem, for example, in the TreeDataListener?
Similarly, when constructing and displaying an in-memory tree according to Small Talk http://books.zkoss.org/wiki/ZK_Developer%27s_Reference/MVC/Model/Tree_Model - Example: In-Memory Tree with DefaultTreeModel - the tree displays but doesn't open the lower leafs.
jsp is:
<tiles:putAttribute name="body">
<z:page zscriptLanguage="java">
<z:tree id="tree" width="1100px" rows="20" hflex="1" vflex="1" model="${tm}">
<z:treecols sizable="true" width="1100px" hflex="1">
<z:treecol width="300px" label="Name"/>
</z:treecols>
</z:tree>
</z:page>
</tiles:putAttribute>
and model data is:
ArrayList al = new ArrayList();
int i = 0;
for (; i < 1000; i++)
BinaryTreeModel tm = new BinaryTreeModel(al);
and model is:
public class BinaryTreeModel extends AbstractTreeModel {
private ArrayList _tree = null;
/**
- Constructor
- @param tree the list is contained all data of nodes.
*/
public BinaryTreeModel(List tree) { super(tree.get(0)); _tree = (ArrayList) tree; }
// – TreeModel --//
public Object getChild(Object parent, int index) {
int i = _tree.indexOf(parent) * 2 + 1 + index;
if (i >= _tree.size())
else
{ return _tree.get(i); }}
// – TreeModel --//
public int getChildCount(Object parent) {
int count = 0;
if (getChild(parent, 0) != null)
if (getChild(parent, 1) != null) { count++; }
return count;
}
// – TreeModel --//
public boolean isLeaf(Object node)
}