tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkemn...@apache.org
Subject tapestry-5 git commit: Revert "TAP5-2490: the context values are encoded using the encoder, so we also need to use it to decode them", the encoder *parameter* should be used for the value, not for the context values.
Date Thu, 05 Nov 2015 17:08:09 GMT
Repository: tapestry-5
Updated Branches:
  refs/heads/master b72b0e100 -> 2b6debc3c


Revert "TAP5-2490: the context values are encoded using the encoder, so we also need to use
it to decode them", the encoder *parameter* should be used for the value, not for the context
values.

This reverts commit b72b0e100e72c482294f418919f6f4aa7f57c6d3.


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/2b6debc3
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/2b6debc3
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/2b6debc3

Branch: refs/heads/master
Commit: 2b6debc3c5885bda4d13a7578cf7084e2aee2927
Parents: b72b0e1
Author: Jochen Kemnade <jkemnade@apache.org>
Authored: Thu Nov 5 18:06:32 2015 +0100
Committer: Jochen Kemnade <jkemnade@apache.org>
Committed: Thu Nov 5 18:06:32 2015 +0100

----------------------------------------------------------------------
 .../tapestry5/corelib/components/Select.java    |  7 +-
 tapestry-core/src/test/app1/SelectDemo.tml      | 17 +---
 .../tapestry5/integration/app1/FormTests.java   | 12 ---
 .../integration/app1/pages/SelectDemo.java      | 89 --------------------
 4 files changed, 4 insertions(+), 121 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/2b6debc3/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Select.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Select.java
b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Select.java
index 993c3a8..3f5a7f4 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Select.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Select.java
@@ -20,7 +20,6 @@ import org.apache.tapestry5.corelib.data.SecureOption;
 import org.apache.tapestry5.corelib.mixins.RenderDisabled;
 import org.apache.tapestry5.internal.InternalComponentResources;
 import org.apache.tapestry5.internal.TapestryInternalUtils;
-import org.apache.tapestry5.internal.services.ArrayEventContext;
 import org.apache.tapestry5.internal.util.CaptureResultCallback;
 import org.apache.tapestry5.internal.util.SelectModelRenderer;
 import org.apache.tapestry5.ioc.Messages;
@@ -264,7 +263,7 @@ public class Select extends AbstractField
         }
     }
 
-    Object onChange(final EventContext context,
+    Object onChange(final List<Object> context,
                     @RequestParameter(value = "t:selectvalue", allowBlank = true) final String
selectValue)
             throws ValidationException
     {
@@ -272,11 +271,11 @@ public class Select extends AbstractField
 
         CaptureResultCallback<Object> callback = new CaptureResultCallback<Object>();
 
-        Object[] newContext = new Object[context.getCount() + 1];
+        Object[] newContext = new Object[context.size() + 1];
         newContext[0] = newValue;
         for (int i = 1; i < newContext.length; i++)
         {
-            newContext[i] = encoder.toValue(context.get(String.class, i - 1));
+            newContext[i] = context.get(i - 1);
         }
 
 

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/2b6debc3/tapestry-core/src/test/app1/SelectDemo.tml
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/app1/SelectDemo.tml b/tapestry-core/src/test/app1/SelectDemo.tml
index 9e528a0..60a27d4 100644
--- a/tapestry-core/src/test/app1/SelectDemo.tml
+++ b/tapestry-core/src/test/app1/SelectDemo.tml
@@ -8,6 +8,7 @@
 			:
 			<t:select t:id="color" validate="required" blankOption="always"
 				model="literal:Red,Green,Blue" />
+
 		</p>
 		<p>
 			<t:label for="month" />
@@ -23,21 +24,5 @@
 
 	<p> Selected color: ${color}</p>
 	<p> Selected month: ${month}</p>
-	
-	<t:zone>
-		<t:form>
-	
-			<p>
-				<t:label for="number" />
-				:
-				<t:select t:id="number" zone="^"
-					model="numbermodel" context="numbercontext" encoder="numberencoder" />
-			</p>
-	
-		</t:form>
-		
-		<p> Selected number: ${number}</p>
-		<p> Selected number context: ${selectedNumberContext}</p>
-	</t:zone>
 
 </t:border>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/2b6debc3/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
index 553342d..85a3690 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
@@ -1264,16 +1264,4 @@ public class FormTests extends App1TestCase
 
         assertTextPresent("Selected month: August");
     }
-    
-    @Test
-    // TAP5-2490
-    public void select_with_url_encoded_context() throws Exception
-    {
-        openLinks("Select Demo");
-
-        select("number", "label=2");
-
-        assertTextPresent("Selected number: 2");
-        assertTextPresent("Selected number context: 23");
-    }
 }

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/2b6debc3/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/SelectDemo.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/SelectDemo.java
b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/SelectDemo.java
index dad93f0..00c5219 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/SelectDemo.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/SelectDemo.java
@@ -13,8 +13,6 @@
 // limitations under the License.
 package org.apache.tapestry5.integration.app1.pages;
 
