Re: [Wicket-user] Form macro-component
Mhh, this approach is giving me a headache. Sometimes the inner formcomponent models are not wrapped around the outer formcomponent compound model returned by the overridden getModel(), but directly around the parent model instead (which is also a compound one). It's as if the model is accessed directly from its field instead of via the overridden property. Can I reliably assume that getModel() is overridable? Otherwise I should do something in the venue of: public DateComponent(String id, IModel model) { super(id, model == null ? model : new CompoundPropertyModel(model)); } protected IModel initModel() { return new CompoundPropertyModel(new PropertyModel(getParent().getModel(), getId())); } TIA. Cheers, Carlos On 4/11/07, Carlos Pita [EMAIL PROTECTED] wrote: I worked out this easier and cleanse way to wrap the model of the outer component: public DateComponent(String id) { this(id, null); } public DateComponent(String id, IModel model) { super(id, model); } public IModel getModel() { return new CompoundPropertyModel(super.getModel()); } protected IModel initModel() { return new PropertyModel(getParent().getModel(), getId()); } Namely, initModel and getModel work in tandem. If model is initialized with null, initModel() will lazy-initialize it as the parent's model evaluated in the DateComponent id. In any case (model null initialized or not) getModel will wrap the resultant model into a CompoundPropertyModel. So inside DateComponent you could create, say, a year field simply as new TextField(year). Cheers, Carlos On 4/10/07, Igor Vaynberg [EMAIL PROTECTED] wrote: looks good without actually running the code :) -igor On 4/9/07, Carlos Pita [EMAIL PROTECTED] wrote: Well, here is what I've done based on your suggestions. Please review this and tell me if it can be improved, if you are so kind: 1) An inherited model that looks into the passed model. If it's not null it returns a propertymodel for the component id a la CompoundPropertyModel. If it's null it returns a propertymodel for the parent's model with the full path of the component. So inside my panel I can add form components as add(new TextField(month, Integer.class)) independently of the model passed (null or a real date) private class MyModel extends Model implements IComponentInheritedModel { public IWrapModel wrapOnInheritance(Component component) { final IModel wrappedModel; if (model == null) { IModel parentModel = DatePanel.this.getParent().getModel(); String path = DatePanel.this.getParent().getId() + . + component.getId(); wrappedModel = new PropertyModel(parentModel, path); } else { wrappedModel = new PropertyModel(model, component.getId()); } return new AbstractWrapModel() { public IModel getWrappedModel() { return wrappedModel; } }; } } 2) To have control on when children are really validated and their models updated: public boolean processChildren() { return false; } 3) A DatePanel validator that first validate its fields (so they are converted too) and finally do global validation (validateDate()). Note that individual validators can do global validation do, depending on whether the validation was ajax-triggered or not, so validateDate() will occur depending on the value of the validateDate flag (true for ajax-validation, false for individual validators during submit validation). Notice that validateOnNullValue() must return true or this validator won't be invoked. add(new AbstractValidator() { protected void onValidate(IValidatable validatable) { validateDate = false; yearField.validate(); monthField.validate (); dayField.validate(); validateDate = true; if (!(yearField.hasErrorMessage() || monthField.hasErrorMessage() || dayField.hasErrorMessage())) { validateDate(); } } public boolean validateOnNullValue() { return true; } }); 4) updateModel. Just delegate to fields. public void updateModel() { dayField.updateModel(); monthField.updateModel(); yearField.updateModel(); } Thank you in advance. Best regards, Carlos - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash
Re: [Wicket-user] Form macro-component
I worked out this easier and cleanse way to wrap the model of the outer component: public DateComponent(String id) { this(id, null); } public DateComponent(String id, IModel model) { super(id, model); } public IModel getModel() { return new CompoundPropertyModel(super.getModel()); } protected IModel initModel() { return new PropertyModel(getParent().getModel(), getId()); } Namely, initModel and getModel work in tandem. If model is initialized with null, initModel() will lazy-initialize it as the parent's model evaluated in the DateComponent id. In any case (model null initialized or not) getModel will wrap the resultant model into a CompoundPropertyModel. So inside DateComponent you could create, say, a year field simply as new TextField(year). Cheers, Carlos On 4/10/07, Igor Vaynberg [EMAIL PROTECTED] wrote: looks good without actually running the code :) -igor On 4/9/07, Carlos Pita [EMAIL PROTECTED] wrote: Well, here is what I've done based on your suggestions. Please review this and tell me if it can be improved, if you are so kind: 1) An inherited model that looks into the passed model. If it's not null it returns a propertymodel for the component id a la CompoundPropertyModel. If it's null it returns a propertymodel for the parent's model with the full path of the component. So inside my panel I can add form components as add(new TextField(month, Integer.class)) independently of the model passed (null or a real date) private class MyModel extends Model implements IComponentInheritedModel { public IWrapModel wrapOnInheritance(Component component) { final IModel wrappedModel; if (model == null) { IModel parentModel = DatePanel.this.getParent().getModel(); String path = DatePanel.this.getParent().getId() + . + component.getId(); wrappedModel = new PropertyModel(parentModel, path); } else { wrappedModel = new PropertyModel(model, component.getId()); } return new AbstractWrapModel() { public IModel getWrappedModel() { return wrappedModel; } }; } } 2) To have control on when children are really validated and their models updated: public boolean processChildren() { return false; } 3) A DatePanel validator that first validate its fields (so they are converted too) and finally do global validation (validateDate()). Note that individual validators can do global validation do, depending on whether the validation was ajax-triggered or not, so validateDate() will occur depending on the value of the validateDate flag (true for ajax-validation, false for individual validators during submit validation). Notice that validateOnNullValue() must return true or this validator won't be invoked. add(new AbstractValidator() { protected void onValidate(IValidatable validatable) { validateDate = false; yearField.validate(); monthField.validate (); dayField.validate(); validateDate = true; if (!(yearField.hasErrorMessage() || monthField.hasErrorMessage() || dayField.hasErrorMessage())) { validateDate(); } } public boolean validateOnNullValue() { return true; } }); 4) updateModel. Just delegate to fields. public void updateModel() { dayField.updateModel(); monthField.updateModel(); yearField.updateModel(); } Thank you in advance. Best regards, Carlos - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join
Re: [Wicket-user] Form macro-component
there is a FormComponentPanel that can embed other form components, and act as a formcomponent itself. and actually wicket does support embedded forms. -igor On 4/9/07, Carlos Pita [EMAIL PROTECTED] wrote: Hi all, suppose you have to implement some form input component that is composed from other simple FormComponents. These simple input fields will be ajax-validated individually, and they will be subject to some global (inter-field) validation too. An example could be three drop-downs for a date, with local validation requiring each field and global validation asking for a valid Gregorian calendar date. AFAIK there are nothing like nested forms in wicket, you have a form and then at the next level its FormComponents and that's all. So I tend to think of a static helper method that instantiates the individual form fields and registers them with the form. Maybe there must be some synthetic invisible component just to attach feedback from the date global-validation, which will be implemented as a form validator. For example: class MyForm extends Form { public MyForm(String id) { DateComponent.add(this, birthDate); } } select wicket:id=birthDate.day/ span wicket:id=birthDate.day.feedback/span select wicket:id=birthDate.month/ span wicket:id=birthDate.month.feedback/span select wicket:id=birthDate.year/ span wicket:id=birthDate.year.feedback/span span wicket:id=birthDate/span !-- dummy component -- span wicket:id=birthDate.feedback/span There are two things in this approach that I don't particularly like: 1) Having a dummy component to attach date global-validation errors (notice that they are not the same as form errors). 2) The procedural nature of the solution, there is no real Date component. What do you think? Do you have a better alternative that is not too convolved? Best regards, Carlos - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Form macro-component
there is a FormComponentPanel that can embed other form components, and act Great! Btw, is there something more like a border or fragment, to inline the markup? as a formcomponent itself. and actually wicket does support embedded forms. Can you expand on this? Will nested forms be validated and bound before their containers? Cheers, Carlos -igor On 4/9/07, Carlos Pita [EMAIL PROTECTED] wrote: Hi all, suppose you have to implement some form input component that is composed from other simple FormComponents. These simple input fields will be ajax-validated individually, and they will be subject to some global (inter-field) validation too. An example could be three drop-downs for a date, with local validation requiring each field and global validation asking for a valid Gregorian calendar date. AFAIK there are nothing like nested forms in wicket, you have a form and then at the next level its FormComponents and that's all. So I tend to think of a static helper method that instantiates the individual form fields and registers them with the form. Maybe there must be some synthetic invisible component just to attach feedback from the date global-validation, which will be implemented as a form validator. For example: class MyForm extends Form { public MyForm(String id) { DateComponent.add(this, birthDate); } } select wicket:id=birthDate.day/ span wicket:id=birthDate.day.feedback/span select wicket:id=birthDate.month/ span wicket:id=birthDate.month.feedback/span select wicket:id=birthDate.year/ span wicket:id= birthDate.year.feedback/span span wicket:id=birthDate/span !-- dummy component -- span wicket:id=birthDate.feedback/span There are two things in this approach that I don't particularly like: 1) Having a dummy component to attach date global-validation errors (notice that they are not the same as form errors). 2) The procedural nature of the solution, there is no real Date component. What do you think? Do you have a better alternative that is not too convolved? Best regards, Carlos - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Form macro-component
as a formcomponent itself. and actually wicket does support embedded forms. Can you expand on this? Will nested forms be validated and bound before their containers? Look at wicket.examples.forminput.Multiply and wicket.extensions.yui.calendar.(Date)TimeField for examples. Eelco - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Form macro-component
When nested form is submitted, the form components in surrounding models are given the user input, but they are not processed. So the input is persisted during request, but not validated and processed. The inner (nested) form, that is submitted is both validated and if validation succeeds, the models are updated. -Matej On 4/9/07, Carlos Pita [EMAIL PROTECTED] wrote: there is a FormComponentPanel that can embed other form components, and act Great! Btw, is there something more like a border or fragment, to inline the markup? as a formcomponent itself. and actually wicket does support embedded forms. Can you expand on this? Will nested forms be validated and bound before their containers? Cheers, Carlos -igor On 4/9/07, Carlos Pita [EMAIL PROTECTED] wrote: Hi all, suppose you have to implement some form input component that is composed from other simple FormComponents. These simple input fields will be ajax-validated individually, and they will be subject to some global (inter-field) validation too. An example could be three drop-downs for a date, with local validation requiring each field and global validation asking for a valid Gregorian calendar date. AFAIK there are nothing like nested forms in wicket, you have a form and then at the next level its FormComponents and that's all. So I tend to think of a static helper method that instantiates the individual form fields and registers them with the form. Maybe there must be some synthetic invisible component just to attach feedback from the date global-validation, which will be implemented as a form validator. For example: class MyForm extends Form { public MyForm(String id) { DateComponent.add(this, birthDate); } } select wicket:id=birthDate.day/ span wicket:id=birthDate.day.feedback/span select wicket:id=birthDate.month/ span wicket:id=birthDate.month.feedback/span select wicket:id=birthDate.year/ span wicket:id= birthDate.year.feedback/span span wicket:id=birthDate/span !-- dummy component -- span wicket:id=birthDate.feedback/span There are two things in this approach that I don't particularly like: 1) Having a dummy component to attach date global-validation errors (notice that they are not the same as form errors). 2) The procedural nature of the solution, there is no real Date component. What do you think? Do you have a better alternative that is not too convolved? Best regards, Carlos - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Form macro-component
Hi Eelco, I've looked at the examples. There are a couple of things that still troubles me: 1) How can I use a compound property model without naming the nested form components with their full path (ie. 'birthDate.year' instead of simply 'year'). 2) If I add a validator to the form component panel (for panel level validation), can I assume that the nested component models will be already bound when the validator is triggered, or at least that getConvertedInput() will work on them? Thank you. Cheers, Carlos On 4/9/07, Eelco Hillenius [EMAIL PROTECTED] wrote: as a formcomponent itself. and actually wicket does support embedded forms. Can you expand on this? Will nested forms be validated and bound before their containers? Look at wicket.examples.forminput.Multiply and wicket.extensions.yui.calendar.(Date)TimeField for examples. Eelco - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Form macro-component
1) How can I use a compound property model without naming the nested form components with their full path (ie. 'birthDate.year' instead of simply 'year'). 2) If I add a validator to the form component panel (for panel level validation), can I assume that the nested component models will be already bound when the validator is triggered, or at least that getConvertedInput() will work on them? As you're looking at the date-time components, the answer to both questions is that clients of those components should consider it implementation details. Like FormComponentPanel says, it doesn't typically get any input itself. The nested components really are for recording intermediate input, which is applied to the model of the panel when updateModel is called, and as you can see, the internal state is synchronized in onAttach. I believe you should design such compound components like black boxes, which from a user's perspective behave like normal form components (they work on one model, and you only have to know it's public API). Eelco - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Form macro-component
On 4/9/07, Carlos Pita [EMAIL PROTECTED] wrote: 1) How can I use a compound property model without naming the nested form components with their full path (ie. 'birthDate.year' instead of simply 'year'). use the model luke what is below is some pseudocode, it is not the best way to do this, but it will give you an idea. leave the formcomponentpanel's model null. immediately under it add a webmarkupcontainer with the following model class indentingmodel extends Model implements icomponentinheritedmodel { iwrapmodel wraponinheritance(Component c) { return new PropertyModel(FormComponentPanel.this.getModel(), FormComponentPanel.this.getId()+.+c.getId()); } } add all the children to this webmarkupcontainer instead of directly to the panel. what this model does is any children created without a model will inherit a model that looks up the property that is prefixed with the formcomponentpanel's id. -igor - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Form macro-component
maybe have FormComponentFeedbackBorders for the individual components and then a global feedback panel to catch the general ones (install a filter to ignore reporters that have feedback borders) Carlos Pita-4 wrote: Hi all, suppose you have to implement some form input component that is composed from other simple FormComponents. These simple input fields will be ajax-validated individually, and they will be subject to some global (inter-field) validation too. An example could be three drop-downs for a date, with local validation requiring each field and global validation asking for a valid Gregorian calendar date. AFAIK there are nothing like nested forms in wicket, you have a form and then at the next level its FormComponents and that's all. So I tend to think of a static helper method that instantiates the individual form fields and registers them with the form. Maybe there must be some synthetic invisible component just to attach feedback from the date global-validation, which will be implemented as a form validator. For example: class MyForm extends Form { public MyForm(String id) { DateComponent.add(this, birthDate); } } select wicket:id=birthDate.day/ select wicket:id=birthDate.month/ select wicket:id=birthDate.year/ !-- dummy component -- There are two things in this approach that I don't particularly like: 1) Having a dummy component to attach date global-validation errors (notice that they are not the same as form errors). 2) The procedural nature of the solution, there is no real Date component. What do you think? Do you have a better alternative that is not too convolved? Best regards, Carlos - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- View this message in context: http://www.nabble.com/Form-macro-component-tf3549549.html#a9911009 Sent from the Wicket - User mailing list archive at Nabble.com. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Form macro-component
Well, here is what I've done based on your suggestions. Please review this and tell me if it can be improved, if you are so kind: 1) An inherited model that looks into the passed model. If it's not null it returns a propertymodel for the component id a la CompoundPropertyModel. If it's null it returns a propertymodel for the parent's model with the full path of the component. So inside my panel I can add form components as add(new TextField(month, Integer.class)) independently of the model passed (null or a real date) private class MyModel extends Model implements IComponentInheritedModel { public IWrapModel wrapOnInheritance(Component component) { final IModel wrappedModel; if (model == null) { IModel parentModel = DatePanel.this.getParent().getModel(); String path = DatePanel.this.getParent().getId() + . + component.getId(); wrappedModel = new PropertyModel(parentModel, path); } else { wrappedModel = new PropertyModel(model, component.getId()); } return new AbstractWrapModel() { public IModel getWrappedModel() { return wrappedModel; } }; } } 2) To have control on when children are really validated and their models updated: public boolean processChildren() { return false; } 3) A DatePanel validator that first validate its fields (so they are converted too) and finally do global validation (validateDate()). Note that individual validators can do global validation do, depending on whether the validation was ajax-triggered or not, so validateDate() will occur depending on the value of the validateDate flag (true for ajax-validation, false for individual validators during submit validation). Notice that validateOnNullValue() must return true or this validator won't be invoked. add(new AbstractValidator() { protected void onValidate(IValidatable validatable) { validateDate = false; yearField.validate(); monthField.validate(); dayField.validate(); validateDate = true; if (!(yearField.hasErrorMessage() || monthField.hasErrorMessage() || dayField.hasErrorMessage())) { validateDate(); } } public boolean validateOnNullValue() { return true; } }); 4) updateModel. Just delegate to fields. public void updateModel() { dayField.updateModel(); monthField.updateModel(); yearField.updateModel(); } Thank you in advance. Best regards, Carlos - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Form macro-component
looks good without actually running the code :) -igor On 4/9/07, Carlos Pita [EMAIL PROTECTED] wrote: Well, here is what I've done based on your suggestions. Please review this and tell me if it can be improved, if you are so kind: 1) An inherited model that looks into the passed model. If it's not null it returns a propertymodel for the component id a la CompoundPropertyModel. If it's null it returns a propertymodel for the parent's model with the full path of the component. So inside my panel I can add form components as add(new TextField(month, Integer.class)) independently of the model passed (null or a real date) private class MyModel extends Model implements IComponentInheritedModel { public IWrapModel wrapOnInheritance(Component component) { final IModel wrappedModel; if (model == null) { IModel parentModel = DatePanel.this.getParent ().getModel(); String path = DatePanel.this.getParent().getId() + . + component.getId(); wrappedModel = new PropertyModel(parentModel, path); } else { wrappedModel = new PropertyModel(model, component.getId ()); } return new AbstractWrapModel() { public IModel getWrappedModel() { return wrappedModel; } }; } } 2) To have control on when children are really validated and their models updated: public boolean processChildren() { return false; } 3) A DatePanel validator that first validate its fields (so they are converted too) and finally do global validation (validateDate()). Note that individual validators can do global validation do, depending on whether the validation was ajax-triggered or not, so validateDate() will occur depending on the value of the validateDate flag (true for ajax-validation, false for individual validators during submit validation). Notice that validateOnNullValue() must return true or this validator won't be invoked. add(new AbstractValidator() { protected void onValidate(IValidatable validatable) { validateDate = false; yearField.validate(); monthField.validate(); dayField.validate(); validateDate = true; if (!(yearField.hasErrorMessage() || monthField.hasErrorMessage() || dayField.hasErrorMessage())) { validateDate(); } } public boolean validateOnNullValue() { return true; } }); 4) updateModel. Just delegate to fields. public void updateModel() { dayField.updateModel(); monthField.updateModel(); yearField.updateModel(); } Thank you in advance. Best regards, Carlos - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user