You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Erik Johansson <ej...@suss.no> on 2011/03/11 17:37:37 UTC

wicket-tree implementation

Hello.

I am trying out wicket-tree, by Sven Maier. However I can't figure out  what
is needed to get it to display the tree properly.

 

It shows the content as its toString method. I have overridden it at the
ITreeProvider.model-method, but that isn't it, it seems. The original
object's toString() is not at all appropriate in the tree.

 

Where should I do the override in this case?

 

I am using Wicket 1.4.15 and wicket-tree 0.4.1

 

 

Erik Johansson

 


Re: wicket-tree implementation

Posted by Sven Meier <sv...@meiers.net>.
Hi Erik,

wicket-tree doesn't cache any information (in contrast to Wicket's tree 
implementation).

Thus updating the parental branch or adding the whole tree to the 
request target should work fine, the former method might fail if your 
equals() method is bogus though.

Please set a breakpoint on your provider's getChildren() method to check 
when it is called.

Hope this helps

Sven


On 03/14/2011 09:48 AM, Erik Johansson wrote:
> Thanks, that worked well.
> I am wondering how to update the tree when I add an object to it. I have
> tried with
>
> tree.updateBranch(newObject, target);
> or
> tree.updateBranch(newObject.getParent(), target);
> or
> target.addComponent(tree);
>
> but nothing happens. I haven't done anything in the ITreeProvider's
> detach(), perhaps I need to do something there?
> Editing existing objects works well, but not new objects.
>
> Thanks,
> Erik Johansson
>

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


RE: wicket-tree implementation

Posted by Erik Johansson <ej...@suss.no>.
Thanks, that worked well.
I am wondering how to update the tree when I add an object to it. I have
tried with

tree.updateBranch(newObject, target);
or
tree.updateBranch(newObject.getParent(), target);
or
target.addComponent(tree);

but nothing happens. I haven't done anything in the ITreeProvider's
detach(), perhaps I need to do something there?
Editing existing objects works well, but not new objects.

Thanks,
Erik Johansson

-----Original Message-----
From: Sven Meier [mailto:sven@meiers.net] 
Sent: 11. mars 2011 18:57
To: users@wicket.apache.org
Subject: Re: wicket-tree implementation

Hi Erik,

you can override a factory method in a tree subclass:

             @Override
             protected Component newContentComponent(String id, 
IModel<Foo> model)
             {
                 return new Folder<Foo>(id, this, model) {
                     protected IModel<?> newLabelModel(IModel<Foo> model)
                     {
                         // decide how to render each foo, e.g. use a 
property model
                         return new PropertyModel<String>(model, "bar");
                     }
                 };
             }

Have fun

Sven

On 03/11/2011 05:37 PM, Erik Johansson wrote:
> Hello.
>
> I am trying out wicket-tree, by Sven Maier. However I can't figure out
what
> is needed to get it to display the tree properly.
>
> It shows the content as its toString method. I have overridden it at the
> ITreeProvider.model-method, but that isn't it, it seems. The original
> object's toString() is not at all appropriate in the tree.
>
> Where should I do the override in this case?
>
> I am using Wicket 1.4.15 and wicket-tree 0.4.1
>
> Erik Johansson

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


__________ Information from ESET Smart Security, version of virus signature
database 5950 (20110313) __________

The message was checked by ESET Smart Security.

http://www.eset.com


 

__________ Information from ESET Smart Security, version of virus signature
database 5950 (20110313) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 


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


Re: wicket-tree implementation

Posted by Sven Meier <sv...@meiers.net>.
Hi Erik,

you can override a factory method in a tree subclass:

             @Override
             protected Component newContentComponent(String id, 
IModel<Foo> model)
             {
                 return new Folder<Foo>(id, this, model) {
                     protected IModel<?> newLabelModel(IModel<Foo> model)
                     {
                         // decide how to render each foo, e.g. use a 
property model
                         return new PropertyModel<String>(model, "bar");
                     }
                 };
             }

Have fun

Sven

On 03/11/2011 05:37 PM, Erik Johansson wrote:
> Hello.
>
> I am trying out wicket-tree, by Sven Maier. However I can't figure out  what
> is needed to get it to display the tree properly.
>
> It shows the content as its toString method. I have overridden it at the
> ITreeProvider.model-method, but that isn't it, it seems. The original
> object's toString() is not at all appropriate in the tree.
>
> Where should I do the override in this case?
>
> I am using Wicket 1.4.15 and wicket-tree 0.4.1
>
> Erik Johansson

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