click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r748850 - in /incubator/click/branches/click-2.0.x: documentation/docs/roadmap-changes.html framework/src/org/apache/click/control/Column.java framework/test/org/apache/click/control/ColumnCompareTest.java
Date Sat, 28 Feb 2009 13:30:15 GMT
Author: sabob
Date: Sat Feb 28 13:30:15 2009
New Revision: 748850

URL: http://svn.apache.org/viewvc?rev=748850&view=rev
Log:
fixed column sorting. backport CLK-489

Modified:
    incubator/click/branches/click-2.0.x/documentation/docs/roadmap-changes.html
    incubator/click/branches/click-2.0.x/framework/src/org/apache/click/control/Column.java
    incubator/click/branches/click-2.0.x/framework/test/org/apache/click/control/ColumnCompareTest.java

Modified: incubator/click/branches/click-2.0.x/documentation/docs/roadmap-changes.html
URL: http://svn.apache.org/viewvc/incubator/click/branches/click-2.0.x/documentation/docs/roadmap-changes.html?rev=748850&r1=748849&r2=748850&view=diff
==============================================================================
--- incubator/click/branches/click-2.0.x/documentation/docs/roadmap-changes.html (original)
+++ incubator/click/branches/click-2.0.x/documentation/docs/roadmap-changes.html Sat Feb 28
13:30:15 2009
@@ -83,6 +83,10 @@
     </div>
     <ul style="padding: 0em; margin-left:0em;margin-bottom: 2em">
       <li class="change">
+          Fixed Column sorting to recognize numbers inside strings
+          [<a target='_blank' href="https://issues.apache.org/click/browse/CLK-489">489</a>].
+      </li>
+      <li class="change">
           Fixed extras <tt>pom.xml</tt> dependencies [<a target='_blank' href="https://issues.apache.org/click/browse/CLK-492">492</a>].
       </li>
     </ul>

Modified: incubator/click/branches/click-2.0.x/framework/src/org/apache/click/control/Column.java
URL: http://svn.apache.org/viewvc/incubator/click/branches/click-2.0.x/framework/src/org/apache/click/control/Column.java?rev=748850&r1=748849&r2=748850&view=diff
==============================================================================
--- incubator/click/branches/click-2.0.x/framework/src/org/apache/click/control/Column.java
(original)
+++ incubator/click/branches/click-2.0.x/framework/src/org/apache/click/control/Column.java
Sat Feb 28 13:30:15 2009
@@ -1563,7 +1563,7 @@
          * @return true if a numeric sort should be used
          */
         protected boolean useNumericSort(String value1, String value2) {
-            return NumberUtils.isNumber(value1) && NumberUtils.isNumber(value2);
+            return NumberUtils.isDigits(value1) && NumberUtils.isDigits(value2);
         }
 
         /**

Modified: incubator/click/branches/click-2.0.x/framework/test/org/apache/click/control/ColumnCompareTest.java
URL: http://svn.apache.org/viewvc/incubator/click/branches/click-2.0.x/framework/test/org/apache/click/control/ColumnCompareTest.java?rev=748850&r1=748849&r2=748850&view=diff
==============================================================================
--- incubator/click/branches/click-2.0.x/framework/test/org/apache/click/control/ColumnCompareTest.java
(original)
+++ incubator/click/branches/click-2.0.x/framework/test/org/apache/click/control/ColumnCompareTest.java
Sat Feb 28 13:30:15 2009
@@ -41,7 +41,7 @@
 
         Column.ColumnComparator comparator = new Column.ColumnComparator(column);
         List rowList = createRowList1();
-        
+
         assertTrue(indexOf("-234", rowList) == 11);
         assertTrue(indexOf(Boolean.TRUE, rowList) == 3);
         assertTrue(indexOf("Data 213 Services", rowList) == 5);
@@ -58,7 +58,7 @@
 
         table.setSortedAscending(false);
         Collections.sort(rowList, comparator);
-        
+
         // Perform spot checks for descending order
         // "-234" should be last
         assertTrue(indexOf("-234", rowList) == rowList.size() - 1);
@@ -93,7 +93,7 @@
 
         table.setSortedAscending(false);
         Collections.sort(rowList, comparator);
-        
+
         // Check sort order for descending
         // null should be last
         assertTrue(indexOf(null, rowList) == rowList.size() - 1);
@@ -104,6 +104,20 @@
     }
 
     /**
+     * Check that Column sorting handles edge cases.
+     */
+    public void test_3() {
+        Column column = new Column("name");
+
+        Table table = new Table("table");
+        table.addColumn(column);
+
+        Column.ColumnComparator comparator = new Column.ColumnComparator(column);
+        List rowList = createRowList3();
+        Collections.sort(rowList, comparator);
+    }
+
+    /**
      * Create and return a test Table row list.
      *
      * @return a test Table row list
@@ -150,6 +164,24 @@
     }
 
     /**
+     * Create and return a test Table row list.
+     *
+     * @return a test Table row list
+     */
+    private List createRowList3() {
+        List rowList = new ArrayList();
+
+        rowList.add(createRow("113L - 7 - 107"));
+        rowList.add(createRow("113D - 7 - 107"));
+        rowList.add(createRow("113d - 7 - 107"));
+        rowList.add(createRow("11i3 - 7 - 107"));
+        rowList.add(createRow("105"));
+        rowList.add(createRow("ABC"));
+
+        return rowList;
+    }
+
+    /**
      * Create and return a map representing a Table row.
      *
      * @param value the of the row



Mime
View raw message