[Wicket-user] another dumb model question....

2006-05-31 Thread Vincent Jenks

I've got a page where I need to call data from the EntityManger (EJB3)
several times in a single pagewhich means I'd need to have several
detached-models in the page.

Once I put these objects and/or collections of objects into a
detachable model, what's the best way to cast them back out to their
original types?

It seems like a silly question but I'm having trouble w/ it.  If I
only had one detached model I realize I could use setModel(...) and
grab it w/ getModelObject() - but I've got 3-4 collections and they
can't all be the page model, can they?

Thanks!


---
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?cmd=lnk&kid=107521&bid=248729&dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] another dumb model question....

2006-05-31 Thread Matej Knopp

I'm not sure I understand you but you load the collections separately?
Can't you just do something like this?

class MyPage extends Page {
  public MyPage() {
IModel m1 = new LoadableDetachableModel() {
  Object load() {
 return [load collection 1];
  }
}
add(new ListView("l1", m1) {
  ...
});

IModel m2 = new LoadableDetachableModel() {
  Object load() {
 return [load collection 2];
  }
}
add(new ListView("l2", m2) {
  ...
});

  }
}

Matej

Vincent Jenks wrote:

I've got a page where I need to call data from the EntityManger (EJB3)
several times in a single pagewhich means I'd need to have several
detached-models in the page.

Once I put these objects and/or collections of objects into a
detachable model, what's the best way to cast them back out to their
original types?

It seems like a silly question but I'm having trouble w/ it.  If I
only had one detached model I realize I could use setModel(...) and
grab it w/ getModelObject() - but I've got 3-4 collections and they
can't all be the page model, can they?

Thanks!


---
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?cmd=lnk&kid=107521&bid=248729&dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user





---
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?cmd=lnk&kid=107521&bid=248729&dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] another dumb model question....

2006-05-31 Thread Vincent Jenks

If I were just displaying the lists in a ListView that'd be fine,
however I'm not using it that way.

Suppose myDetachedModel is being displayed in a ListView and on each
iteration, I'm grabbing a value from the database (here's where I need
another detachable model) and doing calculations against it - for each
iteration in the ListView loop.

In other words, I just need access to the raw object data in it's real
data-type after I've loaded it into a detachable model - my question
is simply that, how do I get it back to its original type.

On 5/31/06, Matej Knopp <[EMAIL PROTECTED]> wrote:

I'm not sure I understand you but you load the collections separately?
Can't you just do something like this?

class MyPage extends Page {
   public MyPage() {
 IModel m1 = new LoadableDetachableModel() {
   Object load() {
  return [load collection 1];
   }
 }
 add(new ListView("l1", m1) {
   ...
 });

 IModel m2 = new LoadableDetachableModel() {
   Object load() {
  return [load collection 2];
   }
 }
 add(new ListView("l2", m2) {
   ...
 });

   }
}

Matej

Vincent Jenks wrote:
> I've got a page where I need to call data from the EntityManger (EJB3)
> several times in a single pagewhich means I'd need to have several
> detached-models in the page.
>
> Once I put these objects and/or collections of objects into a
> detachable model, what's the best way to cast them back out to their
> original types?
>
> It seems like a silly question but I'm having trouble w/ it.  If I
> only had one detached model I realize I could use setModel(...) and
> grab it w/ getModelObject() - but I've got 3-4 collections and they
> can't all be the page model, can they?
>
> Thanks!
>
>
> ---
> 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?cmd=lnk&kid=107521&bid=248729&dat=121642
> ___
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>



---
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?cmd=lnk&kid=107521&bid=248729&dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user




---
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?cmd=lnk&kid=107521&bid=248729&dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] another dumb model question....

2006-05-31 Thread Matej Knopp

Suppose you have
IModel model = new LoadableDetachableModel() { ...

you can get the model any time:
List myItems = (List) model.getObject(null).

First time you call getObject the model is attached (list is loaded). 
Until it's detached, getObject(null) will always return the loaded list.


-Matej

Vincent Jenks wrote:

If I were just displaying the lists in a ListView that'd be fine,
however I'm not using it that way.

Suppose myDetachedModel is being displayed in a ListView and on each
iteration, I'm grabbing a value from the database (here's where I need
another detachable model) and doing calculations against it - for each
iteration in the ListView loop.

In other words, I just need access to the raw object data in it's real
data-type after I've loaded it into a detachable model - my question
is simply that, how do I get it back to its original type.

On 5/31/06, Matej Knopp <[EMAIL PROTECTED]> wrote:

I'm not sure I understand you but you load the collections separately?
Can't you just do something like this?

class MyPage extends Page {
   public MyPage() {
 IModel m1 = new LoadableDetachableModel() {
   Object load() {
  return [load collection 1];
   }
 }
 add(new ListView("l1", m1) {
   ...
 });

 IModel m2 = new LoadableDetachableModel() {
   Object load() {
  return [load collection 2];
   }
 }
 add(new ListView("l2", m2) {
   ...
 });

   }
}

Matej

Vincent Jenks wrote:
> I've got a page where I need to call data from the EntityManger (EJB3)
> several times in a single pagewhich means I'd need to have several
> detached-models in the page.
>
> Once I put these objects and/or collections of objects into a
> detachable model, what's the best way to cast them back out to their
> original types?
>
> It seems like a silly question but I'm having trouble w/ it.  If I
> only had one detached model I realize I could use setModel(...) and
> grab it w/ getModelObject() - but I've got 3-4 collections and they
> can't all be the page model, can they?
>
> Thanks!
>
>
> ---
> 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?cmd=lnk&kid=107521&bid=248729&dat=121642

> ___
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>



---
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?cmd=lnk&kid=107521&bid=248729&dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user




---
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?cmd=lnk&kid=107521&bid=248729&dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user





---
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?cmd=lnk&kid=107521&bid=248729&dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] another dumb model question....

2006-05-31 Thread Vincent Jenks

Excellent, that's perfect.  The part I was unsure about was what to
pass for the arguement for getObject()

Thanks Matej!

On 5/31/06, Matej Knopp <[EMAIL PROTECTED]> wrote:

Suppose you have
IModel model = new LoadableDetachableModel() { ...

you can get the model any time:
List myItems = (List) model.getObject(null).

First time you call getObject the model is attached (list is loaded).
Until it's detached, getObject(null) will always return the loaded list.

-Matej

Vincent Jenks wrote:
> If I were just displaying the lists in a ListView that'd be fine,
> however I'm not using it that way.
>
> Suppose myDetachedModel is being displayed in a ListView and on each
> iteration, I'm grabbing a value from the database (here's where I need
> another detachable model) and doing calculations against it - for each
> iteration in the ListView loop.
>
> In other words, I just need access to the raw object data in it's real
> data-type after I've loaded it into a detachable model - my question
> is simply that, how do I get it back to its original type.
>
> On 5/31/06, Matej Knopp <[EMAIL PROTECTED]> wrote:
>> I'm not sure I understand you but you load the collections separately?
>> Can't you just do something like this?
>>
>> class MyPage extends Page {
>>public MyPage() {
>>  IModel m1 = new LoadableDetachableModel() {
>>Object load() {
>>   return [load collection 1];
>>}
>>  }
>>  add(new ListView("l1", m1) {
>>...
>>  });
>>
>>  IModel m2 = new LoadableDetachableModel() {
>>Object load() {
>>   return [load collection 2];
>>}
>>  }
>>  add(new ListView("l2", m2) {
>>...
>>  });
>>
>>}
>> }
>>
>> Matej
>>
>> Vincent Jenks wrote:
>> > I've got a page where I need to call data from the EntityManger (EJB3)
>> > several times in a single pagewhich means I'd need to have several
>> > detached-models in the page.
>> >
>> > Once I put these objects and/or collections of objects into a
>> > detachable model, what's the best way to cast them back out to their
>> > original types?
>> >
>> > It seems like a silly question but I'm having trouble w/ it.  If I
>> > only had one detached model I realize I could use setModel(...) and
>> > grab it w/ getModelObject() - but I've got 3-4 collections and they
>> > can't all be the page model, can they?
>> >
>> > Thanks!
>> >
>> >
>> > ---
>> > 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?cmd=lnk&kid=107521&bid=248729&dat=121642
>> > ___
>> > Wicket-user mailing list
>> > Wicket-user@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >
>>
>>
>>
>> ---
>> 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?cmd=lnk&kid=107521&bid=248729&dat=121642
>> ___
>> Wicket-user mailing list
>> Wicket-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>
>
>
> ---
> 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?cmd=lnk&kid=107521&bid=248729&dat=121642
> ___
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>



