Thanks a lot, Edvin.

I will try your answers to 2. and 3..

But I think, that overwriting the populateTreeItem method wouldn't help,
because i want to modify nodes of an existing tree, for example mark them
red if I click on them.

Any suggestions?

2008/8/26 Edvin Syse <[EMAIL PROTECTED]>

> Kai Schubert-Altmann skrev:
>
>> Hi everybody,
>>
>> I have some question regarding my existing wicket tree:
>>
>> 1. How can I change the style or css class of one or more TreeNodes?
>>
>
> If you override the populateTreeItem() method, you can add an
> AbstractBehaviour to the item and override the onComponentTag method. From
> there you can do tag.put("class", "yourValue").
>
>  2. How can I specify custom icons for some nodes?
>>
>
> Override the getNodeIcon() method of the tree.
>
>  3. How can i change the name, that will be shown in the tree, without
>> changing the name of the userObject?
>>
>
> I guess the simple solution would be to provide a toString() method on
> your userObject that returns the desired value :)
>
> Alternatively you could override the renderNode method of the Tree, which
> by default does:
>
>        protected String renderNode(TreeNode node)
>        {
>                return node.toString();
>        }
>
>
> Just get your userObject from the node and return the string you want from
> there :)
>
> -- Edvin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to