Hi,
I am getting the following exception in tomahawk tree2 while
fetching the data
from  database and constructing the tree:
java.lang.IllegalStateException: Encountered a node [0:0:0] + 
with an illogical
state. Node is expanded but it is also considered a leaf (a 
leaf cannot be
considered expanded

Here is the function which returns the tree data:
public TreeNode getTreeData()
{
  TreeNode treeData = new TreeNodeBase("foo-folder", "First",
 false);        
Enumeration keys = topMostNodes.keys();
while(keys.hasMoreElements()){
String currKey = keys.nextElement().toString();
Vector tempChildList = (Vector)topMostNodes.get(currKey);
TreeNodeBase tempNodeBase = new TreeNodeBase("foo-folder", 
currKey, false);
for(int cnt=0; cnt < tempChildList.size(); cnt++)
tempNodeBase.getChildren().add(new
TreeNodeBase("foo-folder",tempChildList.get(cnt).toString()
,true));
treeData.getChildren().add(tempNodeBase);
}
return treeData;
}

The topMostNodes HashTable contanis these entries:

parent 170160   childList [108858, 152338, 306438]
parent 106404   childList [306304]
parent 106402   childList [106406, 106407, 106408]
parent 106401   childList [106404]
parent 106400   childList [106403, 106405]
parent 290094   childList [290095, 290096, 290097, 290098, 
290099, 290100, 290101]

childList is a vector containing all the children of a node.

This is the stack Trace of the exception I am getting:


java.lang.IllegalStateException: Encountered a node [0:0:0] 
+ with an illogical
state.  Node is expanded but it is also considered a leaf 
(a leaf cannot be
considered expanded.
at org.apache.myfaces.custom.tree2.HtmlTreeRenderer.encodeNavigation
(HtmlTreeRenderer.java:463)
at org.apache.myfaces.custom.tree2.HtmlTreeRenderer.encodeCurrentNode
HtmlTreeRenderer.java:346)
at org.apache.myfaces.custom.tree2.HtmlTreeRenderer.encodeTree
(HtmlTreeRenderer.java:248)
        at org.apache.myfaces.custom.tree2.HtmlTreeRenderer.encodeTree
(HtmlTreeRenderer.java:276)
        at org.apache.myfaces.custom.tree2.HtmlTreeRenderer.
encodeChildren
(HtmlTreeRenderer.java:211)
        at javax.faces.component.UIComponentBase.encodeChildren
(UIComponentBase.java:701)
        at org.apache.myfaces.renderkit.RendererUtils.renderChild
(RendererUtils.java:444)
        at org.apache.myfaces.renderkit.html.HtmlGridRendererBase.
renderChildren
(HtmlGridRendererBase.java:203)
        at org.apache.myfaces.renderkit.html.HtmlGridRendererBase.
encodeEnd
(HtmlGridRendererBase.java:85)
        at 
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:720)
        at javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.
java:623)
        at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.
java:546)

It works fine if I replace the while loop with some hard coded node
 values.

Can anybody help plz?

Thanks in advance.
Sanjeev.


Reply via email to