Nino Saturnino Martinez Vazquez Wael wrote:


Java Programmer wrote:
I'm little confused now about not using detachable model in places you
have marked - I have in first place to pull the object from item:
Yup thats right. But after that you use that CarPart object raw. When you provide it to the components...
final CarPart carPart = (CarPart) item.getModelObject();
which is load() object correctly - i tested it by quickly putting:
        @Override
        protected Object load() {
System.out.println("\n\n\n LOAD object: " + this.carPartId + "\n\n\n");
            return carPartService.getCarPartById(this.carPartId);
        }
for 3 elements on the page I got in logs:
 LOAD object: 13

 LOAD object: 12

 LOAD object: 2
So I think deatachable model is used here? Am I wrong?
I believe youre wrong.
   item.add(price = new Label(PRICE, carPart.getPrice().toString()));
Carpart is not a detachable model right?
and further more, toString isnt..

If I want to use item.setModelObject(new
CompoundPropertyModel(carPart)); how can I get netsted object in:
carPart.getCarModel().getModelName()

Something like this: new PropertyModel(myCompoundPropertyModel(mydetachableModel).bind("carModel"),"modelName");

It's very important that you chain the models, otherwise you'll still not use the detachablemodel... Like my previous example:

item.setModel(new CompoundModel(item.getModel()));


Best regards,
Adr

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




--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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

Reply via email to