new Compoundpropertymodel(new Loadabledetachablemodel(yourdbobject))

so just wrap it and then use it as compound

On 10/20/07, Ayodeji Aladejebi <[EMAIL PROTECTED]> wrote:
> Greetings,
> Please I have some further questions to ask about models.
>
> LoadableDetachableModel cannot be used as a CompoundPropertyModel obviously
>
> meaning that if I load an Object with LoadableDetachableModel , I cant
> simple pass the LoadableDetachableModel to a Label so that the Label can use
> its id to resolve the value,
>
> Which means I have to first get the Object from the LoadableDetachableModel
> before wrapping it into CompoundPropertyModel again or a PropertyModel
>
> Please help me out;
>
> class MyData {
>
> Long id;
> String name;
> String address;
> String info;
>
> }
>
> class MyDataModel extends LoadableDetachableModel {
> Long id;
>
> public Object load(){
>  return dao.getData(id);
> }
> }
>
> MyDataModel mymodel = ...;
> Label nameLabel = new Label("name", mymodel);
> Label addressLabel = new Label("address, mymodel);
> Label infoLabel = new Label("info", mymodel);
>
> because i see so many codes like this:
>
>  Label label = new Label("name", new AbstractReadOnlyModel() {
>
>      public Object getObject(Component component) {
>          return someobject.getName();
>      }
>  });
> 1.  why create another Model
> 2. to retreive my someobject from another model to use in another model just
> to display does yet seem nice to me
>
> so why can that single instance of LoadableDetachableModel which is a
> readonly model be very handy for so many Label components knowing fully well
> that Websites are filled with labels loading from a Data Object.
>
> shoot me somebody :)
>
> am still using 1.2.6 please, is it time to move to 1.3?
>

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

Reply via email to