Re: Reusing forms in different contexts

2012-02-22 Thread Bertrand Guay-Paquet
Hi Martin, Thanks for the tip! This is an interesting approach as well. On 22/02/2012 2:49 AM, Martin Grigorov wrote: HI Bertrand, I'm not quite sure whether this is your concern but take a look at org.apache.wicket.markup.html.tree.BaseTree#newLink() It uses LinkType to decide what kind of

Reusing forms in different contexts

2012-02-21 Thread Bertrand Guay-Paquet
Hi, I want to reuse the same form panels in different contexts and would like to know how fellow Wicket users achieve this. The core of the problem is how to let the user of a form panel specify where to navigate when the form is submitted or canceled. There are multiple possibilities for

Re: Reusing forms in different contexts

2012-02-21 Thread Igor Vaynberg
*abstract* class myformpanel extends panel { public myformpanel(string id) { add(new button(save) { onsubmit() { *onsave(model);* });} *protected abstract void onsave(imodel);* } add(new myformpanel(panel) { protected void onsave(imodel) { // do stuff

Re: Reusing forms in different contexts

2012-02-21 Thread Bertrand Guay-Paquet
Thanks Igor. This is actually very close to what I used as my first approach. The problem I had then was that depending on the context in which the panel is used, the component must be one of the following: 1-A Link/Button, like in your code 2-A BookmarkablePageLink 3-An AjaxLink (ajax

Re: Reusing forms in different contexts

2012-02-21 Thread Martin Grigorov
HI Bertrand, I'm not quite sure whether this is your concern but take a look at org.apache.wicket.markup.html.tree.BaseTree#newLink() It uses LinkType to decide what kind of Link to create. You can use the same approach. On Wed, Feb 22, 2012 at 6:12 AM, Bertrand Guay-Paquet