You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Wolfgang <wo...@exedio.com> on 2010/07/28 10:52:16 UTC

Re: Forms in a base class


Jeremy Thomerson-5 wrote:
> 
> you need to be adding the components to the form.  you're currently adding
> them to the page itself.  the component hierarchy is thus broken.  on your
> child page, either do getForm().add(foo) [you'll need to expose a getForm
> method that returns the form from the parent page] or else on your parent
> page (BaseEditPage), setTransparentResolver(true) on the form and add the
> form children to the page then.
> 

It's working but is far from satisfying... It breaks the encapsulation of
the sub-classes (and those of the sub-sub-classes) because they have to know
they can't use add() anymore but have to use some addToForm(). Once you have
a form somewhere in the hierarchy, trouble begins.

Also, you cannot declare the form as a transparent resolver anymore which
means that every component, not only form components, need to use that
special method. I'm currently trying to find a way to avoid changing all the
hundreds of add() calls in my project...
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Forms-in-a-base-class-tp1891692p2304644.html
Sent from the Wicket - User mailing list archive at Nabble.com.

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


Re: Forms in a base class

Posted by Steve Mactaggart <st...@whitesquaresoft.com>.
I have found that you only need to add items directly in the child class to
the form.

We have other panels and components that can be added to each other as you
would normally its just the elements directly inside the sub-class that need
to be added to the form.

Not sure if that helps, or even make sense.

Steve

On Wed, Jul 28, 2010 at 6:52 PM, Wolfgang <wo...@exedio.com>wrote:

>
>
> Jeremy Thomerson-5 wrote:
> >
> > you need to be adding the components to the form.  you're currently
> adding
> > them to the page itself.  the component hierarchy is thus broken.  on
> your
> > child page, either do getForm().add(foo) [you'll need to expose a getForm
> > method that returns the form from the parent page] or else on your parent
> > page (BaseEditPage), setTransparentResolver(true) on the form and add the
> > form children to the page then.
> >
>
> It's working but is far from satisfying... It breaks the encapsulation of
> the sub-classes (and those of the sub-sub-classes) because they have to
> know
> they can't use add() anymore but have to use some addToForm(). Once you
> have
> a form somewhere in the hierarchy, trouble begins.
>
> Also, you cannot declare the form as a transparent resolver anymore which
> means that every component, not only form components, need to use that
> special method. I'm currently trying to find a way to avoid changing all
> the
> hundreds of add() calls in my project...
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Forms-in-a-base-class-tp1891692p2304644.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>