---
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?cmd=lnk&kid=107521&bid=248729&dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user




---
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?cmd=lnk&kid=107521&bid=248729&dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.

Re: [Wicket-user] another dumb model question....

2006-05-31 Thread Matej Knopp
:) Yeah, getObject is a little confusing at the beginning. The parameter 
is mostly used in compound models (CompoundPropertyModel) where the 
model is shared between multiple components to determine which component 
is setting/getting the value.


-Matej

Vincent Jenks wrote:

Excellent, that's perfect.  The part I was unsure about was what to
pass for the arguement for getObject()

Thanks Matej!

On 5/31/06, Matej Knopp <[EMAIL PROTECTED]> wrote:

Suppose you have
IModel model = new LoadableDetachableModel() { ...

you can get the model any time:
List myItems = (List) model.getObject(null).

First time you call getObject the model is attached (list is loaded).
Until it's detached, getObject(null) will always return the loaded list.

-Matej

Vincent Jenks wrote:
> If I were just displaying the lists in a ListView that'd be fine,
> however I'm not using it that way.
>
> Suppose myDetachedModel is being displayed in a ListView and on each
> iteration, I'm grabbing a value from the database (here's where I need
> another detachable model) and doing calculations against it - for each
> iteration in the ListView loop.
>
> In other words, I just need access to the raw object data in it's real
> data-type after I've loaded it into a detachable model - my question
> is simply that, how do I get it back to its original type.
>
> On 5/31/06, Matej Knopp <[EMAIL PROTECTED]> wrote:
>> I'm not sure I understand you but you load the collections separately?
>> Can't you just do something like this?
>>
>> class MyPage extends Page {
>>public MyPage() {
>>  IModel m1 = new LoadableDetachableModel() {
>>Object load() {
>>   return [load collection 1];
>>}
>>  }
>>  add(new ListView("l1", m1) {
>>...
>>  });
>>
>>  IModel m2 = new LoadableDetachableModel() {
>>Object load() {
>>   return [load collection 2];
>>}
>>  }
>>  add(new ListView("l2", m2) {
>>...
>>  });
>>
>>}
>> }
>>
>> Matej
>>
>> Vincent Jenks wrote:
>> > I've got a page where I need to call data from the EntityManger 
(EJB3)
>> > several times in a single pagewhich means I'd need to have 
several

>> > detached-models in the page.
>> >
>> > Once I put these objects and/or collections of objects into a
>> > detachable model, what's the best way to cast them back out to their
>> > original types?
>> >
>> > It seems like a silly question but I'm having trouble w/ it.  If I
>> > only had one detached model I realize I could use setModel(...) and
>> > grab it w/ getModelObject() - but I've got 3-4 collections and they
>> > can't all be the page model, can they?
>> >
>> > Thanks!
>> >
>> >
>> > ---
>> > 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?cmd=lnk&kid=107521&bid=248729&dat=121642

>> > ___
>> > Wicket-user mailing list
>> > Wicket-user@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >
>>
>>
>>
>> ---
>> 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?cmd=lnk&kid=107521&bid=248729&dat=121642

>> ___
>> Wicket-user mailing list
>> Wicket-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>
>
>
> ---
> 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?cmd=lnk&kid=107521&bid=248729&dat=121642

> ___
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>



---
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?cmd=lnk&kid=107521&bid=248729&dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user




---
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The high

Re: [Wicket-user] another dumb model question....

2006-05-31 Thread Eelco Hillenius

A trick that work even better is to wrap the models you want to work
with in a model for the sake of passing detach to the wrapped models.
That wrapper model would have a couple of convenience methods to get
the values of the wrapped models, and the wrapper model would be the
model to set on your page/ top level component.

Eelco



One trick is to use an object that contains the objects you plan to
work with, and make your models work on that.



---
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?cmd=lnk&kid=107521&bid=248729&dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] another dumb model question....

2006-05-31 Thread VGJ




I might just be nit-picking here...but it might be nice to have a parameter-less override of getObjectjust for prettiness ;)  It might be more intuitive for the first-time user as well?  It would be more apparent, IMO, if you could just call model.getObject()

Just a thought...

On Wed, 2006-05-31 at 22:35 +0200, Matej Knopp wrote:


:) Yeah, getObject is a little confusing at the beginning. The parameter 
is mostly used in compound models (CompoundPropertyModel) where the 
model is shared between multiple components to determine which component 
is setting/getting the value.

-Matej

Vincent Jenks wrote:
> Excellent, that's perfect.  The part I was unsure about was what to
> pass for the arguement for getObject()
> 
> Thanks Matej!
> 
> On 5/31/06, Matej Knopp <[EMAIL PROTECTED]> wrote:
>> Suppose you have
>> IModel model = new LoadableDetachableModel() { ...
>>
>> you can get the model any time:
>> List myItems = (List) model.getObject(null).
>>
>> First time you call getObject the model is attached (list is loaded).
>> Until it's detached, getObject(null) will always return the loaded list.
>>
>> -Matej
>>
>> Vincent Jenks wrote:
>> > If I were just displaying the lists in a ListView that'd be fine,
>> > however I'm not using it that way.
>> >
>> > Suppose myDetachedModel is being displayed in a ListView and on each
>> > iteration, I'm grabbing a value from the database (here's where I need
>> > another detachable model) and doing calculations against it - for each
>> > iteration in the ListView loop.
>> >
>> > In other words, I just need access to the raw object data in it's real
>> > data-type after I've loaded it into a detachable model - my question
>> > is simply that, how do I get it back to its original type.
>> >
>> > On 5/31/06, Matej Knopp <[EMAIL PROTECTED]> wrote:
>> >> I'm not sure I understand you but you load the collections separately?
>> >> Can't you just do something like this?
>> >>
>> >> class MyPage extends Page {
>> >>public MyPage() {
>> >>  IModel m1 = new LoadableDetachableModel() {
>> >>Object load() {
>> >>   return [load collection 1];
>> >>}
>> >>  }
>> >>  add(new ListView("l1", m1) {
>> >>...
>> >>  });
>> >>
>> >>  IModel m2 = new LoadableDetachableModel() {
>> >>Object load() {
>> >>   return [load collection 2];
>> >>}
>> >>  }
>> >>  add(new ListView("l2", m2) {
>> >>...
>> >>  });
>> >>
>> >>}
>> >> }
>> >>
>> >> Matej
>> >>
>> >> Vincent Jenks wrote:
>> >> > I've got a page where I need to call data from the EntityManger 
>> (EJB3)
>> >> > several times in a single pagewhich means I'd need to have 
>> several
>> >> > detached-models in the page.
>> >> >
>> >> > Once I put these objects and/or collections of objects into a
>> >> > detachable model, what's the best way to cast them back out to their
>> >> > original types?
>> >> >
>> >> > It seems like a silly question but I'm having trouble w/ it.  If I
>> >> > only had one detached model I realize I could use setModel(...) and
>> >> > grab it w/ getModelObject() - but I've got 3-4 collections and they
>> >> > can't all be the page model, can they?
>> >> >
>> >> > Thanks!
>> >> >
>> >> >
>> >> > ---
>> >> > 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?cmd=lnk&kid=107521&bid=248729&dat=121642
>> >> > ___
>> >> > Wicket-user mailing list
>> >> > Wicket-user@lists.sourceforge.net
>> >> > https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >> >
>> >>
>> >>
>> >>
>> >> ---
>> >> 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?cmd=lnk&kid=107521&bid=248729&dat=121642
>> >> ___
>> >> Wicket-user mailing list
>> >> Wicket-user@lists.sourceforge.net
>> >> https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >>
>> >
>> >
>> > ---
>> > 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?cmd=lnk&kid=107521&bid=248729&dat=121642
>> > ___
>> > Wicket-user mailing list
>> > Wicket-user@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/

