Well that surprises me... probably you stumbled over another error than
the one I described...
The tree2 component is imho not really production stable, but it also
depends if your treedata changes etc
James Ellis wrote:
I downloaded the latest version of Tomahawk.jar and suddenly my problem
disappears. This is nice but also a little scary...how production ready
are these tomahawk components?
Jim
From: Marius Kreis <[EMAIL PROTECTED]>
Reply-To: "MyFaces Discussion" <[email protected]>
To: MyFaces Discussion <[email protected]>
Subject: Re: Tree2 Minor Customization To Example Not Working
Date: Thu, 10 Nov 2005 15:16:26 +0100
This exception is a long-known issue with the tree2 implementation.
The problem is the way how the state of the nodes (expanded or
collapsed) is stored.
Currently the nodes of each depth are numbered every time the tree is
displayed. When the state of the tree is saved, this number and the
state of the node are stored.
On restoring the state, the nodes are toggled (expanded or collapsed)
according to the current number they get and the state which was saved
for this number.
When you insert a leaf at a positon where a expanded node has formerly
been you'll run into this exception because the new leaf gets the id
of the former expanded node - and when the state is applied then this
leaf is to be expanded.
The solution would be that every node gets a unique id which is stored
in the node. After restoring the state all new nodes would be ignored.
But implementing this changes some other stuff some people might
use... I'm currently working on a fix because I got the same problem
as you do.
- Marius
James Ellis wrote:
I am trying to use the tree2 component that ships with MyFaces
Tomahawk but I keep running into issues. I've been trying to debug
this for two days now.
I have gotten the tree2.jsp example up and running but it breaks when
i try to customize it. It keeps giving me the error:
Encountered a node [0:0:1] + with an illogical state. Node is
expanded but it is also considered a leaf (a leaf cannot be
considered expanded.
The code works fine if I my TreeBacker.getTreeData() looks like this:
public TreeNode getTreeData()
{
TreeNode treeData = new TreeNodeBase("foo-folder", "Inbox", false);
TreeNodeBase personNode = new TreeNodeBase("foo-folder", "Frank
Foo", false);
personNode.getChildren().add(new TreeNodeBase("document",
"C050003", true));
treeData.getChildren().add(personNode);
return treeData;
}
However if I add one more node beneath that (which is explicitly
marked as a leaf) it bombs out on me with the error mentioned above:
public TreeNode getTreeData()
{
TreeNode treeData = new TreeNodeBase("foo-folder", "Inbox", false);
TreeNodeBase personNode = new TreeNodeBase("foo-folder", "Frank
Foo", false);
personNode.getChildren().add(new TreeNodeBase("document",
"C050003", true));
personNode.getChildren().add(new TreeNodeBase("document",
"22C050003", true));
treeData.getChildren().add(personNode);
return treeData;
}
All I want is a folder structure that looks like this:
Parent (expandable folder)
-----Child (not expandable, just a link)
-----Child (not expandable, just a link)
This can't be too hard. Any help appreciated.
Jim