You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Pascal Heus <pa...@gmail.com> on 2012/11/28 06:47:22 UTC

DefaultNestedTree Folder label

I have a  DefaultNestedTree<CatalogItemType> tree. The CatalogItemType
is actually an Apache XmlBeans object that contains XML. By default, the
tree node labels then show the XML contant as this is I assumed what is
return by toString() method on the object.
What do I need to change/extend to get control of the Folder object
displayed label?  Is there a method I need to override in the underlying
model?
Also tried to use a NestedTree but same issue (how do I change the
Folder label?)
thanks
*P

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


Re: DefaultNestedTree Folder label

Posted by Sven Meier <sv...@meiers.net>.
Create your specialized content component:

     public class CatalogFolder extends Folder<CatalogFolder> {
             ...

             protected IModel<?> newLabelModel(IModel<CatalogFolder> model)
             {
                 return new PropertyModel<String>(model, "displayProperty");
             }
     }

... and return it in your overridden AbstractTree#newContentComponent():

     @Override
     protected Component newContentComponent(String id, 
IModel<CatalogItemType > node)
     {
         return new CatalogFolder(id, this, node);
     }

Sven

On 11/28/2012 06:47 AM, Pascal Heus wrote:
> I have a  DefaultNestedTree<CatalogItemType> tree. The CatalogItemType
> is actually an Apache XmlBeans object that contains XML. By default, the
> tree node labels then show the XML contant as this is I assumed what is
> return by toString() method on the object.
> What do I need to change/extend to get control of the Folder object
> displayed label?  Is there a method I need to override in the underlying
> model?
> Also tried to use a NestedTree but same issue (how do I change the
> Folder label?)
> thanks
> *P
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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