what makes a formcomponent a formcomponent?

If we can extract this info really easy in a interface then that is fine by
me.
But should that interface impl always be a wicket component? Because then
component also must be an interface?

johan


On 11/29/06, Eelco Hillenius <[EMAIL PROTECTED]> 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?

Eelco

Reply via email to