Re: N-level CompoundPropertyModel

2009-02-16 Thread Johan Compagner
hmm i woulnt recommend callign setModel() after the model is already used Why not just set the object of the model? I think that is nice anyway. But i guess it shouldnt be needed in the end what you really want is that an inbetween component does get used for generating the lookup key for the CPM

Re: N-level CompoundPropertyModel

2009-02-16 Thread Willis Blackburn
Johan, I had a similar idea, except that I used PropertyModel (which is what CompoundPropertyModel.bind does anyway). The issue that I had with this one is that every component exposes a setModel method, so I always wonder how my components will behave if someone calls it. In this case,

Re: N-level CompoundPropertyModel

2009-02-16 Thread Johan Compagner
do it then a bit different public class BigPage { public BigPage(BigObject object) { CompoundPropertyModel model = new CompoundPropertyModel(object) setModel(model) add(new SmallComponent("smallObject", model.bind("smallObject.name")); } } public class SmallComponent { public Sm

Re: N-level CompoundPropertyModel

2009-02-16 Thread Willis Blackburn
Johan, The below solution requires that SmallComponent know it's parent has CompoundPropertyModel and that there is a member called "smallObject." I'm trying to keep SmallComponent generic, like the Wicket built-in components. W On Feb 16, 2009, at 2:46 PM, Johan Compagner wrote: yes

Re: N-level CompoundPropertyModel

2009-02-16 Thread Johan Compagner
yes initmodel shouldnt call getModel() on the parent because that was a big performance penalty on some solutions because that would create and walk over the complete hierarchy of things and then many many in between models are created, that dont do really anything. But why not something like this

Re: N-level CompoundPropertyModel

2009-02-15 Thread Igor Vaynberg
hrm, looks like johan changed it here 526472 4/7/07 12:13 PM 3 jcompagner component initModel will not call getModel on the parent, but will directly use the field (so that not all kinds of inbetween models are created) if model is an iwrapmodel and the wrapped modes is an inherited o

Re: N-level CompoundPropertyModel

2009-02-15 Thread Christopher Armstrong
Hi Willis The quickest solution to this one I've found is to use a normal PropertyModel, which doesn't seem to drill down through the nested models. In your case public class BigPage { public BigPage(BigObject object) { setModel(new CompoundPropertyModel(object))

Re: N-level CompoundPropertyModel

2009-02-15 Thread Willis Blackburn
Igor, Are you sure that will work? I don't think that SmallComponent's initModel method is ever called, because when the Label that is part of SmallComponent is searching for a model (in Component.initModel), it invokes the getModelImpl method of SmallComponent, which doesn't call initMo

Re: N-level CompoundPropertyModel

2009-02-15 Thread Willis Blackburn
- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- View this message in context: http://www.nabble.com/N-level-CompoundPropertyModel-tp

Re: N-level CompoundPropertyModel

2009-02-15 Thread Igor Vaynberg
public class smallcomponent extends component { protected imodel initmodel() { imodel model=super.initmodel(); return new compoundpropertymodel(model); } } -igor On Sun, Feb 15, 2009 at 8:19 AM, Willis Blackburn wrote: > Hello, > > I have a situation that keeps coming up. All o

Re: N-level CompoundPropertyModel

2009-02-15 Thread jcgarciam
ent constructor fixed the problem, but I'm > not sure if I can just call wrap and carry on or if there will be some > unforeseen consequence of that down the road. Is there a standard way > of doing this? > > Thanks, > Willis > > > -----

N-level CompoundPropertyModel

2009-02-15 Thread Willis Blackburn
Hello, I have a situation that keeps coming up. All of my solutions have seemed clumsy, which makes me think that there's a better way of approaching this that I just haven't figured out. Can someone point me in the right direction? What I want is to have a Page that uses CompoundProper