[
https://issues.apache.org/jira/browse/WICKET-2909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12879231#action_12879231
]
Hudson commented on WICKET-2909:
--------------------------------
Integrated in Apache Wicket 1.5.x #102 (See
[http://hudson.zones.apache.org/hudson/job/Apache%20Wicket%201.5.x/102/])
fixes WICKET-2909 in trunk
> ListView removeLink method should remove items from list based on item index
> ----------------------------------------------------------------------------
>
> Key: WICKET-2909
> URL: https://issues.apache.org/jira/browse/WICKET-2909
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.4.9
> Reporter: Clint Checketts
> Assignee: Jeremy Thomerson
> Priority: Minor
> Fix For: 1.4.10, 1.5-M1
>
> Attachments: quickstart.tar.gz
>
>
> In org.apache.wicket.markup.html.list.ListView the removeLink() method
> removes and object from the underlying list using the modelObject. instead it
> should remove using the item.getIndex().
> Reason: if the listview's model contains several nulls, and the clicked
> item's object is null then the first null would get removed instead of the
> entry at the item that was actually clicked.
> Instead of: 'final int oldIndex = getList().indexOf(item.getModelObject());'
> use the passed in item.getIndex()
> Example:
> public void onClick()
> {
> addStateChange(new Change()
> {
> private static final long
> serialVersionUID = 1L;
> final int oldIndex = item.getIndex());
> <- Change here ///////////////////////////////
> final T removedObject =
> item.getModelObject();
> @Override
> public void undo()
> {
>
> ((List<T>)getList()).add(oldIndex, removedObject);
> }
> });
> item.modelChanging();
> // Remove item and invalidate listView
> getList().remove(oldIndex); <- Change here
> ///////////////////////////////
> ListView.this.modelChanged();
> ListView.this.removeAll();
> }
> I spoke with Jeremy Thomerson about this. Please assign to him. The
> moveUpLink and MoveDownLink are similarly affected.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.