tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From freem...@apache.org
Subject svn commit: r503777 [3/4] - in /tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support: ./ .settings/ src/main/java/org/apache/tapestry/ src/main/java/org/apache/tapestry/annotations/ src/main/java/org/apache/tapestry/beaneditor/ src/main/ja...
Date Mon, 05 Feb 2007 17:15:44 GMT
Modified: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/main/java/org/apache/tapestry/validator/Min.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/main/java/org/apache/tapestry/validator/Min.java?view=diff&rev=503777&r1=503776&r2=503777
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/main/java/org/apache/tapestry/validator/Min.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/main/java/org/apache/tapestry/validator/Min.java Mon Feb  5 09:15:39 2007
@@ -14,17 +14,23 @@
 
 package org.apache.tapestry.validator;
 
+import java.io.Serializable;
+
 import org.apache.tapestry.Field;
 import org.apache.tapestry.ValidationException;
 import org.apache.tapestry.Validator;
 import org.apache.tapestry.ioc.MessageFormatter;
 
 /* A vaidator that enforces that a number is greater than some minimum integer value. */
-public class Min implements Validator<Long, Number>
+public class Min implements Validator<Number>, Serializable
 {
-    public Class<Long> getConstraintType()
+    private static final long serialVersionUID = 1L;
+    
+    private long _min;
+
+    public Min(long min)
     {
-        return Long.class;
+        _min = min;
     }
 
     public String getMessageKey()
@@ -32,20 +38,15 @@
         return "min-integer";
     }
 
-    public Class<Number> getValueType()
-    {
-        return Number.class;
-    }
-
     public boolean invokeIfBlank()
     {
         return false;
     }
 
-    public void validate(Field field, Long constraintValue, MessageFormatter formatter, Number value)
+    public void validate(Field field, MessageFormatter formatter, Number value)
             throws ValidationException
     {
-        if (value.longValue() < constraintValue)
-            throw new ValidationException(formatter.format(constraintValue, field.getLabel()));
+        if (value.longValue() < _min)
+            throw new ValidationException(formatter.format(_min, field.getLabel()));
     }
 }

Modified: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/main/java/org/apache/tapestry/validator/MinLength.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/main/java/org/apache/tapestry/validator/MinLength.java?view=diff&rev=503777&r1=503776&r2=503777
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/main/java/org/apache/tapestry/validator/MinLength.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/main/java/org/apache/tapestry/validator/MinLength.java Mon Feb  5 09:15:39 2007
@@ -14,6 +14,8 @@
 
 package org.apache.tapestry.validator;
 
+import java.io.Serializable;
+
 import org.apache.tapestry.Field;
 import org.apache.tapestry.ValidationException;
 import org.apache.tapestry.Validator;
@@ -22,23 +24,26 @@
 /**
  * Validates that a string value has a minimum length.
  */
-public final class MinLength implements Validator<Integer, String>
+public final class MinLength implements Validator<String>, Serializable
 {
+    private static final long serialVersionUID = 1L;
+
+    private int _minLength;
+
+    public MinLength(int minLength)
+    {
+        _minLength = minLength;
+    }
     public String getMessageKey()
     {
         return "minimum-string-length";
     }
 
-    public void validate(Field field, Integer constraintValue, MessageFormatter formatter,
+    public void validate(Field field, MessageFormatter formatter,
             String value) throws ValidationException
     {
-        if (value.length() < constraintValue)
-            throw new ValidationException(formatter.format(constraintValue, field.getLabel()));
-    }
-
-    public Class<Integer> getConstraintType()
-    {
-        return Integer.class;
+        if (value.length() < _minLength)
+            throw new ValidationException(formatter.format(_minLength, field.getLabel()));
     }
 
     public boolean invokeIfBlank()
@@ -46,8 +51,4 @@
         return false;
     }
 
-    public Class<String> getValueType()
-    {
-        return String.class;
-    }
 }

Modified: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/main/java/org/apache/tapestry/validator/Required.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/main/java/org/apache/tapestry/validator/Required.java?view=diff&rev=503777&r1=503776&r2=503777
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/main/java/org/apache/tapestry/validator/Required.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/main/java/org/apache/tapestry/validator/Required.java Mon Feb  5 09:15:39 2007
@@ -14,6 +14,8 @@
 
 package org.apache.tapestry.validator;
 
+import java.io.Serializable;
+
 import org.apache.tapestry.Field;
 import org.apache.tapestry.ValidationException;
 import org.apache.tapestry.Validator;
@@ -23,32 +25,25 @@
  * A validator that enforces that the value is not null and not the empty string. This validator is
  * not configurable.
  */
-public final class Required implements Validator<Void, Object>
+public final class Required implements Validator<Object>, Serializable
 {
+    private static final long serialVersionUID = 1L;
+
     public String getMessageKey()
     {
         return "required";
     }
 
-    public void validate(Field field, Void constraintValue, MessageFormatter formatter, Object value)
+    public void validate(Field field, MessageFormatter formatter, Object value)
             throws ValidationException
     {
         if (value == null || value.toString().equals(""))
             throw new ValidationException(formatter.format(field.getLabel()));
     }
 
-    public Class<Void> getConstraintType()
-    {
-        return null;
-    }
-
     public boolean invokeIfBlank()
     {
         return true;
     }
 
-    public Class<Object> getValueType()
-    {
-        return Object.class;
-    }
 }

Modified: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/main/resources/org/apache/tapestry/internal/ValidationMessages.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/main/resources/org/apache/tapestry/internal/ValidationMessages.properties?view=diff&rev=503777&r1=503776&r2=503777
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/main/resources/org/apache/tapestry/internal/ValidationMessages.properties (original)
+++ tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/main/resources/org/apache/tapestry/internal/ValidationMessages.properties Mon Feb  5 09:15:39 2007
@@ -19,6 +19,7 @@
 minimum-string-length=You must provide at least %d characters for %s.
 maximum-string-length=You may provide at most %d characters for %s.
 min-integer=%2$s requires a value of at least %1$d. 
+max-integer=%2$s requires a value of at most %1$d. 
 
 # This is where the translator messages go.
 

Modified: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/app1/WEB-INF/BlockDemo.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/app1/WEB-INF/BlockDemo.html?view=diff&rev=503777&r1=503776&r2=503777
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/app1/WEB-INF/BlockDemo.html (original)
+++ tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/app1/WEB-INF/BlockDemo.html Mon Feb  5 09:15:39 2007
@@ -8,7 +8,7 @@
 </p>    
     
     <form t:type="Form">
-        <select t:type="Select" t:id="blockName" model="',fred,barney'" onchange="this.form.submit();"/> <label t:type="Label" for="blockName">Block to display</label>
+        <select t:id="blockName" onchange="this.form.submit();"/> <label t:type="Label" for="blockName">Block to display</label>
     </form>
     
     <p>The block: [<t:comp type="Render" value="blockToRender"/>]</p>

Modified: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/app1/WEB-INF/PasswordFieldDemo.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/app1/WEB-INF/PasswordFieldDemo.html?view=diff&rev=503777&r1=503776&r2=503777
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/app1/WEB-INF/PasswordFieldDemo.html (original)
+++ tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/app1/WEB-INF/PasswordFieldDemo.html Mon Feb  5 09:15:39 2007
@@ -8,10 +8,10 @@
         <span t:type="Errors"/>
 
         <label t:type="Label" for="userName"/>
-        <input t:type="TextField" t:id="userName" t:validate="required" size="30"/>
+        <input t:id="userName" size="30"/>
         <br/>
         <label t:type="Label" for="password"/>