Re: [Wicket-user] another dumb model question....

2006-06-01 Thread Aaron Hiniker




+1

On Wed, 2006-05-31 at 20:47 -0600, VGJ wrote:

I might just be nit-picking here...but it might be nice to have a parameter-less override of getObjectjust for prettiness ;)  It might be more intuitive for the first-time user as well?  It would be more apparent, IMO, if you could just call model.getObject()

Just a thought...

On Wed, 2006-05-31 at 22:35 +0200, Matej Knopp wrote: 


:) Yeah, getObject is a little confusing at the beginning. The parameter 
is mostly used in compound models (CompoundPropertyModel) where the 
model is shared between multiple components to determine which component 
is setting/getting the value.

-Matej

Vincent Jenks wrote:
> Excellent, that's perfect.  The part I was unsure about was what to
> pass for the arguement for getObject()
> 
> Thanks Matej!
> 
> On 5/31/06, Matej Knopp <[EMAIL PROTECTED]> wrote:
>> Suppose you have
>> IModel model = new LoadableDetachableModel() { ...
>>
>> you can get the model any time:
>> List myItems = (List) model.getObject(null).
>>
>> First time you call getObject the model is attached (list is loaded).
>> Until it's detached, getObject(null) will always return the loaded list.
>>
>> -Matej
>>
>> Vincent Jenks wrote:
>> > If I were just displaying the lists in a ListView that'd be fine,
>> > however I'm not using it that way.
>> >
>> > Suppose myDetachedModel is being displayed in a ListView and on each
>> > iteration, I'm grabbing a value from the database (here's where I need
>> > another detachable model) and doing calculations against it - for each
>> > iteration in the ListView loop.
>> >
>> > In other words, I just need access to the raw object data in it's real
>> > data-type after I've loaded it into a detachable model - my question
>> > is simply that, how do I get it back to its original type.
>> >
>> > On 5/31/06, Matej Knopp <[EMAIL PROTECTED]> wrote:
>> >> I'm not sure I understand you but you load the collections separately?
>> >> Can't you just do something like this?
>> >>
>> >> class MyPage extends Page {
>> >>public MyPage() {
>> >>  IModel m1 = new LoadableDetachableModel() {
>> >>Object load() {
>> >>   return [load collection 1];
>> >>}
>> >>  }
>> >>  add(new ListView("l1", m1) {
>> >>...
>> >>  });
>> >>
>> >>  IModel m2 = new LoadableDetachableModel() {
>> >>Object load() {
>> >>   return [load collection 2];
>> >>}
>> >>  }
>> >>  add(new ListView("l2", m2) {
>> >>...
>> >>  });
>> >>
>> >>}
>> >> }
>> >>
>> >> Matej
>> >>
>> >> Vincent Jenks wrote:
>> >> > I've got a page where I need to call data from the EntityManger 
>> (EJB3)
>> >> > several times in a single pagewhich means I'd need to have 
>> several
>> >> > detached-models in the page.
>> >> >
>> >> > Once I put these objects and/or collections of objects into a
>> >> > detachable model, what's the best way to cast them back out to their
>> >> > original types?
>> >> >
>> >> > It seems like a silly question but I'm having trouble w/ it.  If I
>> >> > only had one detached model I realize I could use setModel(...) and
>> >> > grab it w/ getModelObject() - but I've got 3-4 collections and they
>> >> > can't all be the page model, can they?
>> >> >
>> >> > Thanks!
>> >> >
>> >> >
>> >> > ---
>> >> > 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?cmd=lnk&kid=107521&bid=248729&dat=121642
>> >> > ___
>> >> > Wicket-user mailing list
>> >> > Wicket-user@lists.sourceforge.net
>> >> > https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >> >
>> >>
>> >>
>> >>
>> >> ---
>> >> 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?cmd=lnk&kid=107521&bid=248729&dat=121642
>> >> ___
>> >> Wicket-user mailing list
>> >> Wicket-user@lists.sourceforge.net
>> >> https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >>
>> >
>> >
>> > ---
>> > 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?cmd=lnk&kid=107521&bid=248729&dat=121642
>> > ___
>> > Wicket-user mailing list
>> > Wicket-u

Re: [Wicket-user] another dumb model question....

2006-06-01 Thread Igor Vaynberg
and what should that paremeterless override pass in to the getObject(Component c)? null? that will work, but will break down if you have a compound model - and more often then not you do.so i dont know if this is such a good thing
-IgorOn 6/1/06, Aaron Hiniker <[EMAIL PROTECTED]> wrote:



  
  


+1

On Wed, 2006-05-31 at 20:47 -0600, VGJ wrote:

I might just be nit-picking here...but it might be nice to have a parameter-less override of getObjectjust for prettiness ;)  It might be more intuitive for the first-time user as well?  It would be more apparent, IMO, if you could just call 
model.getObject()

Just a thought...

On Wed, 2006-05-31 at 22:35 +0200, Matej Knopp wrote: 

:) Yeah, getObject is a little confusing at the beginning. The parameter 
is mostly used in compound models (CompoundPropertyModel) where the 
model is shared between multiple components to determine which component 
is setting/getting the value.

-Matej

Vincent Jenks wrote:
> Excellent, that's perfect.  The part I was unsure about was what to
> pass for the arguement for getObject()
> 
> Thanks Matej!
> 
> On 5/31/06, Matej Knopp <[EMAIL PROTECTED]> wrote:
>> Suppose you have
>> IModel model = new LoadableDetachableModel() { ...
>>
>> you can get the model any time:
>> List myItems = (List) model.getObject(null).
>>
>> First time you call getObject the model is attached (list is loaded).
>> Until it's detached, getObject(null) will always return the loaded list.
>>
>> -Matej
>>
>> Vincent Jenks wrote:
>> > If I were just displaying the lists in a ListView that'd be fine,
>> > however I'm not using it that way.
>> >
>> > Suppose myDetachedModel is being displayed in a ListView and on each
>> > iteration, I'm grabbing a value from the database (here's where I need
>> > another detachable model) and doing calculations against it - for each
>> > iteration in the ListView loop.
>> >
>> > In other words, I just need access to the raw object data in it's real
>> > data-type after I've loaded it into a detachable model - my question
>> > is simply that, how do I get it back to its original type.
>> >
>> > On 5/31/06, Matej Knopp <[EMAIL PROTECTED]> wrote:
>> >> I'm not sure I understand you but you load the collections separately?
>> >> Can't you just do something like this?
>> >>
>> >> class MyPage extends Page {
>> >>public MyPage() {
>> >>  IModel m1 = new LoadableDetachableModel() {
>> >>Object load() {
>> >>   return [load collection 1];
>> >>}
>> >>  }
>> >>  add(new ListView("l1", m1) {
>> >>...
>> >>  });
>> >>
>> >>  IModel m2 = new LoadableDetachableModel() {
>> >>Object load() {
>> >>   return [load collection 2];
>> >>}
>> >>  }
>> >>  add(new ListView("l2", m2) {
>> >>...
>> >>  });
>> >>
>> >>}
>> >> }
>> >>
>> >> Matej
>> >>
>> >> Vincent Jenks wrote:
>> >> > I've got a page where I need to call data from the EntityManger 
>> (EJB3)
>> >> > several times in a single pagewhich means I'd need to have 
>> several
>> >> > detached-models in the page.
>> >> >
>> >> > Once I put these objects and/or collections of objects into a
>> >> > detachable model, what's the best way to cast them back out to their
>> >> > original types?
>> >> >
>> >> > It seems like a silly question but I'm having trouble w/ it.  If I
>> >> > only had one detached model I realize I could use setModel(...) and
>> >> > grab it w/ getModelObject() - but I've got 3-4 collections and they
>> >> > can't all be the page model, can they?
>> >> >
>> >> > Thanks!
>> >> >
>> >> >
>> >> > ---
>> >> > 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?cmd=lnk&kid=107521&bid=248729&dat=121642

