tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject svn commit: r572398 - in /tapestry/tapestry5/trunk/tapestry-core/src: main/java/org/apache/tapestry/internal/TapestryInternalUtils.java test/java/org/apache/tapestry/internal/TapestryInternalUtilsTest.java
Date Mon, 03 Sep 2007 18:04:17 GMT
Author: hlship
Date: Mon Sep  3 11:04:16 2007
New Revision: 572398

URL: http://svn.apache.org/viewvc?rev=572398&view=rev
Log:
TAPESTRY-1597: When a List is converted to a SelectModel, the keys are converted unnecessarily
to strings

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/TapestryInternalUtils.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/TapestryInternalUtilsTest.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/TapestryInternalUtils.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/TapestryInternalUtils.java?rev=572398&r1=572397&r2=572398&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/TapestryInternalUtils.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/TapestryInternalUtils.java
Mon Sep  3 11:04:16 2007
@@ -233,9 +233,9 @@
      */
     public static OptionModel toOptionModel(Object input)
     {
-        String value = (input != null ? String.valueOf(input) : "");
+        String label = (input != null ? String.valueOf(input) : "");
 
-        return new OptionModelImpl(value, false, value);
+        return new OptionModelImpl(label, false, input);
     }
 
     /**

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/TapestryInternalUtilsTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/TapestryInternalUtilsTest.java?rev=572398&r1=572397&r2=572398&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/TapestryInternalUtilsTest.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/TapestryInternalUtilsTest.java
Mon Sep  3 11:04:16 2007
@@ -216,7 +216,7 @@
         OptionModel model = TapestryInternalUtils.toOptionModel(object);
 
         assertEquals(model.getLabel(), "27");
-        assertEquals(model.getValue(), "27");
+        assertEquals(model.getValue(), object);
     }
 
     @Test
@@ -235,7 +235,7 @@
         assertEquals(options.get(0).getValue(), "A");
 
         assertEquals(options.get(1).getLabel(), "");
-        assertEquals(options.get(1).getValue(), "");
+        assertEquals(options.get(1).getValue(), null);
 
         assertEquals(options.get(2).getLabel(), "C");
         assertEquals(options.get(2).getValue(), "C");



Mime
View raw message