Author: mgrigorov
Date: Sun Dec 19 09:43:30 2010
New Revision: 1050779

URL: http://svn.apache.org/viewvc?rev=1050779&view=rev
Log:
WICKET-3241 Add support for the new HTML 5 input types

Add/remove "min" and "max" html attributes depending on the set java variables

Modified:
    
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/NumberTextField.java

Modified: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/NumberTextField.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/NumberTextField.java?rev=1050779&r1=1050778&r2=1050779&view=diff
==============================================================================
--- 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/NumberTextField.java
 (original)
+++ 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/NumberTextField.java
 Sun Dec 19 09:43:30 2010
@@ -16,7 +16,9 @@
  */
 package org.apache.wicket.markup.html.form;
 
+import org.apache.wicket.markup.ComponentTag;
 import org.apache.wicket.model.IModel;
+import org.apache.wicket.util.value.IValueMap;
 import org.apache.wicket.validation.validator.RangeValidator;
 
 /**
@@ -115,6 +117,32 @@ public class NumberTextField extends Tex
        }
 
        @Override
+       protected void onComponentTag(final ComponentTag tag)
+       {
+               super.onComponentTag(tag);
+
+               IValueMap attributes = tag.getAttributes();
+
+               if (minimum != null)
+               {
+                       attributes.put("min", minimum);
+               }
+               else
+               {
+                       attributes.remove("min");
+               }
+
+               if (maximum != null)
+               {
+                       attributes.put("max", maximum);
+               }
+               else
+               {
+                       attributes.remove("max");
+               }
+       }
+
+       @Override
        protected String getInputType()
        {
                return "number";


Reply via email to