Re: Setting TreeState in new page

2010-04-13 Thread AleXeL

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: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Setting TreeState in new page

2009-02-13 Thread Seven Corners

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://www.nabble.com/Setting-TreeState-in-new-page-tp21996538p22003438.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Setting TreeState in new page

2009-02-13 Thread Seven Corners

I have a LinkTree where each node contains links to pages, and each of these
pages derives from the same base class, so they all contain that LinkTree. 
When a user drills down into the tree on one page and then clicks a link for
another page, I'd like the new page we go to to open the tree to its state
in the last page.

I can save the TreeState to the session and retrieve it in the new page, but
that's not the problem.

Right now, in the new page, the new tree displays collapsed.  When you leave
your constructor, only the topmost tree node has been constructed.  The node
I want to drill down to isn't created until you click on a junction link.

I could have designed this where the application has only one URL and only
the right-hand panel changes as you click through AjaxLinks -- and I had
that working with a minimum of trouble, but then I learned I have a
requirement that each "view" of the system -- i.e., where the right-hand
panel shows different content -- must correspond to a bookmarkable link. 
This requirement also eliminates the option of using frames wherein the
navigation tree stays the same and the part that's supposed to change, the
right-hand panel, is the target of the links.

So how do I open up my tree when I get to the new page?

Thanks for your help.


-- 
View this message in context: 
http://www.nabble.com/Setting-TreeState-in-new-page-tp21996538p21996538.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org