Well. I do not have hierarchical models.

I have just one single-level model which is used in several propertymodels.

I will try if it works to wrap it.

**
Martin

2008/4/30 Per Newgro <[EMAIL PROTECTED]>:
> Am Mittwoch, 30. April 2008 08:29:10 schrieb Martin Makundi:
>
>
>  > Hi!
>  >
>  > Please give me an example:
>  > MyData myData = new MyData(name, address); // pseudo
>  >
>  > add(new Label("name", new PropertyModel(myData, "name"));
>  > add(new Label("address", new PropertyModel(myData, "address"));
>  >
>  > // now I have an ajax button or something...
>  > @Override
>  >         protected void onUpdate(AjaxRequestTarget target) {
>  >            int stateChangeKey = (Integer) thisGadget.getModelObject();
>  >            myData =
>  > ComplexBusinessLogicService.loadNewDataAccordingToState(stateChangeKey);
>  >         }
>
>  I normally do it the following way
>  At the highest entry point (page mostly)
>  MyBusinessModelWithoutWicketStuff myModel = Service.createTheBusinessModel();
>  CompoundPropertyModel model = new CompoundPropertyModel(myModel);
>  myPage.setModel(model);
>  IModel pathToMySubModel = new PropertyModel(model, "property1");
>  MyPanel p1 = new MyPanel("id1", pathToMySubModel);
>  IModel pathToMyDeepestModel =
>                   new PropertyModel(pathToMySubModel, "deepestModel");
>  MyPanel p2 = new MyPanel("id2", pathToMyDeepestModel);
>  and so on.
>
>  I imagine myself the connected property models as a path to my data.
>  Only the highest level component has the business instance set. All others
>  simply get the path to it.
>
>
>  > Now you mean if I wrap the myData into an IModel I do not need to
>  > change anything else except the first line:
>  > MyData myData = new MyData(name, address); // pseudo
>  > IModel myDataIModel = new MyIModel(myData);
>  >
>  > and replace it in the property models? Wow. So PropertyModel will be
>  > smart enough here on its own.
>  Simply try it. It works great.
>
>  cheers
>  Per
>
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to