You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by sm...@apache.org on 2013/02/14 18:30:39 UTC

svn commit: r1446280 - in /pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk: ListView.java TableView.java

Author: smartini
Date: Thu Feb 14 17:30:38 2013
New Revision: 1446280

URL: http://svn.apache.org/r1446280
Log:
ensure to set the selectedIndex only if in the right range, for tables and lists ... as seen in some (adge and strange) cases with Brendan

Modified:
    pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/ListView.java
    pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/TableView.java

Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/ListView.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/ListView.java?rev=1446280&r1=1446279&r2=1446280&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/ListView.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/ListView.java Thu Feb 14 17:30:38 2013
@@ -783,7 +783,10 @@ public class ListView extends Component 
         if (index == -1) {
             clearSelection();
         } else {
-            setSelectedRange(index, index);
+            int listDataLength = listData.getLength();
+            if (listDataLength > 0 && index < listDataLength) {
+                setSelectedRange(index, index);
+            }
         }
     }
 

Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/TableView.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/TableView.java?rev=1446280&r1=1446279&r2=1446280&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/TableView.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/TableView.java Thu Feb 14 17:30:38 2013
@@ -1413,7 +1413,10 @@ public class TableView extends Component
         if (index == -1) {
             clearSelection();
         } else {
-            setSelectedRange(index, index);
+            int tableDataLength = tableData.getLength();
+            if (tableDataLength > 0 && index < tableDataLength) {
+                setSelectedRange(index, index);
+            }
         }
     }