You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Bill Schneider <bs...@vecna.com> on 2006/04/04 07:36:55 UTC

Re: IllegalStateException, Node is expanded but it is also considered a leaf

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 
>>illogical
>>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 
>>the
>>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
bschneider@vecna.com
t: 240-737-1640
f: 301-699-3180

Re: IllegalStateException, Node is expanded but it is also considered a leaf

Posted by Sunil <sm...@neom.com>.
Thanks a bunch Bill & Steven. I will try both of your suggestions and hopefully
it would work for my case !!

I hope they release the 1.1.2 version asap !! 

Thanks once again..

Sunil