because the problem is that between the time the list was rendered and
the time you click the link the underlying list might have changed, so
the move operation might be invoked on the wrong item...i think we
just chose a safer default...

-igor


On Thu, Feb 14, 2008 at 1:58 AM, Henrik Lundahl
<[EMAIL PROTECTED]> wrote:
> Hi
>
>  Yes, but why can't ListItem.getIndex() be used? I can't see any
>  drawbacks, but one advantage is that you can use the same model object
>  twice in the list. It's not unlikely that I've missed something,
>  though.
>
>
>  Regards,
>  Henrik
>
>
>
>  2008/2/14, Igor Vaynberg <[EMAIL PROTECTED]>:
>
>
> > you can always roll your own link, you dont have to use the one
>  >  provided with ListView - there is nothing special it does that you
>  >  cannot do yourself. Of course we should have used item.getindex() if
>  >  there was some common interface that all items that were put in list
>  >  had to implement...but since there is no such thing we do the best we
>  >  can without it but leave you plenty of freedom to implement your own.
>  >
>  >
>  >  -igor
>  >
>  >
>  >
>  >  On Feb 13, 2008 8:05 PM, Lan Boon Ping <[EMAIL PROTECTED]> wrote:
>  >  > Hi,
>  >  >
>  >  > Taking a look at ListView.moveUpLink as example, I doubt that this
>  >  > getList().indexOf() will return a correct index if we have duplicate
>  >  > items with same identity in getList(). Should not it uses
>  >  > item.getIndex() instead?
>  >  >
>  >  >     public final Link moveUpLink(final String id, final ListItem item)
>  >  >         {
>  >  >                 return new Link(id)
>  >  >                 {
>  >  >                         private static final long serialVersionUID = 1L;
>  >  >
>  >  >                         public void onClick()
>  >  >                         {
>  >  >                                 final int index = 
> getList().indexOf(item.getModelObject()); // use
>  >  > item.getIndex() instead?
>  >  >
>  >  > Thank You.
>  >  >
>  >  > Regards
>  >  > Boon Ping
>  >  >
>  >  > ---------------------------------------------------------------------
>  >  > 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]
>  >
>  >
>
>  ---------------------------------------------------------------------
>  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