Does your model have getName() , if so why dont you try with that instead of
.toString().

//N

Penn wrote:
> 
> Hi all,
> I am working with wicket tree based on the inmethod tree example.I have
> just 2 level tree with taggroup and tags. I have issue in just displaying
> the name, rather I get a whole object, The code is below 
> 
> protected TreeModel createTreeModel() {
>               TreeModel model = null;
>               final List list = getGenericTagGroupService().getAll();
>               final DefaultMutableTreeNode rootNode = new 
> DefaultMutableTreeNode(new
> ModelBean("ROOT"));
>               add(rootNode, list);
>               model = new DefaultTreeModel(rootNode);
>               return model;
>       }
> 
> private void add(final DefaultMutableTreeNode parent, final List sub) {
> 
>               for (final Iterator i = sub.iterator(); i.hasNext();) {
>                       final TagGroup tg = (TagGroup) i.next();
>                       final DefaultMutableTreeNode child = new 
> DefaultMutableTreeNode(new
> DetachableTagGroupModel(tg.toString()));
>                       parent.add(child);
> 
>                       final List tags = new ArrayList(tg.getTags());
>                       for (final Iterator j = tags.iterator(); j.hasNext();) {
>                               final Tag t = (Tag) j.next();
>                               child.add(new DefaultMutableTreeNode(new
> DetachableTagModel(t.toString())));
> 
>                       }
>               }
> 
>       }
> 
> I get the output like this,
> com.abc.core.model.taggr...@499f7d[name=vertical]             
>         com.abc.core.model....@11f1d25[name=retail]           
>           com.abc.core.model....@1df5c7[name=financial]
>     
> what i need is this,
>   Vertical
>      Retail
>      Financial
> 
> Also how to get back the model object again onClick,
> 
> protected void onNodeLinkClicked(final TreeNode node, final BaseTree
> tree1, final AjaxRequestTarget target) {
>                               super.onNodeLinkClicked(node, tree1, target);
>                       // setResponsePage();
>                       }
> 
> Thanks in advance
> 
> ~Penn
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-resolve-tree-issue--tp21838037p21857978.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]

Reply via email to