Author: mgrigorov
Date: Sun Dec 19 18:58:09 2010
New Revision: 1050931

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

Add an component for <input type="range"/> which is just the same as 'number'.

Added:
    
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/RangeTextField.java
   (with props)

Added: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/RangeTextField.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/RangeTextField.java?rev=1050931&view=auto
==============================================================================
--- 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/RangeTextField.java
 (added)
+++ 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/RangeTextField.java
 Sun Dec 19 18:58:09 2010
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.wicket.markup.html.form;
+
+import org.apache.wicket.model.IModel;
+
+/**
+ * A {...@link TextField} for HTML5 &lt;input&gt; with type <em>range</em>.
+ * 
+ * <p>
+ * Automatically validates the input against the configured {...@link 
#setMinimum(Double) min} and
+ * {...@link #setMaximum(Double) max} attributes. If any of them is 
<code>null</code> then
+ * {...@link Double#MIN_VALUE} and {...@link Double#MAX_VALUE} are used 
respectfully.
+ */
+public class RangeTextField extends NumberTextField
+{
+       private static final long serialVersionUID = 1L;
+
+       /**
+        * Construct.
+        * 
+        * @param id
+        *            component id
+        */
+       public RangeTextField(String id)
+       {
+               this(id, null);
+       }
+
+       /**
+        * Construct.
+        * 
+        * @param id
+        *            see Component
+        * @param model
+        *            the model
+        */
+       public RangeTextField(String id, IModel<Double> model)
+       {
+               super(id, model);
+       }
+
+       @Override
+       protected String getInputType()
+       {
+               return "range";
+       }
+}

Propchange: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/RangeTextField.java
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to