Take a look at https://cwiki.apache.org/WICKET/working-with-wicket-models.html
Okay so Account is the type of the model object and your FormComponentPanel
seem to work off a CustomerAccountCodeModel:
>> CustomerAccountCodeModel ccc = getModelObject();
If I'm understanding this right, what does your CustomerAccountCodeModel's
getObject() and setObject() do?
I would switch to a CompundPropertyModel and I would leave the models null for
the form fields. This way you won't need any your own implementation of
onModelChange().
~ Thank you,
Paul Bors
On Dec 4, 2012, at 1:48 PM, Joachim Schrod <[email protected]> wrote:
> Raul wrote:
>> Thank Col, But I have no validation, my component code is the code of the
>> component is
>>
>> public class CustomerAccountCode extends
>> FormComponentPanel<Account> {
>>
>> private FormComponent<String> entity;
>> private FormComponent<String> office;
>> private FormComponent<String> dc;
>> private FormComponent<String> number;
>>
>>
>> public CustomerAccountCode(String id, Model<Account> model) {
>> super(id, model);
>>
>> entity = new TextField<String>("entity", new Model<String>());
>> office = new TextField<String>("office", new Model<String>());
>> dc = new TextField<String>("dc", new Model<String>());
>> number = new TextField<String>("number", new Model<String>());
>>
>> onModelChanged();
>> add(entity);
>> add(office);
>> add(dc);
>> add(number);
>> // add(CustomerAccountCodeValidator.getInstance());
>>
>> }
>>
>> protected void onModelChanged() {
>> super.onModelChanged();
>> CustomerAccountCodeModel ccc = getModelObject();
>> if (ccc != null) {
>> entity.setModelObject(ccc.getEntity());
>> office.setModelObject(ccc.getOffice());
>> dc.setModelObject(ccc.getDc());
>> number.setModelObject(ccc.getAccount());
>> } else {
>> entity.setModelObject(null);
>> office.setModelObject(null);
>> dc.setModelObject(null);
>> number.setModelObject(null);
>> }
>> }
>
> Did you try to use PropertyModels of your account object, maybe a
> CompoundPropertyModel instead of setting the TextField's model
> objects in the constructor that way?
>
> Joachim
>
> --
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> Joachim Schrod, Roedermark, Germany
> Email: [email protected]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>