Nicolai Dymosz wrote:
> 
> Hi All,
> 
> i built a tree (wicket.extension.markup.html.tree.Tree). The tree works
> fine. But now i want to use the tree for navigation. 
> 
> I just found examples to build a tree, but i didn`t find some examples to
> use the tree for navigation.
> 
> Can anyone give me further information in how to make tree links
> bookmarkabel?
> 
> Regards Nico
> 

I have the same question, and I'd like to add to it by asking how to keep
the tree expanded, rather than collapsing every time a node is clicked?
Here's how I did it, but I suspect there are better ways:

I built the tree starting from the example in the extensions (although I
used wicket.extension.markup.html.tree.Tree, not the Ajax version):

private TreeModel createTreeModel()
{
DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode(
                                new ModelBean("MyNode", MyPage.class));

// My model bean stores the page class to which I want to navigate.

rootNode .add(new DefaultMutableTreeNode(new ModelBean("MyNode2",
                                MyPage2.class)));
...
TreeModel model = new DefaultTreeModel(rootNode);
return model;
}

public MyBasePage()
{
Tree tree = new Tree("tree", createTreeModel())
{
        @Override
        protected void nodeLinkClicked(DefaultMutableTreeNode arg0)
        {
                super.nodeLinkClicked(arg0);
                ModelBean bean = (ModelBean) arg0.getUserObject();
                if (bean.getLinkClass() != null)
                {
                       
MyBasePage.this.setResponsePage(bean.getLinkClass());
                }
                this.expandAll(true); // I want the tree to stay
expanded...is this the best way?
                }
        };
        tree.expandAll(true);
        add(tree);
} 

-- 
View this message in context: 
http://www.nabble.com/Tree-for-navigation-tf3524348.html#a9859828
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to