Hi Seven Corners,
I'm facing the same problem but I still don't find how to fix it.
Let me explain how I tried to handle it.
1 . I store a TreeNode in a variable 'tnProjet' when I click on the leaf.
2 . I call my class in a new page.
3 . Thus, the TreeState should be initialized with the expanded path to the
leaf by overriding newTreeState().
But the tree is still collapsed.
Here is part of my code:
@Override
protected ITreeState newTreeState( )
{
ITreeState treeState = new DefaultTreeState( );
this.setRootLess( true );
if ( tnProjet != null )
{
DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) tnProjet;
treeState.selectNode( treeNode, true );
TreeNode[] nodes = treeNode.getPath( );
for ( int i = 0; i < ( nodes.length - 1 ); i++ )
{
treeState.expandNode( nodes[i] );
}
}
this.updateTree( );
return treeState;
}
It would be grateful if you could give me some tips.
I tried to find a solution for a week and I'm still at then same level.
Best Regards,
AleXeL
NB: When I replace the content of my condition by "treeState.expandAll()",
the tree is entirely well-expanded after I click on the leaf.
Seven Corners wrote:
>
> Never mind, I figured it out. Caching the TreeState didn't get me there
> because it didn't contain the information I needed. I had to do my own
> bookkeeping, but overriding LinkTree.newTreeState() was ultimately where
> things got set aright.
>
--
View this message in context:
http://old.nabble.com/Setting-TreeState-in-new-page-tp21996538p28230641.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]