-        <input t:id="password" t:validate="required" size="30"/>
+        <input t:id="password" size="30"/>
         <br/>
         <input type="submit" value="Login"/>
     </form>

Modified: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/app1/WEB-INF/SimpleForm.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/app1/WEB-INF/SimpleForm.html?view=diff&rev=503777&r1=503776&r2=503777
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/app1/WEB-INF/SimpleForm.html (original)
+++ tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/app1/WEB-INF/SimpleForm.html Mon Feb  5 09:15:39 2007
@@ -11,25 +11,21 @@
         <div class="t-beaneditor">
             
             <label id="l2" t:type="Label" for="email">This isn't used</label>
-            <input t:type="TextField"
-                t:id="email" value="incident.email" size="50" disabled="disabled"/>
+            <input 
+                t:id="email" size="50"/>
             <br/>
             <label id="l3" t:type="Label" for="message"/>
-            <input t:type="TextArea" t:id="message"
-                label="Incident Message" value="incident.message" cols="50" rows="10"
-                disabled="disabled"> You can put text here, but it isn't used. </input>
+            <input t:id="message"
+                cols="50" rows="10"> You can put text here, but it isn't used. </input>
             <br/>
             <label id="l4" t:type="Label" for="operatingSystem"/>
-            <select t:type="Select"
-                t:id="operatingSystem" value="incident.operatingSystem" model="message:os-values"
-                disabled="disabled"/>
+            <select t:id="operatingSystem" />
             <br/>
             <label id="l5" t:type="Label" for="department"/>
-            <select t:type="Select" t:id="department"
-                value="incident.department" disabled="disabled"/>
+            <select t:id="department"/>
             <br/>
             <label id="l6" t:type="Label" for="urgent"/>
-            <input t:type="Checkbox" t:id="urgent" value="incident.urgent" disabled="disabled"/>
+            <input t:id="urgent"/>
             <br/>
             <input type="submit"/></div>
     </form>

Modified: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/app1/WEB-INF/ToDoList.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/app1/WEB-INF/ToDoList.html?view=diff&rev=503777&r1=503776&r2=503777
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/app1/WEB-INF/ToDoList.html (original)
+++ tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/app1/WEB-INF/ToDoList.html Mon Feb  5 09:15:39 2007
@@ -13,8 +13,7 @@
             </tr>
             <tr t:type="Loop" source="items" value="item" encoder="encoder">
                 <td>
-                    <input t:type="TextField" t:id="title" value="item.title" size="30"
-                        validate="required"/>
+                    <input t:id="title" size="30"/>
                 </td>
                 <td> NOT YET </td>            
             </tr>

Modified: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/app1/WEB-INF/ToDoListVolatile.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/app1/WEB-INF/ToDoListVolatile.html?view=diff&rev=503777&r1=503776&r2=503777
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/app1/WEB-INF/ToDoListVolatile.html (original)
+++ tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/app1/WEB-INF/ToDoListVolatile.html Mon Feb  5 09:15:39 2007
@@ -13,8 +13,7 @@
             </tr>
             <tr t:type="Loop" source="items" value="item" volatile="true">
                 <td>
-                    <input t:type="TextField" t:id="title" value="item.title" size="30"
-                        validate="required"/>
+                    <input t:id="title" size="30"/>
                 </td>
                 <td> NOT YET </td>            
             </tr>

Added: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/BindingExprValueConduitTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/BindingExprValueConduitTest.java?view=auto&rev=503777
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/BindingExprValueConduitTest.java (added)
+++ tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/BindingExprValueConduitTest.java Mon Feb  5 09:15:39 2007
@@ -0,0 +1,83 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+
+package org.apache.tapestry;
+
+import org.apache.tapestry.internal.bindings.LiteralBinding;
+import org.apache.tapestry.internal.services.NoOpComponentResources;
+import org.apache.tapestry.runtime.ComponentResourcesAware;
+import org.apache.tapestry.services.BindingSource;
+import org.apache.tapestry.services.NoOpBindingSource;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public class BindingExprValueConduitTest extends Assert
+{
+    public static class MyComponent implements BindingSourceProvider, ComponentResourcesAware
+    {
+        private ComponentResources _resources;
+
+        private BindingSource _bindingSource;
+
+        public MyComponent(ComponentResources resources, BindingSource bindingSource)
+        {
+            _resources = resources;
+            _bindingSource = bindingSource;
+        }
+
+        public ComponentResources getComponentResources()
+        {
+            return _resources;
+        }
+
+        public BindingSource getBindingSource()
+        {
+            return _bindingSource;
+        }
+
+    }
+
+    @Test
+    public void test()
+    {
+        final ComponentResources containerResources = new NoOpComponentResources();
+        NoOpComponentResources componentResources = new NoOpComponentResources()
+        {
+
+            @Override
+            public ComponentResources getContainerResources()
+            {
+                return containerResources;
+            }
+
+        };
+        BindingSource bindingSource = new NoOpBindingSource()
+        {
+
+            @Override
+            public Binding newBinding(String description, ComponentResources container,
+                    String expression)
+            {
+                assertSame(container, containerResources);
+                return new LiteralBinding("", "[" + expression + "]", null);
+            }
+
+        };
+        MyComponent component = new MyComponent(componentResources, bindingSource);
+        BindingExprValueConduit conduit = new BindingExprValueConduit("foo");
+        assertEquals(conduit.get(component), "[foo]");
+
+    }
+}

Propchange: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/BindingExprValueConduitTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/EnumSelectModelTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/EnumSelectModelTest.java?view=diff&rev=503777&r1=503776&r2=503777
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/EnumSelectModelTest.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/EnumSelectModelTest.java Mon Feb  5 09:15:39 2007
@@ -30,9 +30,9 @@
 
         replay();
 
-        SelectModel model = new EnumSelectModel(Stooge.class, messages);
+        SelectModel<Stooge> model = new EnumSelectModel<Stooge>(Stooge.class, messages);
 
-        List<OptionModel> options = model.getOptions();
+        List<OptionModel<Stooge>> options = model.getOptions();
 
         assertEquals(options.size(), 3);
 
@@ -54,9 +54,9 @@
 
         replay();
 
-        SelectModel model = new EnumSelectModel(Stooge.class, messages);
+        SelectModel<Stooge> model = new EnumSelectModel<Stooge>(Stooge.class, messages);
 
-        List<OptionModel> options = model.getOptions();
+        List<OptionModel<Stooge>> options = model.getOptions();
 
         assertEquals(options.size(), 3);
 
@@ -78,9 +78,9 @@
 
         replay();
 
-        SelectModel model = new EnumSelectModel(Stooge.class, messages);
+        SelectModel<Stooge> model = new EnumSelectModel<Stooge>(Stooge.class, messages);
 
-        List<OptionModel> options = model.getOptions();
+        List<OptionModel<Stooge>> options = model.getOptions();
 
         assertEquals(options.size(), 3);
 
@@ -91,7 +91,7 @@
         verify();
     }
 
