You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "Corbin, James" <jc...@iqnavigator.com> on 2011/06/01 16:56:26 UTC
RefreshingView - Comparing Items in List Model
I am using a RefreshingView for a fairly simple table layout with the exception that one of columns in the table contains actions to move rows up and down (e.g., re-order rows).
My model for the RefreshingView is basically a List<IModel<T>> where T is my POJO.
The approach I was going to take was to have the buttons (move up/down) manipulate the underlying model by repositioning the IModel<T> instances in the ordered List. In order to do this, I need to identify the index position of a particular item (IModel<T>) in the list.
My T instances have equals and hashcode defined, but wondered if my IModel<T> instances need to be detachable models that also define hashcode and equals as well.
Is this the right approach?
J.D.
Re: RefreshingView - Comparing Items in List Model
Posted by Igor Vaynberg <ig...@gmail.com>.
alternatively override renderiterator() and sort your items there.
-igor
On Wed, Jun 1, 2011 at 8:45 AM, Corbin, James <jc...@iqnavigator.com> wrote:
> I was able to solve this issue by defining a new class that extends LoadableDetachableModel. The class also overrides hashcode and equals appropriately. Now my List<IModel<T>> (used by RefreshingView) contains instances for the new detachable model implementation and now list manipulation works just fine and my manual row reordering logic works perfectly.
>
>
> Regards,
> J.D.
> -----Original Message-----
> From: Corbin, James [mailto:jcorbin@iqnavigator.com]
> Sent: Wednesday, June 01, 2011 8:56 AM
> To: users@wicket.apache.org
> Subject: RefreshingView - Comparing Items in List Model
>
> I am using a RefreshingView for a fairly simple table layout with the exception that one of columns in the table contains actions to move rows up and down (e.g., re-order rows).
>
> My model for the RefreshingView is basically a List<IModel<T>> where T is my POJO.
>
> The approach I was going to take was to have the buttons (move up/down) manipulate the underlying model by repositioning the IModel<T> instances in the ordered List. In order to do this, I need to identify the index position of a particular item (IModel<T>) in the list.
>
> My T instances have equals and hashcode defined, but wondered if my IModel<T> instances need to be detachable models that also define hashcode and equals as well.
>
> Is this the right approach?
>
> J.D.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
RE: RefreshingView - Comparing Items in List Model
Posted by "Corbin, James" <jc...@iqnavigator.com>.
I was able to solve this issue by defining a new class that extends LoadableDetachableModel. The class also overrides hashcode and equals appropriately. Now my List<IModel<T>> (used by RefreshingView) contains instances for the new detachable model implementation and now list manipulation works just fine and my manual row reordering logic works perfectly.
Regards,
J.D.
-----Original Message-----
From: Corbin, James [mailto:jcorbin@iqnavigator.com]
Sent: Wednesday, June 01, 2011 8:56 AM
To: users@wicket.apache.org
Subject: RefreshingView - Comparing Items in List Model
I am using a RefreshingView for a fairly simple table layout with the exception that one of columns in the table contains actions to move rows up and down (e.g., re-order rows).
My model for the RefreshingView is basically a List<IModel<T>> where T is my POJO.
The approach I was going to take was to have the buttons (move up/down) manipulate the underlying model by repositioning the IModel<T> instances in the ordered List. In order to do this, I need to identify the index position of a particular item (IModel<T>) in the list.
My T instances have equals and hashcode defined, but wondered if my IModel<T> instances need to be detachable models that also define hashcode and equals as well.
Is this the right approach?
J.D.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org