>> >> > ___
>> >> > Wicket-user mailing list
>> >> > Wicket-user@lists.sourceforge.net
>> >> > https://lists.sourceforge.net/lists/listinfo/wicket-user

>> >> >
>> >>
>> >>
>> >>
>> >> ---
>> >> 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?cmd=lnk&kid=107521&bid=248729&dat=121642

>> >> ___
>> >> Wicket-user mailing list
>> >> Wicket-user@lists.sourceforge.net
>> >> https://lists.sourceforge.net/lists/listinfo/wicket-user

>> >>
>> >
>> >
>> > ---
>> > All the advantages of Linux Managed Hosting--Without the Cost and Risk!
>> > Fully trained technician

Re: [Wicket-user] another dumb model question....

2006-06-01 Thread Matej Knopp
Plus those methods are redundant. It would just clutter the interface. 
The contract is well defined. Maybe javadoc of get/setModelObject should 
be improved a little and state explicitly what the argument is and how 
it is used?


-Matej

Igor Vaynberg wrote:
and what should that paremeterless override pass in to the 
getObject(Component c)? null? that will work, but will break down if you 
have a compound model - and more often then not you do.


so i dont know if this is such a good thing

-Igor


On 6/1/06, *Aaron Hiniker* <[EMAIL PROTECTED] > 
wrote:


+1


On Wed, 2006-05-31 at 20:47 -0600, VGJ wrote:

I might just be nit-picking here...but it might be nice to have a
parameter-less override of getObjectjust for prettiness ;)  It
might be more intuitive for the first-time user as well?  It would
be more apparent, IMO, if you could just call model.getObject()

Just a thought...

On Wed, 2006-05-31 at 22:35 +0200, Matej Knopp wrote:
:) Yeah, getObject is a little confusing at the beginning. The parameter 
is mostly used in compound models (CompoundPropertyModel) where the 
model is shared between multiple components to determine which component 
is setting/getting the value.


-Matej

Vincent Jenks wrote:
> Excellent, that's perfect.  The part I was unsure about was what to
> pass for the arguement for getObject()
> 
> Thanks Matej!
> 
> On 5/31/06, Matej Knopp <[EMAIL PROTECTED] > wrote:

>> Suppose you have
>> IModel model = new LoadableDetachableModel() { ...
>>
>> you can get the model any time:
>> List myItems = (List) model.getObject(null).
>>
>> First time you call getObject the model is attached (list is loaded).
>> Until it's detached, getObject(null) will always return the loaded list.
>>
>> -Matej
>>
>> Vincent Jenks wrote:
>> > If I were just displaying the lists in a ListView that'd be fine,
>> > however I'm not using it that way.
>> >
>> > Suppose myDetachedModel is being displayed in a ListView and on each
>> > iteration, I'm grabbing a value from the database (here's where I need
>> > another detachable model) and doing calculations against it - for each
>> > iteration in the ListView loop.
>> >
>> > In other words, I just need access to the raw object data in it's real
>> > data-type after I've loaded it into a detachable model - my question
>> > is simply that, how do I get it back to its original type.
>> >
>> > On 5/31/06, Matej Knopp <[EMAIL PROTECTED] > 
wrote:
>> >> I'm not sure I understand you but you load the collections separately?
>> >> Can't you just do something like this?
>> >>
>> >> class MyPage extends Page {
>> >>public MyPage() {
>> >>  IModel m1 = new LoadableDetachableModel() {
>> >>Object load() {
>> >>   return [load collection 1];
>> >>}
>> >>  }
>> >>  add(new ListView("l1", m1) {
>> >>...
>> >>  });
>> >>
>> >>  IModel m2 = new LoadableDetachableModel() {
>> >>Object load() {
>> >>   return [load collection 2];
>> >>}
>> >>  }
>> >>  add(new ListView("l2", m2) {
>> >>...
>> >>  });
>> >>
>> >>}
>> >> }
>> >>
>> >> Matej
>> >>
>> >> Vincent Jenks wrote:
>> >> > I've got a page where I need to call data from the EntityManger 
>> (EJB3)
>> >> > several times in a single pagewhich means I'd need to have 
>> several

>> >> > detached-models in the page.
>> >> >
>> >> > Once I put these objects and/or collections of objects into a
>> >> > detachable model, what's the best way to cast them back out to their
>> >> > original types?
>> >> >
>> >> > It seems like a silly question but I'm having trouble w/ it.  If I
>> >> > only had one detached model I realize I could use setModel(...) and
>> >> > grab it w/ getModelObject() - but I've got 3-4 collections and they
>> >> > can't all be the page model, can they?
>> >> >
>> >> > Thanks!
>> >> >
>> >> >
>> >> > ---
>> >> > 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?cmd=lnk&kid=107521&bid=248729&dat=121642

 
>> >> > ___
>> >> > Wicket-user mailing list
>> >> > Wicket-user@lists.sourceforge.net 


Re: [Wicket-user] another dumb model question....

2006-06-01 Thread Rüdiger Schulz
Enhanced JavaDoc for IModel would be very useful. When I started with
Wicket, this took quite some time for me to grasp. After that, a lot
of problems I had where suddenly easy to solve :)

-- 
greetings from Berlin,

Rüdiger Schulz


Matej Knopp wrote on 01.06.2006 at 18:46:

> Plus those methods are redundant. It would just clutter the interface.
> The contract is well defined. Maybe javadoc of get/setModelObject should
> be improved a little and state explicitly what the argument is and how
> it is used?

> -Matej