-    private void checkOption(List<OptionModel> options, int i, String label, Stooge value)
+    private void checkOption(List<OptionModel<Stooge>> options, int i, String label, Stooge value)
     {
         OptionModel model = options.get(i);
 

Added: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/corelib/base/RestorePropertiesActionTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/corelib/base/RestorePropertiesActionTest.java?view=auto&rev=503777
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/corelib/base/RestorePropertiesActionTest.java (added)
+++ tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/corelib/base/RestorePropertiesActionTest.java Mon Feb  5 09:15:39 2007
@@ -0,0 +1,64 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.corelib.base;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public class RestorePropertiesActionTest extends Assert
+{
+    public static class Foo
+    {
+        int v1;
+
+        String _v2;
+
+        public void setV1(int v1)
+        {
+            this.v1 = v1;
+        }
+
+        public void setV2(String v2)
+        {
+            this._v2 = v2;
+        }
+
+        public int getV1()
+        {
+            return v1;
+        }
+
+        public String getV2()
+        {
+            return _v2;
+        }
+
+    }
+
+    @Test
+    public void restore()
+    {
+        Foo foo1 = new Foo();
+        foo1.v1 = 100;
+        foo1._v2 = "hello";
+        RestorePropertiesAction<Object> action = new RestorePropertiesAction<Object>(foo1, "v1",
+                "v2");
+        Foo foo2 = new Foo();
+        action.execute(foo2);
+        assertEquals(foo2.v1, 100);
+        assertEquals(foo2._v2, "hello");
+
+    }
+}

Propchange: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/corelib/base/RestorePropertiesActionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/corelib/components/SelectTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/corelib/components/SelectTest.java?view=diff&rev=503777&r1=503776&r2=503777
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/corelib/components/SelectTest.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/corelib/components/SelectTest.java Mon Feb  5 09:15:39 2007
@@ -23,6 +23,7 @@
 import java.util.List;
 import java.util.Map;
 
+import org.apache.tapestry.ConstantValueConduit;
 import org.apache.tapestry.MarkupWriter;
 import org.apache.tapestry.OptionGroupModel;
 import org.apache.tapestry.OptionModel;
@@ -46,9 +47,9 @@
     @Test
     public void empty_model()
     {
-        Select select = new Select();
+        Select<Object> select = new Select<Object>();
 
-        select.setModel(new SelectModelImpl(null, null));
+        select.setModel(new SelectModelImpl<Object>(null, null));
 
         select.options(null);
     }
@@ -79,21 +80,16 @@
     @Test
     public void just_options() throws Exception
     {
-        List<OptionModel> options = TapestryUtils
+        List<OptionModel<String>> options = TapestryUtils
                 .toOptionModels("fred=Fred Flintstone,barney=Barney Rubble");
 
-        Select select = new Select();
-
-        select.setModel(new SelectModelImpl(null, options));
-        select.setValue("barney");
-
+        Select<String> select = new Select<String>();
+        select.setModel(new SelectModelImpl<String>(null, options));
+        select.setValueConduit(new ConstantValueConduit<String>("barney"));
         MarkupWriter writer = new MarkupWriterImpl(new XMLMarkupModel(), null);
-
-        writer.element("select");
-
+        select.beginRender(writer);
         select.options(writer);
-
-        writer.end();
+        select.afterRender(writer);
 
         assertEquals(writer.toString(), read("just_options.html"));
     }
@@ -103,21 +99,19 @@
     {
         // Extra cast needed for Sun compiler, not Eclipse compiler.
 
-        List<OptionModel> options = Arrays.asList((OptionModel) new OptionModelImpl("Fred", false,
-                "fred", "class", "pixie"));
+        List<OptionModel<String>> options = Arrays
+                .asList((OptionModel<String>) new OptionModelImpl<String>("Fred", false, "fred",
+                        "class", "pixie"));
 
-        Select select = new Select();
+        Select<String> select = new Select<String>();
 
-        select.setModel(new SelectModelImpl(null, options));
-        select.setValue("barney");
+        select.setModel(new SelectModelImpl<String>(null, options));
+        select.setValueConduit(new ConstantValueConduit<String>("barney"));
 
         MarkupWriter writer = new MarkupWriterImpl(new XMLMarkupModel(), null);
-
-        writer.element("select");
-
+        select.beginRender(writer);
         select.options(writer);
-
-        writer.end();
+        select.afterRender(writer);
 
         assertEquals(writer.toString(), read("option_attributes.html"));
     }
@@ -127,21 +121,19 @@
     {
         // Extra cast needed for Sun compiler, not Eclipse compiler.
 
-        List<OptionModel> options = CollectionFactory.newList((OptionModel) new OptionModelImpl(
-                "Fred", true, "fred", "class", "pixie"));
+        List<OptionModel<String>> options = CollectionFactory
+                .newList((OptionModel<String>) new OptionModelImpl<String>("Fred", true, "fred",
+                        "class", "pixie"));
 
-        Select select = new Select();
+        Select<String> select = new Select<String>();
 
-        select.setModel(new SelectModelImpl(null, options));
-        select.setValue("barney");
+        select.setModel(new SelectModelImpl<String>(null, options));
+        select.setValueConduit(new ConstantValueConduit<String>("barney"));
 
         MarkupWriter writer = new MarkupWriterImpl(new XMLMarkupModel(), null);
-
-        writer.element("select");
-
+        select.beginRender(writer);
         select.options(writer);
-
-        writer.end();
+        select.afterRender(writer);
 
         assertEquals(writer.toString(), read("disabled_option.html"));
 
@@ -150,24 +142,21 @@
     @Test
     public void option_groups() throws Exception
     {
-        OptionGroupModel husbands = new OptionGroupModelImpl("Husbands", false, TapestryUtils
-                .toOptionModels("Fred,Barney"));
-        OptionGroupModel wives = new OptionGroupModelImpl("Wives", true, TapestryUtils
-                .toOptionModels("Wilma,Betty"));
-        List<OptionGroupModel> groupModels = CollectionFactory.newList(husbands, wives);
+        OptionGroupModel<String> husbands = new OptionGroupModelImpl<String>("Husbands", false,
+                TapestryUtils.toOptionModels("Fred,Barney"));
+        OptionGroupModel<String> wives = new OptionGroupModelImpl<String>("Wives", true,
+                TapestryUtils.toOptionModels("Wilma,Betty"));
+        List<OptionGroupModel<String>> groupModels = CollectionFactory.newList(husbands, wives);
 
-        Select select = new Select();
+        Select<String> select = new Select<String>();
 
-        select.setModel(new SelectModelImpl(groupModels, null));
-        select.setValue("Fred");
+        select.setModel(new SelectModelImpl<String>(groupModels, null));
+        select.setValueConduit(new ConstantValueConduit<String>("Fred"));
 
         MarkupWriter writer = new MarkupWriterImpl(new XMLMarkupModel(), null);
-
-        writer.element("select");
-
+        select.beginRender(writer);
         select.options(writer);
-
-        writer.end();
+        select.afterRender(writer);
 
         assertEquals(writer.toString(), read("option_groups.html"));
     }
@@ -175,22 +164,19 @@
     @Test
     public void option_groups_precede_ungroup_options() throws Exception
     {
-        OptionGroupModel husbands = new OptionGroupModelImpl("Husbands", false, TapestryUtils
-                .toOptionModels("Fred,Barney"));
+        OptionGroupModel<String> husbands = new OptionGroupModelImpl<String>("Husbands", false,
+                TapestryUtils.toOptionModels("Fred,Barney"));
 
-        Select select = new Select();
+        Select<String> select = new Select<String>();
 
-        select.setModel(new SelectModelImpl(Collections.singletonList(husbands), TapestryUtils
-                .toOptionModels("Wilma,Betty")));
-        select.setValue("Fred");
+        select.setModel(new SelectModelImpl<String>(Collections.singletonList(husbands),
+                TapestryUtils.toOptionModels("Wilma,Betty")));
+        select.setValueConduit(new ConstantValueConduit<String>("Fred"));
 
         MarkupWriter writer = new MarkupWriterImpl(new XMLMarkupModel(), null);
-
-        writer.element("select");
-
+        select.beginRender(writer);
         select.options(writer);
-
-        writer.end();
+        select.afterRender(writer);
 
         assertEquals(writer.toString(), read("option_groups_precede_ungroup_options.html"));
     }
@@ -200,21 +186,18 @@
     {
         Map<String, String> attributes = Collections.singletonMap("class", "pixie");
 
-        OptionGroupModel husbands = new OptionGroupModelImpl("Husbands", false, TapestryUtils
+        OptionGroupModel<String> husbands = new OptionGroupModelImpl<String>("Husbands", false, TapestryUtils
                 .toOptionModels("Fred,Barney"), attributes);
 
-        Select select = new Select();
+        Select<String> select = new Select<String>();
 
-        select.setModel(new SelectModelImpl(Collections.singletonList(husbands), null));
-        select.setValue("Fred");
+        select.setModel(new SelectModelImpl<String>(Collections.singletonList(husbands), null));
+        select.setValueConduit(new ConstantValueConduit<String>("Fred"));
 
         MarkupWriter writer = new MarkupWriterImpl(new XMLMarkupModel(), null);
-
-        writer.element("select");
-
+        select.beginRender(writer);
         select.options(writer);
-
-        writer.end();
+        select.afterRender(writer);
 
         assertEquals(writer.toString(), read("option_group_attributes.html"));
     }

Modified: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app1/data/RegistrationData.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app1/data/RegistrationData.java?view=diff&rev=503777&r1=503776&r2=503777
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app1/data/RegistrationData.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app1/data/RegistrationData.java Mon Feb  5 09:15:39 2007
@@ -14,8 +14,11 @@
 
 package org.apache.tapestry.integration.app1.data;
 
+import org.apache.tapestry.beaneditor.LengthRange;
+import org.apache.tapestry.beaneditor.Max;
+import org.apache.tapestry.beaneditor.Min;
 import org.apache.tapestry.beaneditor.Order;
-import org.apache.tapestry.beaneditor.Validate;
+import org.apache.tapestry.beaneditor.Required;
 
 public class RegistrationData
 {
@@ -30,7 +33,8 @@
     private boolean _citizen;
 
     @Order(300)
-    @Validate("min=1900,max=2007")
+    @Min(1900)
+    @Max(2007)
     public int getBirthYear()
     {
         return _birthYear;
@@ -47,13 +51,15 @@
     }
 
     @Order(100)
-    @Validate("required,minlength=3")
+    @Required
+    @LengthRange(minLength=3)
     public void setFirstName(String firstName)
     {
         _firstName = firstName;
     }
 
-    @Validate("required,minlength=5")
+    @Required
+    @LengthRange(minLength=5)
     public String getLastName()
     {
         return _lastName;

Modified: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app1/pages/BlockDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app1/pages/BlockDemo.java?view=diff&rev=503777&r1=503776&r2=503777
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app1/pages/BlockDemo.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app1/pages/BlockDemo.java Mon Feb  5 09:15:39 2007
@@ -17,15 +17,21 @@
 import java.util.Map;
 
 import org.apache.tapestry.Block;
+import org.apache.tapestry.annotations.Component;
 import org.apache.tapestry.annotations.ComponentClass;
 import org.apache.tapestry.annotations.Inject;
 import org.apache.tapestry.annotations.Persist;
 import org.apache.tapestry.annotations.Retain;
+import org.apache.tapestry.corelib.components.Select;
+import org.apache.tapestry.internal.TapestryUtils;
 import org.apache.tapestry.ioc.internal.util.CollectionFactory;
 
 @ComponentClass
 public class BlockDemo
 {
+    @Component(id="blockName")
+    private Select<String> _blockNameField;
+    
     @Inject
     private Block _fred;
 
@@ -61,4 +67,9 @@
         _blockName = blockName;
     }
 
+    public void configureBlockName()
+    {
+        _blockNameField.useDefaultEncoder(String.class);
+        _blockNameField.setModel(TapestryUtils.toSelectModel(",fred,barney"));
+    }
 }

Modified: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app1/pages/PasswordFieldDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app1/pages/PasswordFieldDemo.java?view=diff&rev=503777&r1=503776&r2=503777
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app1/pages/PasswordFieldDemo.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app1/pages/PasswordFieldDemo.java Mon Feb  5 09:15:39 2007
@@ -20,11 +20,16 @@
 import org.apache.tapestry.annotations.Retain;
 import org.apache.tapestry.corelib.components.Form;
 import org.apache.tapestry.corelib.components.PasswordField;
+import org.apache.tapestry.corelib.components.TextField;
 import org.apache.tapestry.integration.app1.services.UserAuthenticator;
+import org.apache.tapestry.validator.Required;
 
 @ComponentClass
 public class PasswordFieldDemo
 {
+    @Component(id="userName")
+    private TextField<String> _userNameField;
+    
     @Retain
     private String _userName;
 
@@ -36,7 +41,7 @@
     private UserAuthenticator _authenticator;
 
     @Component(id = "password")
-    private PasswordField _passwordField;
+    private PasswordField<String> _passwordField;
 
     @Component
     private Form _form;
@@ -72,4 +77,12 @@
         _userName = userName;
     }
 
+    public void configureUserName()
+    {
+        _userNameField.setValidators(new Required());
+    }
+    public void configurePassword()
+    {
+        _passwordField.setValidators(new Required());
+    }
 }

Modified: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app1/pages/SimpleForm.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app1/pages/SimpleForm.java?view=diff&rev=503777&r1=503776&r2=503777
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app1/pages/SimpleForm.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app1/pages/SimpleForm.java Mon Feb  5 09:15:39 2007
@@ -14,13 +14,78 @@
 
 package org.apache.tapestry.integration.app1.pages;
 
+import org.apache.tapestry.ComponentResources;
+import org.apache.tapestry.annotations.Component;
 import org.apache.tapestry.annotations.ComponentClass;
+import org.apache.tapestry.annotations.Inject;
 import org.apache.tapestry.annotations.Persist;
+import org.apache.tapestry.corelib.components.Checkbox;
+import org.apache.tapestry.corelib.components.Select;
+import org.apache.tapestry.corelib.components.TextArea;
+import org.apache.tapestry.corelib.components.TextField;
+import org.apache.tapestry.integration.app1.data.Department;
 import org.apache.tapestry.integration.app1.data.IncidentData;
+import org.apache.tapestry.internal.TapestryUtils;
+import org.apache.tapestry.validator.Required;
 
 @ComponentClass
 public class SimpleForm
 {
+    @Component
+    private TextField<String> _email;
+
+    @Component
+    private TextArea<String> _message;
+
+    @Component
+    private Select<Department> _department;
+
+    @Component
+    private Select<String> _operatingSystem;
+
+    @Component
+    private Checkbox _urgent;
+
+    public void configureEmail()
+    {
+        _email.setValueBindingExpr("incident.email");
+        _email.setValidators(new Required());
+        _email.setDisabled(_disabled);
+    }
+
+    public void configureMessage()
+    {
+        _message.setValueBindingExpr("incident.message");
+        _message.setValidators(new Required());
+        _message.setLabel("Incident Message");
+        _message.setDisabled(_disabled);
+    }
+
+    public void configureDepartment()
+    {
+        _department.setValueBindingExpr("incident.department");
+        _department.setDisabled(_disabled);
+        _department.useDefaultsFor(Department.class);
+    }
+
+    @Inject
+    private ComponentResources _resources;
+
+    public void configureOperatingSystem()
+    {
+        _operatingSystem.setValueBindingExpr("incident.operatingSystem");
+        _operatingSystem.setDisabled(_disabled);
+        _operatingSystem.setModel(TapestryUtils.toSelectModel(_resources.getMessages().get(
+                "os-values")));
+        _operatingSystem.useDefaultEncoder(String.class);
+    }
+
+    public void configureUrgent()
+    {
+        _urgent.setValueBindingExpr("incident.urgent");
+        _urgent.setDisabled(_disabled);
+    }
+
     @Persist
     private IncidentData _incident;
 

Modified: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app1/pages/ToDoList.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app1/pages/ToDoList.java?view=diff&rev=503777&r1=503776&r2=503777
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app1/pages/ToDoList.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app1/pages/ToDoList.java Mon Feb  5 09:15:39 2007
@@ -22,12 +22,17 @@
 import org.apache.tapestry.annotations.ComponentClass;
 import org.apache.tapestry.annotations.Inject;
 import org.apache.tapestry.corelib.components.Form;
+import org.apache.tapestry.corelib.components.TextField;
 import org.apache.tapestry.integration.app1.data.ToDoItem;
 import org.apache.tapestry.integration.app1.services.ToDoDatabase;
+import org.apache.tapestry.validator.Required;
 
 @ComponentClass
 public class ToDoList
 {
+    @Component
+    private TextField<String> _title;
+
     @Inject
     private ToDoDatabase _database;
 
@@ -101,5 +106,11 @@
     void onActionFromReset()
     {
         _database.reset();
+    }
+
+    public void configureTitle()
+    {
+        _title.setValueBindingExpr("item.title");
+        _title.setValidators(new Required());
     }
 }

Modified: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app1/pages/ToDoListVolatile.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app1/pages/ToDoListVolatile.java?view=diff&rev=503777&r1=503776&r2=503777
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app1/pages/ToDoListVolatile.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app1/pages/ToDoListVolatile.java Mon Feb  5 09:15:39 2007
@@ -20,12 +20,17 @@
 import org.apache.tapestry.annotations.ComponentClass;
 import org.apache.tapestry.annotations.Inject;
 import org.apache.tapestry.corelib.components.Form;
+import org.apache.tapestry.corelib.components.TextField;
 import org.apache.tapestry.integration.app1.data.ToDoItem;
 import org.apache.tapestry.integration.app1.services.ToDoDatabase;
+import org.apache.tapestry.validator.Required;
 
 @ComponentClass
 public class ToDoListVolatile
 {
+    @Component
+    private TextField<String> _title;
+    
     @Inject
     private ToDoDatabase _database;
 
@@ -87,5 +92,11 @@
     void onActionFromReset()
     {
         _database.reset();
+    }
+    
+    public void configureTitle()
+    {
+        _title.setValueBindingExpr("item.title");
+        _title.setValidators(new Required());
     }
 }

Modified: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app1/pages/ValidForm.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app1/pages/ValidForm.java?view=diff&rev=503777&r1=503776&r2=503777
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app1/pages/ValidForm.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app1/pages/ValidForm.java Mon Feb  5 09:15:39 2007
@@ -14,13 +14,54 @@
 
 package org.apache.tapestry.integration.app1.pages;
 
+import org.apache.tapestry.annotations.Component;
 import org.apache.tapestry.annotations.ComponentClass;
 import org.apache.tapestry.annotations.Persist;
+import org.apache.tapestry.corelib.components.Checkbox;
+import org.apache.tapestry.corelib.components.TextArea;
+import org.apache.tapestry.corelib.components.TextField;
 import org.apache.tapestry.integration.app1.data.IncidentData;
+import org.apache.tapestry.validator.Required;
 
 @ComponentClass
 public class ValidForm
 {
+    @Component
+    private TextField<String> _email;
+
+    @Component
+    private TextArea<String> _message;
+
+    @Component
+    private Checkbox _urgent;
+
+    @Component
+    private TextField<Integer> _hours;
+
+    public void configureEmail()
+    {
+        _email.setValueBindingExpr("incident.email");
+        _email.setValidators(new Required());
+    }
+
+    public void configureMessage()
+    {
+        _message.setValueBindingExpr("incident.message");
+        _message.setValidators(new Required());
+        _message.setLabel("Incident Message");
+    }
+
+    public void configureUrgent()
+    {
+        _urgent.setValueBindingExpr("incident.urgent");
+    }
+
+    public void configureHours()
+    {
+        _hours.setValueBindingExpr("incident.hours");
+        _hours.setValidators(new Required());
+    }
+
     @Persist
     private IncidentData _incident;
 

Modified: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app2/pages/TestPageForForm.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app2/pages/TestPageForForm.java?view=diff&rev=503777&r1=503776&r2=503777
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app2/pages/TestPageForForm.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app2/pages/TestPageForForm.java Mon Feb  5 09:15:39 2007
@@ -14,12 +14,22 @@
 
 package org.apache.tapestry.integration.app2.pages;
 
+import org.apache.tapestry.annotations.Component;
 import org.apache.tapestry.annotations.ComponentClass;
 import org.apache.tapestry.annotations.Persist;
+import org.apache.tapestry.corelib.components.TextField;
 
 @ComponentClass
 public class TestPageForForm
 {
+    @Component
+    private TextField _t1;
+
+    public void configureT1()
+    {
+        _t1.setValueBindingExpr("value");
+    }
+
     @Persist
     private String value;
 

Added: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app2/pages/TestPageForSelect.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app2/pages/TestPageForSelect.java?view=auto&rev=503777
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app2/pages/TestPageForSelect.java (added)
+++ tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app2/pages/TestPageForSelect.java Mon Feb  5 09:15:39 2007
@@ -0,0 +1,112 @@
+// Copyright 2006 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.integration.app2.pages;
+
+import java.io.Serializable;
+
+import org.apache.tapestry.ValueEncoder;
+import org.apache.tapestry.annotations.Component;
+import org.apache.tapestry.annotations.ComponentClass;
+import org.apache.tapestry.annotations.Persist;
+import org.apache.tapestry.corelib.components.Errors;
+import org.apache.tapestry.corelib.components.Form;
+import org.apache.tapestry.corelib.components.Select;
+import org.apache.tapestry.internal.OptionModelImpl;
+import org.apache.tapestry.internal.SelectModelImpl;
+import org.apache.tapestry.validator.Max;
+import org.apache.tapestry.validator.Min;
+
+@ComponentClass
+public class TestPageForSelect
+{
+    public static class HexEncoder implements ValueEncoder<Integer>, Serializable
+    {
+        private static final long serialVersionUID = 1L;
+
+        public String toClient(Object component, Integer value)
+        {
+            return String.format("%02x", value);
+        }
+
+        public Integer toValue(Object component, String clientValue)
+        {
+            return Integer.parseInt(clientValue, 16);
+        }
+    }
+    public enum Direction { EAST, SOUTH, WEST, NORTH }
+
+    @SuppressWarnings("unused")
+    @Component
+    private Errors _errors;
+
+    @SuppressWarnings("unused")
+    @Component
+    private Form _form1;
+
+    @SuppressWarnings("unused")
+    @Component
+    private Form _form2;
+
+    @Component
+    private Select<Integer> _select1;
+
+    @Component
+    private Select<Direction> _select2;
+
+    @Persist
+    private int v1 = 15; // Pre-select the second option
+
+    @Persist
+    private Direction _v2;
+
+    public Direction getV2()
+    {
+        return _v2;
+    }
+
+    public void setV2(Direction v2)
+    {
+        _v2 = v2;
+    }
+
+    public int getV1()
+    {
+        return v1;
+    }
+
+    public void setV1(int value)
+    {
+        this.v1 = value;
+    }
+
+    public void configureSelect1()
+    {
+        _select1.setLabel("my value");
+        _select1.setValueBindingExpr("v1");
+        _select1.setEncoder(new HexEncoder());
+        _select1.setModel(new SelectModelImpl<Integer>(new OptionModelImpl<Integer>("[1a]", false,
+                26), new OptionModelImpl<Integer>("[0f]", false, 15), new OptionModelImpl<Integer>(
+                "[ff]", false, 255)));
+        _select1.setValidators(new Min(10), new Max(200));
+    }
+
+    public void configureSelect2()
+    {
+        _select2.setLabel("dir");
+        _select2.setValueBindingExpr("v2");
+        _select2.useDefaultEncoder(Direction.class);
+        _select2.useDefaultModel(Direction.class);
+    }
+}

Propchange: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app2/pages/TestPageForSelect.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app2/pages/TestPageForSubmit.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app2/pages/TestPageForSubmit.java?view=diff&rev=503777&r1=503776&r2=503777
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app2/pages/TestPageForSubmit.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app2/pages/TestPageForSubmit.java Mon Feb  5 09:15:39 2007
@@ -27,27 +27,35 @@
 {
     @SuppressWarnings("unused")
     @Component
-    private Form form1;
+    private Form _form1;
 
     @SuppressWarnings("unused")
     @Component
-    private Form form2;
+    private Form _form2;
 
     @SuppressWarnings("unused")
     @Component
-    private Submit capitalize1;
+    private Submit _capitalize1;
 
     @SuppressWarnings("unused")
     @Component
-    private Submit capitalize2;
+    private Submit _capitalize2;
 
-    @SuppressWarnings("unused")
-    @Component(parameters = "value=value")
-    private TextField t1;
+    @Component
+    private TextField _t1;
 
-    @SuppressWarnings("unused")
-    @Component(parameters = "value=value")
-    private TextField t2;
+    public void configureT1()
+    {
+        _t1.setValueBindingExpr("value");
+    }
+
+    @Component
+    private TextField _t2;
+
+    public void configureT2()
+    {
+        _t2.setValueBindingExpr("value");
+    }
 
     @Persist
     private String value;

Added: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app2/pages/TestPageForTextField.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app2/pages/TestPageForTextField.java?view=auto&rev=503777
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app2/pages/TestPageForTextField.java (added)
+++ tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app2/pages/TestPageForTextField.java Mon Feb  5 09:15:39 2007
@@ -0,0 +1,140 @@
+// Copyright 2006 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.integration.app2.pages;
+
+import org.apache.tapestry.annotations.Component;
+import org.apache.tapestry.annotations.ComponentClass;
+import org.apache.tapestry.annotations.Persist;
+import org.apache.tapestry.corelib.components.Errors;
+import org.apache.tapestry.corelib.components.Form;
+import org.apache.tapestry.corelib.components.TextField;
+import org.apache.tapestry.translator.DoubleTranslator;
+import org.apache.tapestry.translator.IntegerTranslator;
+import org.apache.tapestry.validator.Max;
+import org.apache.tapestry.validator.Min;
+
+@ComponentClass
+public class TestPageForTextField
+{
+    @SuppressWarnings("unused")
+    @Component
+    private Errors _errors;
+
+    @SuppressWarnings("unused")
+    @Component
+    private Form _form1;
+
+    @SuppressWarnings("unused")
+    @Component
+    private Form _form2;
+
+    @SuppressWarnings("unused")
+    @Component
+    private Form _form3;
+
+    @SuppressWarnings("unused")
+    @Component
+    private Form _form4;
+
+    @Component
+    private TextField<Integer> _t1;
+    
+    @Component(id="t2")
+    private TextField<Double> _t2Field;
+    
+    @Component
+    private TextField<Long> _t3;
+    
+    @Component
+    private TextField<String> _t4;
+    
+    @Persist
+    private int v1;
+
+    @Persist
+    private double t2 = 12.3;
+
+    @Persist
+    private long v3 = 12345;
+
+    @Persist
+    private String v4 = "hello";
+
+    public int getV1()
+    {
+        return v1;
+    }
+
+    public void setV1(int value)
+    {
+        this.v1 = value;
+    }
+    
+    public void configureT1()
+    {
+        _t1.setValueBindingExpr("v1");
+        _t1.setTranslator(new IntegerTranslator());
+        _t1.setValidators(new Min(100), new Max(200));
+    }
+
+    public void configureT2()
+    {
+        // Use the default value binding ("t2")
+        _t2Field.setTranslator(new DoubleTranslator());
+    }
+
+    public void configureT3()
+    {
+        // Use the default translator
+        _t3.setValueBindingExpr("v3");
+    }
+
+    public void configureT4()
+    {
+        _t4.setValueBindingExpr("v4");
+        _t4.setDisabled(true);
+    }
+
+    public double getT2()
+    {
+        return t2;
+    }
+
+    public void setT2(double t2)
+    {
+        this.t2 = t2;
+    }
+
+    public long getV3()
+    {
+        return v3;
+    }
+
+    public void setV3(long v3)
+    {
+        this.v3 = v3;
+    }
+
+    public String getV4()
+    {
+        return v4;
+    }
+
+    public void setV4(String v4)
+    {
+        this.v4 = v4;
+    }
+
+}

Propchange: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/app2/pages/TestPageForTextField.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/pagelevel/SelectTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/pagelevel/SelectTest.java?view=auto&rev=503777
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/pagelevel/SelectTest.java (added)
+++ tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/pagelevel/SelectTest.java Mon Feb  5 09:15:39 2007
@@ -0,0 +1,129 @@
+// Copyright 2006 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.integration.pagelevel;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tapestry.dom.Document;
+import org.apache.tapestry.dom.Element;
+import org.apache.tapestry.dom.Node;
+import org.apache.tapestry.ioc.internal.util.CollectionFactory;
+import org.apache.tapestry.test.pagelevel.PageTester;
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+public class SelectTest extends Assert
+{
+    private PageTester _tester;
+
+    private Document _doc;
+
+    @Test
+    public void display()
+    {
+        Element select = _doc.getElementById("select1");
+        List<Node> children = select.getChildren();
+        assertEquals(children.size(), 3);
+        Element element = (Element) children.get(0);
+        assertEquals(element.getName(), "option");
+        assertEquals(element.getChildText(), "[1a]");
+        assertEquals(element.getAttribute("value"), "1a");
+        assertNull(element.getAttribute("selected"));
+        element = (Element) children.get(1);
+        assertEquals(element.getName(), "option");
+        assertEquals(element.getChildText(), "[0f]");
+        assertEquals(element.getAttribute("value"), "0f");
+        assertEquals(element.getAttribute("selected"), "selected");
+        element = (Element) children.get(2);
+        assertEquals(element.getName(), "option");
+        assertEquals(element.getChildText(), "[ff]");
+        assertEquals(element.getAttribute("value"), "ff");
+        assertNull(element.getAttribute("selected"));
+    }
+
+    @Test
+    public void submit_form()
+    {
+        Element form = _doc.getElementById("form1");
+        Map<String, String> fieldValues = CollectionFactory.newMap();
+        fieldValues.put("select1", "0f");
+        _doc = _tester.submitForm(form, fieldValues);
+        assertEquals(_doc.getElementById("v1").getChildText(), "15");
+    }
+
+    @Test
+    public void invalid()
+    {
+        Element form = _doc.getElementById("form1");
+        Map<String, String> fieldValues = CollectionFactory.newMap();
+        fieldValues.put("select1", "ff");
+        _doc = _tester.submitForm(form, fieldValues);
+        assertTrue(_doc.toString().contains("my value requires a value of at most 200."));
+    }
+
+    @Test
+    public void default_encoder_and_model_for_enum()
+    {
+        Element select = _doc.getElementById("select2");
+        List<Node> children = select.getChildren();
+        assertEquals(children.size(), 4);
+        Element element = (Element) children.get(0);
+        assertEquals(element.getName(), "option");
+        assertEquals(element.getChildText(), "East");
+        assertEquals(element.getAttribute("value"), "EAST");
+        assertNull(element.getAttribute("selected"));
+        element = (Element) children.get(1);
+        assertEquals(element.getName(), "option");
+        assertEquals(element.getChildText(), "South");
+        assertEquals(element.getAttribute("value"), "SOUTH");
+        assertNull(element.getAttribute("selected"));
+        element = (Element) children.get(2);
+        assertEquals(element.getName(), "option");
+        assertEquals(element.getChildText(), "West");
+        assertEquals(element.getAttribute("value"), "WEST");
+        assertNull(element.getAttribute("selected"));
+        element = (Element) children.get(3);
+        assertEquals(element.getName(), "option");
+        assertEquals(element.getChildText(), "North");
+        assertEquals(element.getAttribute("value"), "NORTH");
+        assertNull(element.getAttribute("selected"));
+        Element form = _doc.getElementById("form2");
+        Map<String, String> fieldValues = CollectionFactory.newMap();
+        fieldValues.put("select2", "NORTH");
+        _doc = _tester.submitForm(form, fieldValues);
+        assertEquals(_doc.getElementById("v2").getChildText(), "NORTH");
+    }
+
+    @BeforeMethod
+    public void before()
+    {
+        String appPackage = "org.apache.tapestry.integration.app2";
+        String appName = "";
+        _tester = new PageTester(appPackage, appName);
+        _doc = _tester.renderPage("TestPageForSelect");
+    }
+
+    @AfterMethod
+    public void after()
+    {
+        if (_tester != null)
+        {
+            _tester.shutdown();
+        }
+    }
+}

Propchange: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/pagelevel/SelectTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/pagelevel/TextFieldTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/pagelevel/TextFieldTest.java?view=auto&rev=503777
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/pagelevel/TextFieldTest.java (added)
+++ tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/pagelevel/TextFieldTest.java Mon Feb  5 09:15:39 2007
@@ -0,0 +1,113 @@
+// Copyright 2006 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.integration.pagelevel;
+
+import java.util.Map;
+
+import org.apache.tapestry.dom.Document;
+import org.apache.tapestry.dom.Element;
+import org.apache.tapestry.ioc.internal.util.CollectionFactory;
+import org.apache.tapestry.test.pagelevel.PageTester;
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+public class TextFieldTest extends Assert
+{
+    private PageTester _tester;
+
+    private Document _doc;
+
+    @Test
+    public void submit_form()
+    {
+        Element form = _doc.getElementById("form1");
+        Map<String, String> fieldValues = CollectionFactory.newMap();
+        fieldValues.put("t1", "123");
+        _doc = _tester.submitForm(form, fieldValues);
+        assertEquals(_doc.getElementById("v1").getChildText(), "123");
+    }
+
+    @Test
+    public void use_default_error_message()
+    {
+        Element form = _doc.getElementById("form1");
+        Map<String, String> fieldValues = CollectionFactory.newMap();
+        fieldValues.put("t1", "99");
+        _doc = _tester.submitForm(form, fieldValues);
+        assertTrue(_doc.toString().contains("T1 requires a value of at least 100."));
+    }
+
+    @Test
+    public void override_error_message()
+    {
+        Element form = _doc.getElementById("form1");
+        Map<String, String> fieldValues = CollectionFactory.newMap();
+        fieldValues.put("t1", "201");
+        _doc = _tester.submitForm(form, fieldValues);
+        assertTrue(_doc.toString().contains("Error: T1 is larger than 200."));
+    }
+
+    @Test
+    public void default_value_binding()
+    {
+        Element form = _doc.getElementById("form2");
+        assertEquals(_doc.getElementById("t2").getAttribute("value"), "12.3");
+        Map<String, String> fieldValues = CollectionFactory.newMap();
+        fieldValues.put("t2", "+0.45");
+        _doc = _tester.submitForm(form, fieldValues);
+        assertEquals(_doc.getElementById("v2").getChildText(), "0.45");
+    }
+
+    @Test
+    public void default_translator()
+    {
+        Element form = _doc.getElementById("form3");
+        assertEquals(_doc.getElementById("t3").getAttribute("value"), "12345");
+        Map<String, String> fieldValues = CollectionFactory.newMap();
+        fieldValues.put("t3", "1000");
+        _doc = _tester.submitForm(form, fieldValues);
+        assertEquals(_doc.getElementById("v3").getChildText(), "1000");
+    }
+
+    @Test
+    public void disabled()
+    {
+        Element form = _doc.getElementById("form4");
+        Map<String, String> fieldValues = CollectionFactory.newMap();
+        fieldValues.put("t4", "abc");
+        _doc = _tester.submitForm(form, fieldValues);
+        assertEquals(_doc.getElementById("v4").getChildText(), "hello");
+    }
+
+    @BeforeMethod
+    public void before()
+    {
+        String appPackage = "org.apache.tapestry.integration.app2";
+        String appName = "";
+        _tester = new PageTester(appPackage, appName);
+        _doc = _tester.renderPage("TestPageForTextField");
+    }
+
+    @AfterMethod
+    public void after()
+    {
+        if (_tester != null)
+        {
+            _tester.shutdown();
+        }
+    }
+}

Propchange: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/integration/pagelevel/TextFieldTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/internal/OptionGroupModelImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/internal/OptionGroupModelImplTest.java?view=diff&rev=503777&r1=503776&r2=503777
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/internal/OptionGroupModelImplTest.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/internal/OptionGroupModelImplTest.java Mon Feb  5 09:15:39 2007
@@ -28,9 +28,9 @@
     @Test
     public void basics()
     {
-        List<OptionModel> options = Collections.emptyList();
+        List<OptionModel<String>> options = Collections.emptyList();
 
-        OptionGroupModel group = new OptionGroupModelImpl("Label", true, options);
+        OptionGroupModel<String> group = new OptionGroupModelImpl<String>("Label", true, options);
 
         assertEquals(group.toString(), "OptionGroupModel[Label]");
         assertTrue(group.isDisabled());
@@ -41,10 +41,11 @@
     @Test
     public void map_contructor_retains_map()
     {
-        List<OptionModel> options = Collections.emptyList();
+        List<OptionModel<String>> options = Collections.emptyList();
         Map<String, String> attributes = Collections.emptyMap();
 
-        OptionGroupModel group = new OptionGroupModelImpl("Label", true, options, attributes);
+        OptionGroupModel<String> group = new OptionGroupModelImpl<String>("Label", true, options,
+                attributes);
 
         assertSame(group.getAttributes(), attributes);
     }
@@ -52,10 +53,10 @@
     @Test
     public void strings_contructor_builds_map()
     {
-        List<OptionModel> options = Collections.emptyList();
+        List<OptionModel<String>> options = Collections.emptyList();
 
-        OptionGroupModel group = new OptionGroupModelImpl("Label", true, options, "fred",
-                "flintstone", "barney", "rubble");
+        OptionGroupModel<String> group = new OptionGroupModelImpl<String>("Label", true, options,
+                "fred", "flintstone", "barney", "rubble");
 
         Map<String, String> attributes = group.getAttributes();
 

Modified: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/internal/OptionModelImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/internal/OptionModelImplTest.java?view=diff&rev=503777&r1=503776&r2=503777
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/internal/OptionModelImplTest.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/internal/OptionModelImplTest.java Mon Feb  5 09:15:39 2007
@@ -26,14 +26,14 @@
     @Test
     public void basics()
     {
-        OptionModel model = new OptionModelImpl("Label", false, this);
+        OptionModel<?> model = new OptionModelImpl<Object>("Label", false, this);
 
         assertEquals(model.getLabel(), "Label");
         assertFalse(model.isDisabled());
         assertSame(model.getValue(), this);
         assertNull(model.getAttributes());
 
-        model = new OptionModelImpl("Fred", true, "fred");
+        model = new OptionModelImpl<String>("Fred", true, "fred");
 
         assertEquals(model.getLabel(), "Fred");
         assertTrue(model.isDisabled());
@@ -44,8 +44,8 @@
     @Test
     public void attributes_as_extra_parameters()
     {
-        OptionModel model = new OptionModelImpl("Label", false, this, "fred", "flintstone",
-                "barney", "rubble");
+        OptionModel<?> model = new OptionModelImpl<Object>("Label", false, this, "fred",
+                "flintstone", "barney", "rubble");
 
         Map<String, String> attributes = model.getAttributes();
 
@@ -59,7 +59,7 @@
     {
         Map<String, String> attributes = Collections.emptyMap();
 
-        OptionModel model = new OptionModelImpl("Label", false, this, attributes);
+        OptionModel<?> model = new OptionModelImpl<Object>("Label", false, this, attributes);
 
         assertSame(model.getAttributes(), attributes);
     }

Modified: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/internal/TapestryUtilsTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/internal/TapestryUtilsTest.java?view=diff&rev=503777&r1=503776&r2=503777
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/internal/TapestryUtilsTest.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/internal/TapestryUtilsTest.java Mon Feb  5 09:15:39 2007
@@ -133,7 +133,7 @@
     @Test
     public void to_option_models()
     {
-        List<OptionModel> options = TapestryUtils.toOptionModels("UK,USA,DE=Germany");
+        List<OptionModel<String>> options = TapestryUtils.toOptionModels("UK,USA,DE=Germany");
 
         assertEquals(options.size(), 3);
 
@@ -150,7 +150,7 @@
     @Test
     public void whitespace_around_terms_is_trimmed()
     {
-        List<OptionModel> options = TapestryUtils.toOptionModels(" UK , USA , DE=Germany ");
+        List<OptionModel<String>> options = TapestryUtils.toOptionModels(" UK , USA , DE=Germany ");
 
         assertEquals(options.size(), 3);
 

Added: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/internal/beaneditor/AnnotationValidatorGeneratorTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/internal/beaneditor/AnnotationValidatorGeneratorTest.java?view=auto&rev=503777
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/internal/beaneditor/AnnotationValidatorGeneratorTest.java (added)
+++ tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/internal/beaneditor/AnnotationValidatorGeneratorTest.java Mon Feb  5 09:15:39 2007
@@ -0,0 +1,62 @@
+package org.apache.tapestry.internal.beaneditor;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.tapestry.AnnotationProvider;
+import org.apache.tapestry.Validator;
+import org.apache.tapestry.beaneditor.LengthRange;
+import org.apache.tapestry.beaneditor.Required;
+import org.apache.tapestry.validator.MaxLength;
+import org.apache.tapestry.validator.MinLength;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public class AnnotationValidatorGeneratorTest extends Assert
+{
+    @LengthRange(minLength = 5, maxLength = 10)
+    @Required
+    public void setFoo(String foo)
+    {
+
+    }
+
+    @Test
+    public void generate()
+    {
+
+        final AnnotationProvider provider = new AnnotationProvider()
+        {
+
+            public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
+            {
+                try
+                {
+                    Class<AnnotationValidatorGeneratorTest> clazz = AnnotationValidatorGeneratorTest.class;
+                    Method method = clazz.getMethod("setFoo", new Class[]
+                    { String.class });
+                    return method.getAnnotation(annotationClass);
+
+                }
+                catch (Exception ex)
+                {
+                    throw new RuntimeException(ex);
+                }
+            }
+
+        };
+        LengthRangeValidateAnnotationWorker worker1 = new LengthRangeValidateAnnotationWorker();
+        RequiredValidateAnnotationWorker worker2 = new RequiredValidateAnnotationWorker();
+        AnnotationValidatorGenerator generator = new AnnotationValidatorGenerator(Arrays.asList(
+                worker1,
+                worker2));
+        List<? extends Validator> validators = generator.buildValidators(Object.class, provider);
+        assertEquals(validators.size(), 3);
+        assertTrue(validators.get(0) instanceof MinLength);
+        assertTrue(validators.get(1) instanceof MaxLength);
+        assertTrue(validators.get(2) instanceof org.apache.tapestry.validator.Required);
+    }
+
+}

Propchange: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/internal/beaneditor/AnnotationValidatorGeneratorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/internal/beaneditor/CompoundValidatorGeneratorTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/internal/beaneditor/CompoundValidatorGeneratorTest.java?view=auto&rev=503777
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/internal/beaneditor/CompoundValidatorGeneratorTest.java (added)
+++ tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/internal/beaneditor/CompoundValidatorGeneratorTest.java Mon Feb  5 09:15:39 2007
@@ -0,0 +1,111 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.internal.beaneditor;
+
+import java.lang.annotation.Annotation;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.tapestry.AnnotationProvider;
+import org.apache.tapestry.Validator;
+import org.apache.tapestry.internal.services.CompoundalidatorGenerator;
+import org.apache.tapestry.services.ValidatorGenerator;
+import org.apache.tapestry.validator.Max;
+import org.apache.tapestry.validator.Min;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public class CompoundValidatorGeneratorTest extends Assert
+{
+    @Test
+    public void no_validator()
+    {
+        final AnnotationProvider provider = new AnnotationProvider()
+        {
+
+            public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
+            {
+                return null;
+            }
+
+        };
+        ValidatorGenerator g1 = new ValidatorGenerator()
+        {
+
+            public List<? extends Validator> buildValidators(Class propertyType,
+                    AnnotationProvider annotationProvider)
+            {
+                assertSame(provider, annotationProvider);
+                return null;
+            }
+
+        };
+        ValidatorGenerator g2 = new ValidatorGenerator()
+        {
+
+            public List<? extends Validator> buildValidators(Class propertyType,
+                    AnnotationProvider annotationProvider)
+            {
+                assertSame(provider, annotationProvider);
+                return null;
+            }
+
+        };
+        List<ValidatorGenerator> generators = Arrays.asList(g1, g2);
+        ValidatorGenerator gen = new CompoundalidatorGenerator(generators);
+        assertNull(gen.buildValidators(Object.class, provider));
+    }
+
+    @Test
+    public void two_validators()
+    {
+        final AnnotationProvider provider = new AnnotationProvider()
+        {
+
+            public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
+            {
+                return null;
+            }
+
+        };
+        ValidatorGenerator g1 = new ValidatorGenerator()
+        {
+
+            public List<? extends Validator> buildValidators(Class propertyType,
+                    AnnotationProvider annotationProvider)
+            {
+                assertSame(provider, annotationProvider);
+                return Arrays.asList(new Min(10));
+            }
+
+        };
+        ValidatorGenerator g2 = new ValidatorGenerator()
+        {
+
+            public List<? extends Validator> buildValidators(Class propertyType,
+                    AnnotationProvider annotationProvider)
+            {
+                assertSame(provider, annotationProvider);
+                return Arrays.asList(new Max(12));
+            }
+
+        };
+        List<ValidatorGenerator> generators = Arrays.asList(g1, g2);
+        ValidatorGenerator gen = new CompoundalidatorGenerator(generators);
+        List<? extends Validator> validators = gen.buildValidators(Object.class, provider);
+        assertEquals(validators.size(), 2);
+    }
+
+}

Propchange: tapestry/tapestry5/tapestry-core/branches/kt-20070205-IDE-support/src/test/java/org/apache/tapestry/internal/beaneditor/CompoundValidatorGeneratorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message