-import java.util.List;
-
 import org.apache.tapestry5.PersistenceConstants;
 import org.apache.tapestry5.SelectModel;
 import org.apache.tapestry5.annotations.Persist;
@@ -22,15 +20,6 @@ import org.apache.tapestry5.annotations.Property;
 import org.apache.tapestry5.internal.OptionModelImpl;
 import org.apache.tapestry5.internal.SelectModelImpl;
 
-import org.apache.tapestry5.EventConstants;
-import org.apache.tapestry5.ValueEncoder;
-import org.apache.tapestry5.annotations.InjectComponent;
-import org.apache.tapestry5.annotations.OnEvent;
-import org.apache.tapestry5.annotations.Persist;
-import org.apache.tapestry5.annotations.Property;
-import org.apache.tapestry5.corelib.components.Zone;
-import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
-
 public class SelectDemo
 {
 
@@ -41,11 +30,6 @@ public class SelectDemo
     @Property
     @Persist
     private String month;
-    
-    @Property
-    @Persist
-    private NumberContainer number;
-
 
     @Property
     @Persist(PersistenceConstants.FLASH)
@@ -69,77 +53,4 @@ public class SelectDemo
           );
     }
 
-
-    @Property
-    @Persist
-    private NumberContainer selectedNumberContext;
-    
-    @InjectComponent
-    private Zone zone;
-
-    public List<NumberContainer> getNumberModel(){
-      return CollectionFactory.newList(new NumberContainer(1), new NumberContainer(2));
-    }
-
-    public ValueEncoder<NumberContainer> getNumberEncoder(){
-      return new ValueEncoder<NumberContainer>() {
-
-        @Override
-        public String toClient(NumberContainer value) {
-          return Integer.toString(value.number);
-        }
-
-        @Override
-        public NumberContainer toValue(String clientValue) {
-           return new NumberContainer(Integer.parseInt(clientValue));
-        }
-      };
-    }
-
-    public NumberContainer getNumberContext(){
-      return new NumberContainer(23);
-    }
-
-    @OnEvent(value=EventConstants.VALUE_CHANGED, component="number")
-    Object onValueChangedFromNumber(NumberContainer number, NumberContainer context){
-      selectedNumberContext = context;
-      return zone.getBody();
-    }
-    
-    public static final class NumberContainer {
-      
-      public NumberContainer(int number) {
-        this.number = number;
-      }
-      
-      public final int number;
-
-      @Override
-      public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + number;
-        return result;
-      }
-
-      @Override
-      public boolean equals(Object obj) {
-        if (this == obj)
-          return true;
-        if (obj == null)
-          return false;
-        if (getClass() != obj.getClass())
-          return false;
-        NumberContainer other = (NumberContainer) obj;
-        if (number != other.number)
-          return false;
-        return true;
-      }
-
-      @Override
-      public String toString() {
-        return Integer.toString(number);
-      }
-      
-    }
 }


Mime
View raw message