> Igor Vaynberg wrote:
>> and what should that paremeterless override pass in to the 
>> getObject(Component c)? null? that will work, but will break down if you
>> have a compound model - and more often then not you do.
>> 
>> so i dont know if this is such a good thing
>> 
>> -Igor
>> 
>> 
>> On 6/1/06, *Aaron Hiniker* <[EMAIL PROTECTED] >
>> wrote:
>> 
>> +1
>> 
>> 
>> On Wed, 2006-05-31 at 20:47 -0600, VGJ wrote:
>>> I might just be nit-picking here...but it might be nice to have a
>>> parameter-less override of getObjectjust for prettiness ;)  It
>>> might be more intuitive for the first-time user as well?  It would
>>> be more apparent, IMO, if you could just call model.getObject()
>>>
>>> Just a thought...
>>>
>>> On Wed, 2006-05-31 at 22:35 +0200, Matej Knopp wrote:
 :) Yeah, getObject is a little confusing at the beginning. The 
 parameter
 is mostly used in compound models
 (CompoundPropertyModel) where the 
 model is shared between multiple components to determine which 
 component
 is setting/getting the value.

 -Matej

 Vincent Jenks wrote:
 > Excellent, that's perfect.  The part I was unsure about was what to
 > pass for the arguement for getObject()
 > 
 > Thanks Matej!
 > 
 > On 5/31/06, Matej Knopp <[EMAIL PROTECTED]
 > wrote:
 >> Suppose you have
 >> IModel model = new LoadableDetachableModel() { ...
 >>
 >> you can get the model any time:
 >> List myItems = (List) model.getObject(null).
 >>
 >> First time you call getObject the model is attached (list is 
 loaded).
 >> Until it's detached, getObject(null) will always return the loaded 
 list.
 >>
 >> -Matej
 >>
 >> Vincent Jenks wrote:
 >> > If I were just displaying the lists in a ListView that'd be fine,
 >> > however I'm not using it that way.
 >> >
 >> > Suppose myDetachedModel is being displayed in a ListView and on 
 each
 >> > iteration, I'm grabbing a value from the database (here's where I 
 need
 >> > another detachable model) and doing calculations against it - for 
 each
 >> > iteration in the ListView loop.
 >> >
 >> > In other words, I just need access to the raw object data in it's 
 real
 >> > data-type after I've loaded it into a detachable model - my 
 question
 >> > is simply that, how do I get it back to its original type.
 >> >
 >> > On 5/31/06, Matej Knopp <[EMAIL PROTECTED]
 > wrote:
 >> >> I'm not sure I understand you but you load the collections 
 separately?
 >> >> Can't you just do something like this?
 >> >>
 >> >> class MyPage extends Page {
 >> >>public MyPage() {
 >> >>  IModel m1 = new LoadableDetachableModel() {
 >> >>Object load() {
 >> >>   return [load collection 1];
 >> >>}
 >> >>  }
 >> >>  add(new ListView("l1", m1) {
 >> >>...
 >> >>  });
 >> >>
 >> >>  IModel m2 = new LoadableDetachableModel() {
 >> >>Object load() {
 >> >>   return [load collection 2];
 >> >>}
 >> >>  }
 >> >>  add(new ListView("l2", m2) {
 >> >>...
 >> >>  });
 >> >>
 >> >>}
 >> >> }
 >> >>
 >> >> Matej
 >> >>
 >> >> Vincent Jenks wrote:
 >> >> > I've got a page where I need to call data from the EntityManger
 >> (EJB3)
 >> >> > several times in a single pagewhich means I'd need to have
 >> several
 >> >> > detached-models in the page.
 >> >> >
 >> >> > Once I put these objects and/or collections of objects into a
 >> >> > detachable model, what's the best way to cast them back out to 
 their
 >> >> > original types?
 >> >> >
 >> >> > It seems like a silly question but I'm having trouble w/ it.  
 If I
 >> >> > only had one detached model I realize I could use 
 setModel(...) and
 >> >> > grab it w/ g

Re: [Wicket-user] another dumb model question....

2006-06-01 Thread Vincent Jenks

Agreed, the solution was absurdly simpleI was just entirely unsure
what to pass for the argnull seems very counter-intuitive to the
framework *user*.

On 6/1/06, Rüdiger Schulz <[EMAIL PROTECTED]> wrote:

Enhanced JavaDoc for IModel would be very useful. When I started with
Wicket, this took quite some time for me to grasp. After that, a lot
of problems I had where suddenly easy to solve :)

--
greetings from Berlin,

Rüdiger Schulz


Matej Knopp wrote on 01.06.2006 at 18:46:

> Plus those methods are redundant. It would just clutter the interface.
> The contract is well defined. Maybe javadoc of get/setModelObject should
> be improved a little and state explicitly what the argument is and how
> it is used?

> -Matej

> Igor Vaynberg wrote:
>> and what should that paremeterless override pass in to the
>> getObject(Component c)? null? that will work, but will break down if you
>> have a compound model - and more often then not you do.
>>
>> so i dont know if this is such a good thing
>>
>> -Igor
>>
>>
>> On 6/1/06, *Aaron Hiniker* <[EMAIL PROTECTED] >
>> wrote:
>>
>> +1
>>
>>
>> On Wed, 2006-05-31 at 20:47 -0600, VGJ wrote:
>>> I might just be nit-picking here...but it might be nice to have a
>>> parameter-less override of getObjectjust for prettiness ;)  It
>>> might be more intuitive for the first-time user as well?  It would
>>> be more apparent, IMO, if you could just call model.getObject()
>>>
>>> Just a thought...
>>>
>>> On Wed, 2006-05-31 at 22:35 +0200, Matej Knopp wrote:
 :) Yeah, getObject is a little confusing at the beginning. The 
parameter
 is mostly used in compound models
 (CompoundPropertyModel) where the
 model is shared between multiple components to determine which 
component
 is setting/getting the value.

 -Matej

 Vincent Jenks wrote:
 > Excellent, that's perfect.  The part I was unsure about was what to
 > pass for the arguement for getObject()
 >
 > Thanks Matej!
 >
 > On 5/31/06, Matej Knopp <[EMAIL PROTECTED]
 > wrote:
 >> Suppose you have
 >> IModel model = new LoadableDetachableModel() { ...
 >>
 >> you can get the model any time:
 >> List myItems = (List) model.getObject(null).
 >>
 >> First time you call getObject the model is attached (list is 
loaded).
 >> Until it's detached, getObject(null) will always return the loaded 
list.
 >>
 >> -Matej
 >>
 >> Vincent Jenks wrote:
 >> > If I were just displaying the lists in a ListView that'd be fine,
 >> > however I'm not using it that way.
 >> >
 >> > Suppose myDetachedModel is being displayed in a ListView and on 
each
 >> > iteration, I'm grabbing a value from the database (here's where I 
need
 >> > another detachable model) and doing calculations against it - for 
each
 >> > iteration in the ListView loop.
 >> >
 >> > In other words, I just need access to the raw object data in it's 
real
 >> > data-type after I've loaded it into a detachable model - my 
question
 >> > is simply that, how do I get it back to its original type.
 >> >
 >> > On 5/31/06, Matej Knopp <[EMAIL PROTECTED]
 > wrote:
 >> >> I'm not sure I understand you but you load the collections 
separately?
 >> >> Can't you just do something like this?
 >> >>
 >> >> class MyPage extends Page {
 >> >>public MyPage() {
 >> >>  IModel m1 = new LoadableDetachableModel() {
 >> >>Object load() {
 >> >>   return [load collection 1];
 >> >>}
 >> >>  }
 >> >>  add(new ListView("l1", m1) {
 >> >>...
 >> >>  });
 >> >>
 >> >>  IModel m2 = new LoadableDetachableModel() {
 >> >>Object load() {
 >> >>   return [load collection 2];
 >> >>}
 >> >>  }
 >> >>  add(new ListView("l2", m2) {
 >> >>...
 >> >>  });
 >> >>
 >> >>}
 >> >> }
 >> >>
 >> >> Matej
 >> >>
 >> >> Vincent Jenks wrote:
 >> >> > I've got a page where I need to call data from the EntityManger
 >> (EJB3)
 >> >> > several times in a single pagewhich means I'd need to have
 >> several
 >> >> > detached-models in the page.
 >> >> >
 >> >> > Once I put these objects and/or collections of objects into a
 >> >> > detachable model, what's the best way to cast them back out to 
their
 >> >> > original types?
 >> >> >
 >> >> > It seems like a silly question but I'm having 

Re: [Wicket-user] another dumb model question....

