if you disable a formcomponent then neither a set or get will be called

-igor


On 3/12/07, David Leangen <[EMAIL PROTECTED]> wrote:


Sorry for pulling you guys back to my mail issue. ;-)

Since setObject() is not being called, I don't see how to apply my
complex model to its children. I thought I could pull this off with
setModel()... but it just ain't being called.


Ok, let's stick with the "person" object. The person has attributes, and
one of these attributes may itself have attributes.

For example:

  Person:
    isSingle?

        if( isSingle )

          [ ] does dishes?
          [ ] makes bed?

        else

          [ ] has kids?
          [ ] walks dog?

Whatever.

Point is, if the isSingle attribute is "true", I want to enable certain
checkboxes and bind those values DIRECTLY to the model. Same goes if
isSingle is false.

Right now, I collect a boolean for each value and set them back
"manually" into my model, which seems really messy.

Same thing for enabling/disabling my checkboxes above: I do that
"manually" depending on the current value in the model.


What I'd really like to do is somehow bind all those controls directly
to my model so I'm not duplicating parts of the model for each control.


Any hints that would enlighten me on how to do this?


Thanks so much!!



On Mon, 2007-03-12 at 22:58 -0700, Eelco Hillenius wrote:
> Maybe it is good to gather a couple of use cases and pros and cons and
> start a separate thread?
>
> Eelco
>
> On 3/12/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> > ah, but if you modify a collection that is a model object are you
infact
> > "changing" the object? you are not changing the reference itself but
you are
> > doing something that has sideffects.
> >
> > eg lets say you have a dropdown choice, but what you want is a
collection of
> > ids not the objects. the easiest way is to have a model in between
that
> > translates a collection of objects to ids and back again. but how to
do that
> > if setobject() is never called?
> >
> > -igor
> >
> >
> >
> > On 3/12/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
> > >
> > > If you are not changing the object that is the subject of the model,
I
> > > see no reason why setObject should be called.
> > >
> > > Eelco
> > >
> > > On 3/12/07, Igor Vaynberg <[EMAIL PROTECTED] > wrote:
> > > > actually we are inconsistent in some places and i have been trying
to
> > fix
> > > > it. what we mostly do is whenever we work with a collection we
clear it
> > and
> > > > repopulate it. but we never call setobject() on the model which
imho is
> > > > wrong. sometimes i have a model in between that depends on
setobject()
> > > > called whenever a property is updated because it does some
translation
> > and
> > > > its a lot easier to proxy a model then it is to proxy a
collection. just
> > my
> > > > 2c.
> > > >
> > > > -igor
> > > >
> > > >
> > > >
> > > > On 3/12/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > > > > > now all you have to do is
> > > > > > > >
> > > > > > > > LoadableDetachableModel person=new
LoadalbeDetachableModel(id);
> > > > > > > > new CheckBox(this, "cb", new PersonCheckBoxModel(person));
> > > > > > > >
> > > > > > > > and everything magically works, hope it gives you some
ideas.
> > > > > >
> > > > > > Yes, it does indeed give me many ideas. Right now, I'm trying
to
> > figure
> > > > > > out the implementation details.
> > > > > >
> > > > > > While stepping through the code, I noticed that the
setObject()
> > method
> > > > > > of my IModel never gets called.
> > > > > >
> > > > > > When is this _supposed_ to be set, and why would it not be
called in
> > my
> > > > > > case?
> > > > >
> > > > > There's not always a need for setObject to be called. I haven't
read
> > > > > the whole thread, but in the above example, you work on a
property
> > > > > ('cb') of the person, so all you have to do (probably) is do
something
> > > > > with this updated object (like saving it). You would only do
setObject
> > > > > when you would provide a new person, and when the getObject
> > > > > implementation wouldn't take care of that.
> > > > >
> > > > > Personally, I rarely use/ depend on setObject as working with
> > > > > properties of objects is a very typical thing to do.
> > > > >
> > > > > Hope this makes sense,
> > > > >
> > > > > 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.php&p=sourceforge&CID=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.php&p=sourceforge&CID=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.php&p=sourceforge&CID=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.php&p=sourceforge&CID=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.php&p=sourceforge&CID=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.php&p=sourceforge&CID=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.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to