Implemented for 1.3 (see
http://issues.apache.org/jira/browse/WICKET-169), and added a simple
example that shows this to wicket-examples of that branch (in
FormInput, component Multiply).
Tbd for 2.0 (http://issues.apache.org/jira/browse/WICKET-170) would be
very grateful if someone else could pick that up.
Cheers,
Eelco
On 11/28/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