2006-06-01 Thread Igor Vaynberg
pass in the component that is accessing the model - that is whatever component is calling getObject-IgorOn 6/1/06, Vincent Jenks <
[EMAIL PROTECTED]> wrote:Agreed, the solution was absurdly simpleI was just entirely unsure
what to pass for the argnull seems very counter-intuitive to theframework *user*.On 6/1/06, Rüdiger Schulz <[EMAIL PROTECTED]> wrote:> Enhanced JavaDoc for IModel would be very useful. When I started with
> Wicket, this took quite some time for me to grasp. After that, a lot> of problems I had where suddenly easy to solve :)>> --> greetings from Berlin,>> Rüdiger Schulz>
>> Matej Knopp wrote on 01.06.2006 at 18:46:>> > Plus those methods are redundant. It would just clutter the interface.> > The contract is well defined. Maybe javadoc of get/setModelObject should
> > be improved a little and state explicitly what the argument is and how> > it is used?>> > -Matej>> > Igor Vaynberg wrote:> >> and what should that paremeterless override pass in to the
> >> getObject(Component c)? null? that will work, but will break down if you> >> have a compound model - and more often then not you do.> >>> >> so i dont know if this is such a good thing
> >>> >> -Igor> >>> >>> >> On 6/1/06, *Aaron Hiniker* <[EMAIL PROTECTED] 
[EMAIL PROTECTED]>>> >> wrote:> >>> >> +1> >>> >>> >> On Wed, 2006-05-31 at 20:47 -0600, VGJ wrote:> >>> I might just be nit-picking here...but it might be nice to have a
> >>> parameter-less override of getObjectjust for prettiness ;)  It> >>> might be more intuitive for the first-time user as well?  It would> >>> be more apparent, IMO, if you could just call 
model.getObject()>  >>> Just a thought...>  >>> On Wed, 2006-05-31 at 22:35 +0200, Matej Knopp wrote:>  :) Yeah, getObject is a little confusing at the beginning. The parameter
>  is mostly used in compound models>  (CompoundPropertyModel) where the>  model is shared between multiple components to determine which component
>  is setting/getting the value.> >  -Matej> >  Vincent Jenks wrote:>  > Excellent, that's perfect.  The part I was unsure about was what to
>  > pass for the arguement for getObject()>  >>  > Thanks Matej!>  >>  > On 5/31/06, Matej Knopp <
[EMAIL PROTECTED]>  [EMAIL PROTECTED]>> wrote:>  >> Suppose you have>  >> IModel model = new LoadableDetachableModel() { ...
>  >>>  >> you can get the model any time:>  >> List myItems = (List) model.getObject(null).>  >>
>  >> First time you call getObject the model is attached (list is loaded).>  >> Until it's detached, getObject(null) will always return the loaded list.
>  >>>  >> -Matej>  >>>  >> Vincent Jenks wrote:>  >> > If I were just displaying the lists in a ListView that'd be fine,
>  >> > however I'm not using it that way.>  >> >>  >> > Suppose myDetachedModel is being displayed in a ListView and on each
>  >> > iteration, I'm grabbing a value from the database (here's where I need>  >> > another detachable model) and doing calculations against it - for each
>  >> > iteration in the ListView loop.>  >> >>  >> > In other words, I just need access to the raw object data in it's real
>  >> > data-type after I've loaded it into a detachable model - my question>  >> > is simply that, how do I get it back to its original type.>  >> >
>  >> > On 5/31/06, Matej Knopp <[EMAIL PROTECTED]>  [EMAIL PROTECTED]>> wrote:
>  >> >> I'm not sure I understand you but you load the collections separately?>  >> >> Can't you just do something like this?>  >> >>
>  >> >> class MyPage extends Page {>  >> >>public MyPage() {>  >> >>  IModel m1 = new LoadableDetachableModel() {
>  >> >>Object load() {>  >> >>   return [load collection 1];>  >> >>}>  >> >>  }
>  >> >>  add(new ListView("l1", m1) {>  >> >>...>  >> >>  });>  >> >>
>  >> >>  IModel m2 = new LoadableDetachableModel() {>  >> >>Object load() {>  >> >>   return [load collection 2];
>  >> >>}>  >> >>  }>  >> >>  add(new ListView("l2", m2) {>  >> >>...
>  >> >>  });>  >> >>>  >> >>}>  >> >> }>  >> >>
>  >> >> Matej>  >> >>>  >> >> Vincent Jenks wrote:>  >> >> > I've got a page where I need to call data from the EntityManger
>  >> (EJB3)>  >> >> > several times in a single pagewhich means I'd need to have>  >> several>  >> >> > detached-models in the page.
>  >> >> >>  >> >> > 

Re: [Wicket-user] another dumb model question....

2006-06-01 Thread Vincent Jenks

That wasn't my point, really.  I'm not saying null doesn't work...I'm
just talking purely about elegance here...getObject() is sexier ;)

It also "just makes sense" to the user.

What can I say...I'm picky.

On 6/1/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:

pass in the component that is accessing the model - that is whatever
component is calling getObject

-Igor



On 6/1/06, Vincent Jenks < [EMAIL PROTECTED]> wrote:
> Agreed, the solution was absurdly simpleI was just entirely unsure
> what to pass for the argnull seems very counter-intuitive to the
> framework *user*.
>
> On 6/1/06, Rüdiger Schulz <[EMAIL PROTECTED]> wrote:
> > Enhanced JavaDoc for IModel would be very useful. When I started with
> > Wicket, this took quite some time for me to grasp. After that, a lot
> > of problems I had where suddenly easy to solve :)
> >
> > --
> > greetings from Berlin,
> >
> > Rüdiger Schulz
> >
> >
> > Matej Knopp wrote on 01.06.2006 at 18:46:
> >
> > > Plus those methods are redundant. It would just clutter the interface.
> > > The contract is well defined. Maybe javadoc of get/setModelObject
should
> > > be improved a little and state explicitly what the argument is and how
> > > it is used?
> >
> > > -Matej
> >
> > > Igor Vaynberg wrote:
> > >> and what should that paremeterless override pass in to the
> > >> getObject(Component c)? null? that will work, but will break down if
you
> > >> have a compound model - and more often then not you do.
> > >>
> > >> so i dont know if this is such a good thing
> > >>
> > >> -Igor
> > >>
> > >>
> > >> On 6/1/06, *Aaron Hiniker* <[EMAIL PROTECTED] >
> > >> wrote:
> > >>
> > >> +1
> > >>
> > >>
> > >> On Wed, 2006-05-31 at 20:47 -0600, VGJ wrote:
> > >>> I might just be nit-picking here...but it might be nice to have
a
> > >>> parameter-less override of getObjectjust for prettiness ;)
It
> > >>> might be more intuitive for the first-time user as well?  It
would
> > >>> be more apparent, IMO, if you could just call model.getObject()
> > >>>
> > >>> Just a thought...
> > >>>
> > >>> On Wed, 2006-05-31 at 22:35 +0200, Matej Knopp wrote:
> >  :) Yeah, getObject is a little confusing at the beginning. The
parameter
> >  is mostly used in compound models
> >  (CompoundPropertyModel) where the
> >  model is shared between multiple components to determine which
component
> >  is setting/getting the value.
> > 
> >  -Matej
> > 
> >  Vincent Jenks wrote:
> >  > Excellent, that's perfect.  The part I was unsure about was
what to
> >  > pass for the arguement for getObject()
> >  >
> >  > Thanks Matej!
> >  >
> >  > On 5/31/06, Matej Knopp < [EMAIL PROTECTED]
> >  > wrote:
> >  >> Suppose you have
> >  >> IModel model = new LoadableDetachableModel() { ...
> >  >>
> >  >> you can get the model any time:
> >  >> List myItems = (List) model.getObject(null).
> >  >>
> >  >> First time you call getObject the model is attached (list is
loaded).
> >  >> Until it's detached, getObject(null) will always return the
loaded list.
> >  >>
> >  >> -Matej
> >  >>
> >  >> Vincent Jenks wrote:
> >  >> > If I were just displaying the lists in a ListView that'd
be fine,
> >  >> > however I'm not using it that way.
> >  >> >
> >  >> > Suppose myDetachedModel is being displayed in a ListView
and on each
> >  >> > iteration, I'm grabbing a value from the database (here's
where I need
> >  >> > another detachable model) and doing calculations against
it - for each
> >  >> > iteration in the ListView loop.
> >  >> >
> >  >> > In other words, I just need access to the raw object data
in it's real
> >  >> > data-type after I've loaded it into a detachable model -
my question
> >  >> > is simply that, how do I get it back to its original type.
> >  >> >
> >  >> > On 5/31/06, Matej Knopp <[EMAIL PROTECTED]
> >  > wrote:
> >  >> >> I'm not sure I understand you but you load the
collections separately?
> >  >> >> Can't you just do something like this?
> >  >> >>
> >  >> >> class MyPage extends Page {
> >  >> >>public MyPage() {
> >  >> >>  IModel m1 = new LoadableDetachableModel() {
> >  >> >>Object load() {
> >  >> >>   return [load collection 1];
> >  >> >>}
> >  >> >>  }
> >  >> >>  add(new ListView("l1", m1) {
> >  >> >>...
> >  >> >>  });
> >  >> >>
> >  >> >>  IModel m2 = new LoadableDetachableModel() {
> >  >> >>Object load() {
> >  >> >>   return [load collection 2];
> >  >> >>   

Re: [Wicket-user] another dumb model question....

2006-06-01 Thread Matej Knopp
But getObject() can't work if you have a property model. It will only 
work with simple models.


-Matej

Vincent Jenks wrote:

That wasn't my point, really.  I'm not saying null doesn't work...I'm
just talking purely about elegance here...getObject() is sexier ;)

It also "just makes sense" to the user.

What can I say...I'm picky.

On 6/1/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:

pass in the component that is accessing the model - that is whatever
component is calling getObject

-Igor



On 6/1/06, Vincent Jenks < [EMAIL PROTECTED]> wrote:
> Agreed, the solution was absurdly simpleI was just entirely unsure
> what to pass for the argnull seems very counter-intuitive to the
> framework *user*.
>
> On 6/1/06, Rüdiger Schulz <[EMAIL PROTECTED]> wrote:
> > Enhanced JavaDoc for IModel would be very useful. When I started with
> > Wicket, this took quite some time for me to grasp. After that, a lot
> > of problems I had where suddenly easy to solve :)
> >
> > --
> > greetings from Berlin,
> >
> > Rüdiger Schulz
> >
> >
> > Matej Knopp wrote on 01.06.2006 at 18:46:
> >
> > > Plus those methods are redundant. It would just clutter the 
interface.

> > > The contract is well defined. Maybe javadoc of get/setModelObject
should
> > > be improved a little and state explicitly what the argument is 
and how

> > > it is used?
> >
> > > -Matej
> >
> > > Igor Vaynberg wrote:
> > >> and what should that paremeterless override pass in to the
> > >> getObject(Component c)? null? that will work, but will break 
down if

you
> > >> have a compound model - and more often then not you do.
> > >>
> > >> so i dont know if this is such a good thing
> > >>
> > >> -Igor
> > >>
> > >>
> > >> On 6/1/06, *Aaron Hiniker* <[EMAIL PROTECTED] >
> > >> wrote:
> > >>
> > >> +1
> > >>
> > >>
> > >> On Wed, 2006-05-31 at 20:47 -0600, VGJ wrote:
> > >>> I might just be nit-picking here...but it might be nice to 
have

a
> > >>> parameter-less override of getObjectjust for 
prettiness ;)

It
> > >>> might be more intuitive for the first-time user as well?  It
would
> > >>> be more apparent, IMO, if you could just call 
model.getObject()

> > >>>
> > >>> Just a thought...
> > >>>
> > >>> On Wed, 2006-05-31 at 22:35 +0200, Matej Knopp wrote:
> >  :) Yeah, getObject is a little confusing at the 
beginning. The

