I'm confused on how to access a CompoundPropertyModel from within a child Panel. I set a CompountPropertyModel in a parent panel. But doing a getModel() in the child panel returns null. I thought that wicket would hunt back up the component tree to find an appropriate CompountPropertyModel. How should I do this?
Here is the parent, where I set the CPM: public class RatingDisplayPanel extends Panel { public RatingDisplayPanel(String id, RatingsModel ratings) { super(id); setModel(new CompoundPropertyModel(ratings)); add(new StarDisplay("facility", RatingBean.STARS)); } } Here is the child, where I do a getModel() and it returns null: public class StarDisplay extends Panel { private int width = 0; public StarDisplay(String id, List choices) { super(id); int size = 0; if (choices != null) { size = choices.size(); if (getModel() != null) { index = choices.indexOf(getModel().getObject(this)); } this.width = (index + 1)*100/size; WebMarkupContainer on = new WebMarkupContainer("on"); on.add(new AttributeModifier("style", true, new Model() { public Object getObject(final Component component) { return "width: "+width+"%"; } })); add(on); } } } I have it working right now by passing the model like this, but I want to simplify the code in my parent panel: add(new StarDisplay("facility", new PropertyModel(ratings, "facility"), RatingBean.STARS)); I thought perhaps I should use getNestedModel(), but it doesn't exist in a panel. Any help is appreciated! Tauren ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user