Hi Janning,

That's definately better then exposing the form, but it still makes me have
to insert an extra methodcall everywhere I update the modelobject. Here's
what I implemented a couple of seconds ago and it seems to be doing what I
wanted just fine, and no listener needed either.

Instead of:
Form detailForm = new Form("detailForm", model);

I do:
Form detailForm = new Form("detailForm");
IModel wrappingModel = new Model(model) {
            private Object previousModelObject = null;

            @Override
            public Object getObject() {
                if (previousModelObject != super.getObject()) {
                    detailForm.modelChanged();
                    previousModelObject = super.getObject();
                }
                return super.getObject();
            }
        };
}
detailForm.setModel(wrappingModel);


2010/1/5 Janning Vygen <[email protected]>

>
> your "master" knows about your "detail" panel. so why don't you call
> detail.modelChanged();
>
> and in your DetailPanel:
>
> onModelChanged() {
>  form.modelChanged(); // or whatever is needed...
>  form.clearInput();
>  super.onModelChanged()
> }
>
> Your form is still managed by your detail panel only.
>
> kind regards
> Janning
>
> On Tuesday 05 January 2010 11:03:59 Stijn Maller wrote:
> > Thanks Martin,
> >
> > You're right, a Model that calls ModelObjectChangedListener is basically
> > what I am looking for, but I don't think it exists. I'll write one
> myself,
> > but I just wanted to check first to make sure I wasn't reinventing the
> > wheel or missing something obvious.
> >
> > Kind regards,
> > Stijn
> >
> >
> > 2010/1/4 Martin Makundi <[email protected]>
> >
> > > Hi!
> > >
> > > clearinput is right.  don't know if there is a IModel that has change
> > > listener, but sure you can make your own that detects when the master
> >
> > changes. You need to repaint the components anyways
> >
> > > (target.addComponents), so why not clear input at the same time?
> > >
> > > **
> > > Martin
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to