parameter
> >  is mostly used in compound models
> >  (CompoundPropertyModel) where the
> >  model is shared between multiple components to determine 
which

component
> >  is setting/getting the value.
> > 
> >  -Matej
> > 
> >  Vincent Jenks wrote:
> >  > Excellent, that's perfect.  The part I was unsure about 
was

what to
> >  > pass for the arguement for getObject()
> >  >
> >  > Thanks Matej!
> >  >
> >  > On 5/31/06, Matej Knopp < [EMAIL PROTECTED]
> >  > wrote:
> >  >> Suppose you have
> >  >> IModel model = new LoadableDetachableModel() { ...
> >  >>
> >  >> you can get the model any time:
> >  >> List myItems = (List) model.getObject(null).
> >  >>
> >  >> First time you call getObject the model is attached 
(list is

loaded).
> >  >> Until it's detached, getObject(null) will always 
return the

loaded list.
> >  >>
> >  >> -Matej
> >  >>
> >  >> Vincent Jenks wrote:
> >  >> > If I were just displaying the lists in a ListView 
that'd

be fine,
> >  >> > however I'm not using it that way.
> >  >> >
> >  >> > Suppose myDetachedModel is being displayed in a 
ListView

and on each
> >  >> > iteration, I'm grabbing a value from the database 
(here's

where I need
> >  >> > another detachable model) and doing calculations 
against

it - for each
> >  >> > iteration in the ListView loop.
> >  >> >
> >  >> > In other words, I just need access to the raw object 
data

in it's real
> >  >> > data-type after I've loaded it into a detachable 
model -

my question
> >  >> > is simply that, how do I get it back to its original 
type.

> >  >> >
> >  >> > On 5/31/06, Matej Knopp <[EMAIL PROTECTED]
> >  > wrote:
> >  >> >> I'm not sure I understand you but you load the
collections separately?
> >  >> >> Can't you just do something like this?
> >  >> >>
> >  >> >> class MyPage extends Page {
> >  >> >>public MyPage() {
> >  >> >>  IModel m1 = new LoadableDetachableModel() {
> >  >> >>Object load() {
> >  >> >>   return [load collection 1];
> >  >> >>}
> >  >> >>  }
> >  >> >>  add(new ListView("l1", m1) {
> >  >> >>...
> >  >> >>  });
> >  >> >>
> >  >> >>  IMode

Re: [Wicket-user] another dumb model question....

2006-06-01 Thread Vincent Jenks

Point takenno biggie.

On 6/1/06, Matej Knopp <[EMAIL PROTECTED]> wrote:

But getObject() can't work if you have a property model. It will only
work with simple models.

-Matej

Vincent Jenks wrote:
> That wasn't my point, really.  I'm not saying null doesn't work...I'm
> just talking purely about elegance here...getObject() is sexier ;)
>
> It also "just makes sense" to the user.
>
> What can I say...I'm picky.
>
> On 6/1/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
>> pass in the component that is accessing the model - that is whatever
>> component is calling getObject
>>
>> -Igor
>>
>>
>>
>> On 6/1/06, Vincent Jenks < [EMAIL PROTECTED]> wrote:
>> > Agreed, the solution was absurdly simpleI was just entirely unsure
>> > what to pass for the argnull seems very counter-intuitive to the
>> > framework *user*.
>> >
>> > On 6/1/06, Rüdiger Schulz <[EMAIL PROTECTED]> wrote:
>> > > Enhanced JavaDoc for IModel would be very useful. When I started with
>> > > Wicket, this took quite some time for me to grasp. After that, a lot
>> > > of problems I had where suddenly easy to solve :)
>> > >
>> > > --
>> > > greetings from Berlin,
>> > >
>> > > Rüdiger Schulz
>> > >
>> > >
>> > > Matej Knopp wrote on 01.06.2006 at 18:46:
>> > >
>> > > > Plus those methods are redundant. It would just clutter the
>> interface.
>> > > > The contract is well defined. Maybe javadoc of get/setModelObject
>> should
>> > > > be improved a little and state explicitly what the argument is
>> and how
>> > > > it is used?
>> > >
>> > > > -Matej
>> > >
>> > > > Igor Vaynberg wrote:
>> > > >> and what should that paremeterless override pass in to the
>> > > >> getObject(Component c)? null? that will work, but will break
>> down if
>> you
>> > > >> have a compound model - and more often then not you do.
>> > > >>
>> > > >> so i dont know if this is such a good thing
>> > > >>
>> > > >> -Igor
>> > > >>
>> > > >>
>> > > >> On 6/1/06, *Aaron Hiniker* <[EMAIL PROTECTED] > [EMAIL PROTECTED]>>
>> > > >> wrote:
>> > > >>
>> > > >> +1
>> > > >>
>> > > >>
>> > > >> On Wed, 2006-05-31 at 20:47 -0600, VGJ wrote:
>> > > >>> I might just be nit-picking here...but it might be nice to
>> have
>> a
>> > > >>> parameter-less override of getObjectjust for
>> prettiness ;)
>> It
>> > > >>> might be more intuitive for the first-time user as well?  It
>> would
>> > > >>> be more apparent, IMO, if you could just call
>> model.getObject()
>> > > >>>
>> > > >>> Just a thought...
>> > > >>>
>> > > >>> On Wed, 2006-05-31 at 22:35 +0200, Matej Knopp wrote:
>> > >  :) Yeah, getObject is a little confusing at the
>> beginning. The
>> parameter
>> > >  is mostly used in compound models
>> > >  (CompoundPropertyModel) where the
>> > >  model is shared between multiple components to determine
>> which
>> component
>> > >  is setting/getting the value.
>> > > 
>> > >  -Matej
>> > > 
>> > >  Vincent Jenks wrote:
>> > >  > Excellent, that's perfect.  The part I was unsure about
>> was
>> what to
>> > >  > pass for the arguement for getObject()
>> > >  >
>> > >  > Thanks Matej!
>> > >  >
>> > >  > On 5/31/06, Matej Knopp < [EMAIL PROTECTED]
>> > >  > wrote:
>> > >  >> Suppose you have
>> > >  >> IModel model = new LoadableDetachableModel() { ...
>> > >  >>
>> > >  >> you can get the model any time:
>> > >  >> List myItems = (List) model.getObject(null).
>> > >  >>
>> > >  >> First time you call getObject the model is attached
>> (list is
>> loaded).
>> > >  >> Until it's detached, getObject(null) will always
>> return the
>> loaded list.
>> > >  >>
>> > >  >> -Matej
>> > >  >>
>> > >  >> Vincent Jenks wrote:
>> > >  >> > If I were just displaying the lists in a ListView
>> that'd
>> be fine,
>> > >  >> > however I'm not using it that way.
>> > >  >> >
>> > >  >> > Suppose myDetachedModel is being displayed in a
>> ListView
>> and on each
>> > >  >> > iteration, I'm grabbing a value from the database
>> (here's
>> where I need
>> > >  >> > another detachable model) and doing calculations
>> against
>> it - for each
>> > >  >> > iteration in the ListView loop.
>> > >  >> >
>> > >  >> > In other words, I just need access to the raw object
>> data
>> in it's real
>> > >  >> > data-type after I've loaded it into a detachable
>> model -
>> my question
>> > >  >> > is simply that, how do I get it back to its original
>> type.
>> > >  >> >
>> > >  >> > On 5/31/06, Matej Knopp <[EMAIL PROTECTED]
>> > >  > wrote:
>> > >  >> >> I'm not sure I understand you but you load the
>> collections separately?
>> > >  >> >> Can't you just do something like this?
>> > > >>>

Re: [Wicket-user] another dumb model question....

2006-06-02 Thread Johan Compagner
Do i see a Patch comming in from matej? ;)The contract is more or less this:if you pass null into the call then the model object is guaranteed to give the "root" object of the model.The "root" object is pretty much always the object that is specified through the constructor.
And yes this also is true for PropertyModels because there you specify a object and the property (so looking atthe constructor the root object of a property model is the combination of the object and the property _expression_)
Normally a developer should never have to specify anything, it can always be null because most of the times you alwayswant the object that you see as the root. for example:component.getModelObject
() should always be: component.getModel().getObject(null)The problem is that this is not the case in 1.2. Because we implemented generics how in 2.0 we did see the flaw in our modelswhen using compound models:
Form form = new Form("person",new CompoundPropertyModel(new Person()));TextField field = new TextField("name");
Now one example why you shouldn't give the component with it when you just want to object out if it:form.getModel().getObject(form)This will result in an error. Because the the compound property model will try to get the propertyt "person" (thats the id of the form) from the Person object.
So to get the "root" object you should do:form.getModel().getObject(null)that will return the Person.now the textfield:textfield.getModelObject() will return the  name of the person. Because it will inherited the forms model. and on that model it will call:
model.getObject(this);so thats fine, But what should happen if you do this:textfield.getModel().getObject(null)By the same semantics of the form. It should return the "root" object of the textfield and for that textfield it is still defined as the String name.
But that will return Person. So textfield.getModelObject() != textfield.getModel().getObject(null) that is wrong.in 2.0 this is already fixed. And i guess backporting this fix to 1.2 would be a good thing.
So pretty much the easiest defnition to know is:component.getModelObject() == component.getModel().getObject(null)And you as a developer shouldn't have to give anything in that getObject() call normally. Only if you do your own special things.
johanOn 6/1/06, Matej Knopp <[EMAIL PROTECTED]> wrote:
Plus those methods are redundant. It would just clutter the interface.The contract is well defined. Maybe javadoc of get/setModelObject shouldbe improved a little and state explicitly what the argument is and how
it is used?-MatejIgor Vaynberg wrote:> and what should that paremeterless override pass in to the> getObject(Component c)? null? that will work, but will break down if you> have a compound model - and more often then not you do.
>> so i dont know if this is such a good thing>> -Igor>>> On 6/1/06, *Aaron Hiniker* <[EMAIL PROTECTED] 
[EMAIL PROTECTED]>>> wrote:>> +1>>> On Wed, 2006-05-31 at 20:47 -0600, VGJ wrote:>> I might just be nit-picking here...but it might be nice to have a
>> parameter-less override of getObjectjust for prettiness ;)  It>> might be more intuitive for the first-time user as well?  It would>> be more apparent, IMO, if you could just call 
model.getObject() Just a thought... On Wed, 2006-05-31 at 22:35 +0200, Matej Knopp wrote:>>> :) Yeah, getObject is a little confusing at the beginning. The parameter
>>> is mostly used in compound models (CompoundPropertyModel) where the>>> model is shared between multiple components to determine which component>>> is setting/getting the value.
>> -Matej>> Vincent Jenks wrote:>>> > Excellent, that's perfect.  The part I was unsure about was what to>>> > pass for the arguement for getObject()
>>>  > Thanks Matej!>>>  > On 5/31/06, Matej Knopp <[EMAIL PROTECTED] 
[EMAIL PROTECTED]>> wrote:>>> >> Suppose you have>>> >> IModel model = new LoadableDetachableModel() { ...>>> > >> you can get the model any time:
>>> >> List myItems = (List) model.getObject(null).>>> > >> First time you call getObject the model is attached (list is loaded).
>>> >> Until it's detached, getObject(null) will always return the loaded list.>>> > >> -Matej>>> > >> Vincent Jenks wrote:
>>> >> > If I were just displaying the lists in a ListView that'd be fine,>>> >> > however I'm not using it that way.>>> >>  >> > Suppose myDetachedModel is being displayed in a ListView and on each
>>> >> > iteration, I'm grabbing a value from the database (here's where I need>>> >> > another detachable model) and doing calculations against it - for each>>> >> > iteration in the ListView loop.
>>> >>  >> > In other words, I just need access to the raw object data in it's real>>> >> > data-type after I've loaded it into a detachable model - my question
>>> >> > is simply that, 

Re: [Wicket-user] another dumb model question....

2006-06-02 Thread Eelco Hillenius
Can you give examples of those objects? Can't you put them in the
scope of the components they are needed for?

One trick is to use an object that contains the objects you plan to
work with, and make your models work on that.

Eelco


On 5/31/06, Vincent Jenks <[EMAIL PROTECTED]> wrote:
> I've got a page where I need to call data from the EntityManger (EJB3)
> several times in a single pagewhich means I'd need to have several
> detached-models in the page.
>
> Once I put these objects and/or collections of objects into a
> detachable model, what's the best way to cast them back out to their
> original types?
>
> It seems like a silly question but I'm having trouble w/ it.  If I
> only had one detached model I realize I could use setModel(...) and
> grab it w/ getModelObject() - but I've got 3-4 collections and they
> can't all be the page model, can they?
>
> Thanks!
>
>
> ---
> 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?cmd=lnk&kid=107521&bid=248729&dat=121642
> ___
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>


___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user