You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by tv...@apache.org on 2009/04/06 18:57:22 UTC
svn commit: r762414 -
/incubator/pivot/trunk/wtk/src/pivot/wtk/content/ListViewItemEditor.java
Author: tvolkert
Date: Mon Apr 6 16:57:21 2009
New Revision: 762414
URL: http://svn.apache.org/viewvc?rev=762414&view=rev
Log:
Made ListViewItemEditor correctly handle case of editing a list item within a sorted list
Modified:
incubator/pivot/trunk/wtk/src/pivot/wtk/content/ListViewItemEditor.java
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/content/ListViewItemEditor.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/content/ListViewItemEditor.java?rev=762414&r1=762413&r2=762414&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/content/ListViewItemEditor.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/content/ListViewItemEditor.java Mon Apr 6 16:57:21 2009
@@ -16,6 +16,8 @@
*/
package pivot.wtk.content;
+import java.util.Comparator;
+
import pivot.collections.List;
import pivot.util.Vote;
import pivot.wtk.Bounds;
@@ -254,8 +256,21 @@
String text = textInput.getText();
listItem.setText(text);
+ // Save local reference to members variables before they get cleared
+ ListView listView = this.listView;
+
// Notifying the parent will close the popup
+ Comparator<Object> comparator = listData.getComparator();
+ listData.setComparator(null);
listData.update(index, listItem);
+ listData.setComparator(comparator);
+
+ if (comparator != null) {
+ // Re-select the item, and make sure it's visible
+ int newIndex = listData.indexOf(listItem);
+ listView.setSelectedIndex(newIndex);
+ listView.scrollAreaToVisible(listView.getItemBounds(newIndex));
+ }
}
public void cancel() {