On Tue, 2006-11-28 at 21:24 -0800, Eelco Hillenius wrote:
> I've got around the fact that I can't do multiple inheritance to
> combine a component that is both a panel and a form component (or at
> least acts as one) in many ways now, but I really think we need to
> have a ready-to-use component for this now.
> 
> This would be the simplified version:
> 
> public class FormComponentPanel extends FormComponent {
> 
>       private boolean wasOpenCloseTag = false;
> 
>       public FormComponentPanel(String id) {
>               super(id);
>               // ensure class is loaded and tags are registered
>               Class c = Panel.class;
>       }
> 
>       public FormComponentPanel(String id, IModel model) {
>               super(id, model);
>       }
> 
>       @Override
>       protected void onComponentTag(final ComponentTag tag) {
>               if (tag.isOpenClose()) {
>                       this.wasOpenCloseTag = true;
>                       tag.setType(XmlTag.OPEN);
>               }
>               super.onComponentTag(tag);
>       }
> 
>       @Override
>       protected void onComponentTagBody(final MarkupStream markupStream,
> final ComponentTag openTag) {
>               renderAssociatedMarkup("panel", "Markup for a panel component 
> has to
> contain part '<wicket:panel>'");
> 
>               if (this.wasOpenCloseTag == false) {
>                       markupStream.skipRawMarkup();
>               }
>       }
> }
> 
> But that missed the <wicket:head> stuff that is in
> WebMarkupContainerWithAssociatedMarkup.
> 
> Anyone (Juergen?) suggestions on how to create such a component
> without ending up with a lot of duplicated code? Or maybe now is the
> time to extract a IFormComponent interface or a bunch of form related
> interfaces?

+1. We need this functionality too:
http://www.mail-archive.com/wicket-user%
40lists.sourceforge.net/msg18646.html

There's already IFormProcessingListener interface in wicket 2 which can
be used to intercept traversal of child components.
http://mail-archives.apache.org/mod_mbox/incubator-wicket-dev/200610.mbox/[EMAIL
 PROTECTED]

Joni



Reply via email to