myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Schneider <>
Subject Re: IllegalStateException, Node is expanded but it is also considered a leaf
Date Tue, 04 Apr 2006 05:36:55 GMT
This happens because of the way that tree2 restores the saved TreeState. 
  I believe what's going on is, you are changing the TreeModel structure 
during the Invoke Application phase, and then during a later phase the 
tree2 component attempts to re-apply the saved TreeState from the 
pre-move tree structure to the new post-move structure.

My workaround was to subclass TreeModel overriding setTreeState to a 
no-op whenever the action touched the tree structure, to prevent tree2 
from blindly restoring the old TreeState.

In your case, though, you *want* the TreeState restored, with 
appropriate changes to account for the move.  So instead of making 
setTreeState a no-op, you'd instead want it to make appropriate changes 
to contract the parent of whatever node you're moving if necessary 
(i.e., if you're moving its only child and the move turns it into a 
leaf) and then call super.setTreeState.

Hopefully this issue will go away in the tree2 node-id overhaul in 1.1.2 
I hear rumors about. :-)

-- Bill

>>I am trying to Move a Node from one parent to another one.. But I am getting
>>error  ,
>>"java.lang.IllegalStateException: Encountered a node [0:0:0] + with an 
>>state.  Node is expanded but it is also considered a leaf (a leaf cannot be
>>considered expanded)"
>>This happens only if i perform the action with Parent Node EXPANDED. If I do 
>>MOVE action with Parent folder collapsed, it works perfectly fine. I guess the
>>expanded or collapsed state information is not rightly being handled. 

Bill Schneider
Chief Architect

Vecna Technologies, Inc.
5004 Lehigh Road
College Park, MD 20740
t: 240-737-1640
f: 301-699-3180

View raw message