something cleaner like:

class MiddlemanPanel extends Panel {
   private transient IModel myModel;

   IModel getModel() {
      if (myModel==null) {
        myModel=new CompoundPropertyModel(new PropertyModel( super.getModel(), getId());
     }

     return myModel;
   }


or do this in the constructor instead of getmodel, depends on the usecase

-Igor


On 5/26/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
i think what you need to set on the panel is:

new CompoundPropertyModel(new PropertyModel( modelFromParent, this.getId() ))

-Igor


On 5/26/06, Ralf Ebert <[EMAIL PROTECTED]> wrote:
Hi,

> give the panel a model?
> that sits inbetween?
that's what I'm doing with the overwritten onAttach method. I found no
other place to do this, because I want to get the modelobject from the
parent compoundpropertymodel and that's not possible in the
constructor (because it hasn't been added to the component tree
obviously) The thing is, I want to give it a model automatically by a
property of the parent compoundpropertymodel... If I do this only once
on the first attach, this works very well and does exactly what I
want, but it feels a bit "impure". I would rather tell the panel
somehow that I want this behaviour (or plug in a model class which
does this kind of resolving automatically). Maybe wicket should have a
clean way to state: a) I want property resolving like there is no
panel/component in between or b) I want to use the id of a component
in between to resolve model properties?

ralf


-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmdlnk&kid7521&bid$8729&dat1642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user


Reply via email to