You are wrong. I have a component (Panel) that has a method to return a
Fragment. This component returns a default implementation of that Fragment,
but pages can override that Fragment.

CRUDFormPanel extends Panel {
    protected Fragment newFormFields(String id, Form form) {
        if (property == null)
            return null;

        Fragment f = new Fragment(id, "defaultFormFields",
ListFormPanel.this);
        RequiredTextField desc = new RequiredTextField("property",
                new PropertyModel(form.getModel(), property));
        desc.add(StringValidator.maximumLength(255));

        f.add(desc);
        f.add(new Label("propertyLabel", getString("propertyLabel")));

        form.add(new ObjectExistanceValidator(service, desc, property));

        return f;
    }

    .... // more code
}

Pages that want to have more fields in this form, can provide another
Fragment.

MyCustomPage extends WebPage {
    MyCustomPage() {
      add(new CRUDFormPanel("panel") {
    protected Fragment newFormFields(String id, Form form) {
            Fragment f = new Fragment(id, "customFormFields",
MyCustomPage.this);

            RequiredTextField field = new
RequiredTextField("anotherProperty",
                new PropertyModel(form.getModel(), "anotherProperty"));
            desc.add(StringValidator.maximumLength(50));

            f.add(field);

            form.add(new ObjectExistanceValidator(service, desc, property));

            return f;
        }
      });
    }
}

This is how I override tags with vanilla Wicket. Do we really need another
markup?!

On Nov 7, 2007 4:51 PM, Chris Colman <[EMAIL PROTECTED]> wrote:

> > a lot of people are saying that this can be implemented with panels,
> > and that is true. but actually implementing this with fragments will
> > make it look very similar to this new strategy and does not have the
> > id collission problem, because components ARE nested in two different
> > containers:
>
> I've never used fragments but I just read up on them...
>
> I may be wrong but it looks as if you have to define all possible
> fragments that might appear in a page to that page. It doesn't seem to
> follow the natural, organic flow of markup inheritance where a base page
> can be enhanced by substituting base a page section with markup defined
> in derived/extended pages - that only happens with the child/extends
> feature from my understanding.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Bruno Borges
blog.brunoborges.com.br
+55 1185657739

"The glory of great men should always be
measured by the means they have used to
acquire it."
- Francois de La Rochefoucauld

Reply via email to