click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadr...@apache.org
Subject svn commit: r1538295 [7/8] - in /click/branches/click-3.0.0/click: ./ build/ documentation/docs/ examples/ examples/src/org/apache/click/examples/control/ examples/src/org/apache/click/examples/page/ examples/src/org/apache/click/examples/page/ajax/for...
Date Sat, 02 Nov 2013 22:15:34 GMT
Added: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker.java
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker.java?rev=1538295&view=auto
==============================================================================
--- click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker.java (added)
+++ click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker.java Sat Nov  2 22:15:31 2013
@@ -0,0 +1,417 @@
+/*
+ * 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.click.extras.prototypejs;
+
+import java.text.MessageFormat;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.click.Context;
+import org.apache.click.control.Field;
+import org.apache.click.element.CssImport;
+import org.apache.click.element.Element;
+import org.apache.click.element.JsImport;
+import org.apache.click.util.ClickUtils;
+import org.apache.click.util.HtmlStringBuffer;
+
+/**
+ * Provides a ColorPicker control:   <input type='text'><img>.
+ *
+ * <table class='htmlHeader' cellspacing='6'>
+ * <tr>
+ * <td>Color Field</td>
+ * <td><input type='text' size='7' title='ColorPicker Control' value='#EE0000'/>
+ * <img align='top' style='cursor:pointer' src='colorpicker/color-picker.png' title='choose color'/>
+ * </td>
+ * </tr>
+ * </table>
+ *
+ * The ColorPicker control provides a popup DHTML color picker and a text input
+ * where users can enter the color in hex format. The text input field can be
+ * turned off by setting {@link #setShowTextField(boolean)} to false
+ * (default is true).
+ * <p/>
+ * The ColorPicker control will validate whether the entered color is present (if required) and that it
+ * is a valid hex color either in 3-digit presentation (ie #EEE) or 6-digit presentation (ie #EEEEEE).
+ * If the color is not required the color-picker popup will show a button for 'no-color' on the top-left.
+ *
+ * <a name="resources"></a>
+ * <h3>CSS and JavaScript resources</h3>
+ *
+ * ColorPicker depends on the <a class="external" target="_blank" href="http://www.prototypejs.org">Prototype</a>
+ * JavaScript library.
+ * <p/>
+ * The ColorPicker control makes use of the following resources
+ * (which Click automatically deploys to the application directories,
+ * <tt>/click/colorpicker</tt> and <tt>/click/prototype</tt>):
+ *
+ * <ul>
+ * <li><tt>click/colorpicker/colorpicker.css</tt></li>
+ * <li><tt>click/prototype/prototype.js</tt></li>
+ * <li><tt>click/colorpicker/colorpicker.js</tt></li>
+ * </ul>
+ *
+ * To import these ColorPicker files simply reference the variables
+ * <span class="blue">$headElements</span> and
+ * <span class="blue">$jsElements</span> in the page template. For example:
+ *
+ * <pre class="codeHtml">
+ * &lt;html&gt;
+ * &lt;head&gt;
+ * <span class="blue">$headElements</span>
+ * &lt;/head&gt;
+ * &lt;body&gt;
+ *
+ * <span class="red">$form</span>
+ *
+ * <span class="blue">$jsElements</span>
+ * &lt;/body&gt;
+ * &lt;/html&gt; </pre>
+ *
+ * <h4>Credits</h4>
+ *
+ * The color picker popup is based on JS script code from
+ * <a target="_blank" href="http://www.dhtmlgoodies.com/index.html?whichScript=submitted-color-picker">www.dhtmlgoodies.com</a>.
+ */
+public class ColorPicker extends Field {
+
+    // Constants --------------------------------------------------------------
+
+    private static final long serialVersionUID = 1L;
+
+    /** The color validation hexadecimal pattern. */
+    static final Pattern HEX_PATTERN =
+        Pattern.compile("#[a-fA-F0-9]{3}([a-fA-F0-9]{3})?");
+
+    /**
+     * The field validation JavaScript function template.
+     * The function template arguments are: <ul>
+     * <li>0 - is the field id</li>
+     * <li>1 - is the Field required status</li>
+     * <li>2 - is the localized error message for required validation</li>
+     * <li>3 - is the localized error message for pattern validation</li>
+     * </ul>
+     */
+    final static String VALIDATE_COLORPICKER_FUNCTION =
+        "function validate_{0}() '{'\n"
+        + "   var msg = validateColorPicker(\n"
+        + "         ''{0}'',{1}, [''{2}'',''{3}'']);\n"
+        + "   if (msg) '{'\n"
+        + "      return msg + ''|{0}'';\n"
+        + "   '}' else '{'\n"
+        + "      return null;\n"
+        + "   '}'\n"
+        + "'}'\n";
+
+    // Instance Variables -----------------------------------------------------
+
+    /**
+     * The show text field option for entering a color hex value. The default
+     * value is true.
+     */
+    protected boolean showTextField = true;
+
+    /** The text field size attribute. The default size is 7. */
+    protected int size = 7;
+
+    // Constructors -----------------------------------------------------------
+
+    /**
+     * Construct a ColorPicker with the given name. The color picker will show
+     * the text input field.
+     *
+     * @param name the name of the field
+     */
+    public ColorPicker(String name) {
+        super(name);
+    }
+
+    /**
+     * Construct the ColorPicker with the given name and label.
+     *
+     * @param name the name of the field
+     * @param label the label of the field
+     */
+    public ColorPicker(String name, String label) {
+        super(name, label);
+    }
+
+    /**
+     * Construct a ColorPicker with the given name and required status.
+     *
+     * @param name the name of the field
+     * @param required the field required status
+     */
+    public ColorPicker(String name, boolean required) {
+        super(name);
+        setRequired(required);
+    }
+
+    /**
+     * Constructs a ColorPicker with the given name, required status and
+     * display text field option.
+     *
+     * @param name the name of field
+     * @param required the field required status
+     * @param showTextField flag to show the text input field
+     */
+    public ColorPicker(String name, boolean required, boolean showTextField) {
+        this(name, required);
+        this.showTextField = showTextField;
+    }
+
+    /**
+     * Create a ColorPicker with no name defined.
+     * <p/>
+     * <b>Please note</b> the control's name must be defined before it is valid.
+     */
+    public ColorPicker() {
+        super();
+    }
+
+    // Public Attributes ------------------------------------------------------
+
+    /**
+     * Return the ColorPicker HTML HEAD elements for the following
+     * resources:
+     * <p/>
+     * <ul>
+     * <li><tt>click/colorpicker/colorpicker.css</tt></li>
+     * <li><tt>click/prototype/prototype.js</tt></li>
+     * <li><tt>click/colorpicker/colorpicker.js</tt></li>
+     * </ul>
+     *
+     * @see org.apache.click.Control#getHeadElements()
+     *
+     * @return the HTML HEAD elements for the control
+     */
+    @Override
+    public List<Element> getHeadElements() {
+        if (headElements == null) {
+            headElements = super.getHeadElements();
+
+            Context context = getContext();
+            String versionIndicator = ClickUtils.getResourceVersionIndicator(context);
+
+            headElements.add(new CssImport("/click/colorpicker/colorpicker.css", versionIndicator));
+            headElements.add(new JsImport("/click/prototype/prototype.js", versionIndicator));
+            headElements.add(new JsImport("/click/colorpicker/colorpicker.js", versionIndicator));
+        }
+        return headElements;
+    }
+
+    /**
+     * Whether the TextField to enter the color hex number should be shown or
+     * not. Default is true
+     *
+     * @return Returns the showTextField.
+     */
+    public boolean getShowTextField() {
+        return showTextField;
+    }
+
+    /**
+     * Whether the TextField to enter the color hex number should be shown or
+     * not. Default is true.
+     *
+     * @param showTextField the showTextField to set
+     */
+    public void setShowTextField(boolean showTextField) {
+        this.showTextField = showTextField;
+    }
+
+    /**
+     * Return the field size. By default is 7. Only used when
+     * {@link #getShowTextField()} true.
+     *
+     * @return the field size
+     */
+    public int getSize() {
+        return size;
+    }
+
+    /**
+     * Set the field size.
+     *
+     * @param size the field size
+     */
+    public void setSize(int size) {
+        this.size = size;
+    }
+
+    /**
+     * Return the field JavaScript client side validation function.
+     * <p/>
+     * The function name must follow the format <tt>validate_[id]</tt>, where
+     * the id is the DOM element id of the fields focusable HTML element, to
+     * ensure the function has a unique name.
+     *
+     * @return the field JavaScript client side validation function
+     */
+    @Override
+    public String getValidationJavaScript() {
+        Object[] args = new Object[9];
+        args[0] = getId();
+        args[1] = String.valueOf(isRequired());
+        args[2] = getMessage("field-required-error", getErrorLabel());
+        args[3] = getMessage("no-color-value", getErrorLabel());
+        return MessageFormat.format(VALIDATE_COLORPICKER_FUNCTION, args);
+    }
+
+    // Public Methods ---------------------------------------------------------
+
+    /**
+     * @see org.apache.click.control.AbstractControl#getControlSizeEst()
+     *
+     * @return the estimated rendered control size in characters
+     */
+    @Override
+    public int getControlSizeEst() {
+        return 96;
+    }
+
+    /**
+     * Render the HTML representation of the ColorPicker.
+     *
+     * @see #toString()
+     *
+     * @param buffer the specified buffer to render the control's output to
+     */
+    @Override
+    public void render(HtmlStringBuffer buffer) {
+        Context context = getContext();
+        Map<String, Object> values = new HashMap<String, Object>();
+
+        values.put("id", getId());
+        values.put("field", this);
+        values.put("path", context.getRequest().getContextPath());
+
+        if (isColor(getValue())) {
+            values.put("back_color", getValue());
+        } else {
+            values.put("back_color", "#FFFFFF");
+        }
+        values.put("value", getValue());
+
+        HtmlStringBuffer textFieldAttributes = new HtmlStringBuffer(96);
+        if (getShowTextField()) {
+            textFieldAttributes.appendAttribute("size", getSize());
+            textFieldAttributes.appendAttribute("title", getTitle());
+            if (isReadonly()) {
+                textFieldAttributes.appendAttributeReadonly();
+            }
+            textFieldAttributes.appendAttribute("maxlength", 7);
+
+            if (isValid()) {
+                removeStyleClass("error");
+                if (isDisabled()) {
+                    addStyleClass("disabled");
+                } else {
+                    removeStyleClass("disabled");
+                }
+            } else {
+                addStyleClass("error");
+            }
+        }
+
+        appendAttributes(textFieldAttributes);
+
+        if (isDisabled()) {
+            textFieldAttributes.appendAttributeDisabled();
+        }
+        values.put("attributes", textFieldAttributes.toString());
+
+        // The image messages
+        values.put("chooseColorMsg", getMessage("choose-color"));
+        values.put("noColorMsg", getMessage("no-color"));
+        values.put("closeMsg", getMessage("close"));
+
+        renderTemplate(buffer, values);
+    }
+
+    /**
+     * Returns the HTML for the color-picker. This is the content of the
+     * ColorPicker.htm template.
+     *
+     * @return a HTML rendered ColorPicker string
+     */
+    @Override
+    public String toString() {
+        HtmlStringBuffer buffer = new HtmlStringBuffer(getControlSizeEst());
+        render(buffer);
+        return buffer.toString();
+    }
+
+    /**
+     * Validates the input to check whether is required or not and that the
+     * input contains a valid color hex value.
+     *
+     * @see org.apache.click.control.TextField#validate()
+     */
+    @Override
+    public void validate() {
+        setError(null);
+
+        String value = getValue();
+
+        int length = value.length();
+        if (length > 0) {
+            Matcher matcher = HEX_PATTERN.matcher(value);
+            if (!matcher.matches()) {
+                setErrorMessage("no-color-value");
+            }
+        } else {
+            if (isRequired()) {
+                setErrorMessage("field-required-error");
+            }
+        }
+    }
+
+    // Protected Methods ------------------------------------------------------
+
+    /**
+     * Render a Velocity template for the given data model.
+     *
+     * @param buffer the specified buffer to render the template output to
+     * @param model the model data to merge with the template
+     */
+    protected void renderTemplate(HtmlStringBuffer buffer, Map<String, ?> model) {
+        buffer.append(getContext().renderTemplate(ColorPicker.class, model));
+    }
+
+    // Private Methods --------------------------------------------------------
+
+    private boolean isColor(String value) {
+        if (value == null) {
+            return false;
+        }
+        int length = value.length();
+        if (length > 0) {
+            Matcher matcher = HEX_PATTERN.matcher(value);
+            return matcher.matches();
+        } else {
+            return false;
+        }
+
+    }
+
+}

Propchange: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker.properties
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker.properties?rev=1538295&view=auto
==============================================================================
--- click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker.properties (added)
+++ click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker.properties Sat Nov  2 22:15:31 2013
@@ -0,0 +1,21 @@
+# 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.
+
+no-color-value={0} is not a valid color.
+choose-color=choose color
+no-color=no color
+close=close
\ No newline at end of file

Propchange: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_cs.properties
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_cs.properties?rev=1538295&view=auto
==============================================================================
--- click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_cs.properties (added)
+++ click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_cs.properties Sat Nov  2 22:15:31 2013
@@ -0,0 +1,21 @@
+# 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.
+
+no-color-value={0} nen&#237; platn&#225; barva.
+choose-color=vyberte barvu
+no-color=&#382;&#225;dn&#225; barva
+close=zav&#345;&#237;t

Propchange: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_cs.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_de.properties
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_de.properties?rev=1538295&view=auto
==============================================================================
--- click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_de.properties (added)
+++ click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_de.properties Sat Nov  2 22:15:31 2013
@@ -0,0 +1,21 @@
+# 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.
+
+no-color-value={0} ist keine g\u00FCltige Farbe.
+choose-color=Farbe w\u00E4hlen
+no-color=Keine Farbe
+close=Schlie\u00DFen
\ No newline at end of file

Propchange: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_de.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_en.properties
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_en.properties?rev=1538295&view=auto
==============================================================================
--- click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_en.properties (added)
+++ click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_en.properties Sat Nov  2 22:15:31 2013
@@ -0,0 +1,18 @@
+# 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.
+
+# Will inherit properties from ColorPicker.properties
\ No newline at end of file

Propchange: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_en.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_fr.properties
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_fr.properties?rev=1538295&view=auto
==============================================================================
--- click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_fr.properties (added)
+++ click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_fr.properties Sat Nov  2 22:15:31 2013
@@ -0,0 +1,21 @@
+# 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.
+
+no-color-value={0} n''est pas une couleur valide.
+choose-color=choisir une couleur
+no-color=aucune couleur
+close=fermer
\ No newline at end of file

Propchange: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_fr.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_it.properties
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_it.properties?rev=1538295&view=auto
==============================================================================
--- click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_it.properties (added)
+++ click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_it.properties Sat Nov  2 22:15:31 2013
@@ -0,0 +1,21 @@
+# 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.
+
+no-color-value={0} non \u00E8 un colore valido.
+choose-color=scegliere colore
+no-color=nessun colore
+close=chiudere
\ No newline at end of file

Propchange: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_it.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_ja.properties
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_ja.properties?rev=1538295&view=auto
==============================================================================
--- click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_ja.properties (added)
+++ click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_ja.properties Sat Nov  2 22:15:31 2013
@@ -0,0 +1,21 @@
+# 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.
+
+no-color-value={0} \u306F\u4E0D\u6B63\u306A\u8272\u3067\u3059\u3002
+choose-color=\u8272\u306E\u9078\u629E
+no-color=\u306A\u3057
+close=\u9589\u3058\u308B

Propchange: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_ja.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_nl.properties
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_nl.properties?rev=1538295&view=auto
==============================================================================
--- click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_nl.properties (added)
+++ click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_nl.properties Sat Nov  2 22:15:31 2013
@@ -0,0 +1,21 @@
+# 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.
+
+no-color-value={0} is geen geldige kleur.
+choose-color=kies kleur
+no-color=geen kleur
+close=sluit
\ No newline at end of file

Propchange: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_nl.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_pl.properties
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_pl.properties?rev=1538295&view=auto
==============================================================================
--- click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_pl.properties (added)
+++ click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_pl.properties Sat Nov  2 22:15:31 2013
@@ -0,0 +1,21 @@
+# 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.
+
+no-color-value={0} jest niepoprawnym kolorem.
+choose-color=wybierz kolor
+no-color=brak koloru
+close=zamknij
\ No newline at end of file

Propchange: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_pl.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_pt_BR.properties
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_pt_BR.properties?rev=1538295&view=auto
==============================================================================
--- click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_pt_BR.properties (added)
+++ click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_pt_BR.properties Sat Nov  2 22:15:31 2013
@@ -0,0 +1,21 @@
+# 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.
+
+no-color-value={0} não é uma cor válida.
+choose-color=escolha cor
+no-color=nenhuma cor
+close=fecha
\ No newline at end of file

Propchange: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_pt_BR.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_ro.properties
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_ro.properties?rev=1538295&view=auto
==============================================================================
--- click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_ro.properties (added)
+++ click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_ro.properties Sat Nov  2 22:15:31 2013
@@ -0,0 +1,21 @@
+# 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.
+
+no-color-value={0} nu e o culoare valabil\u0103.
+choose-color=alege culoarea
+no-color=incolor
+close=\u00EEnchide

Propchange: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_ro.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_ru.properties
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_ru.properties?rev=1538295&view=auto
==============================================================================
--- click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_ru.properties (added)
+++ click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_ru.properties Sat Nov  2 22:15:31 2013
@@ -0,0 +1,21 @@
+# 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.
+
+no-color-value={0}: \u0446\u0432\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u043d \u043d\u0435\u0432\u0435\u0440\u043d\u043e.
+choose-color=\u0412\u044b\u0431\u043e\u0440 \u0446\u0432\u0435\u0442\u0430
+no-color=\u0411\u0435\u0437 \u0446\u0432\u0435\u0442\u0430
+close=\u0412\u044b\u0431\u0440\u0430\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0446\u0432\u0435\u0442
\ No newline at end of file

Propchange: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_ru.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_tr.properties
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_tr.properties?rev=1538295&view=auto
==============================================================================
--- click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_tr.properties (added)
+++ click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_tr.properties Sat Nov  2 22:15:31 2013
@@ -0,0 +1,21 @@
+# 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.
+
+no-color-value={0} ge\u00E7erli bir renk de\u011Fil.
+choose-color=renk se\u00E7
+no-color=renk yok
+close=kapat
\ No newline at end of file

Propchange: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_tr.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_zh_CN.properties
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_zh_CN.properties?rev=1538295&view=auto
==============================================================================
--- click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_zh_CN.properties (added)
+++ click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_zh_CN.properties Sat Nov  2 22:15:31 2013
@@ -0,0 +1,21 @@
+# 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.
+
+choose-color = \u9009\u62E9\u989C\u8272
+close = \u5173\u95ED
+no-color = \u6CA1\u6709\u989C\u8272
+no-color-value = {0} \u4E0D\u662F\u6B63\u786E\u7684\u989C\u8272\u503C\u3002

Propchange: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/ColorPicker_zh_CN.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/DateField.java
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/DateField.java?rev=1538295&view=auto
==============================================================================
--- click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/DateField.java (added)
+++ click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/DateField.java Sat Nov  2 22:15:31 2013
@@ -0,0 +1,1161 @@
+/*
+ * 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.click.extras.prototypejs;
+
+import java.sql.Timestamp;
+import java.text.DateFormatSymbols;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+
+import org.apache.click.Context;
+import org.apache.click.control.TextField;
+import org.apache.click.element.CssImport;
+import org.apache.click.element.Element;
+import org.apache.click.element.JsImport;
+import org.apache.click.element.JsScript;
+import org.apache.click.util.ClickUtils;
+import org.apache.click.util.HtmlStringBuffer;
+import org.apache.commons.lang.StringUtils;
+
+/**
+ * Provides a Date Field control:   &lt;input type='text'&gt;&lt;img&gt;.
+ *
+ * <table class='htmlHeader' cellspacing='6'>
+ * <tr>
+ * <td style="vertical-align:baseline">Date Field</td>
+ * <td style="vertical-align:baseline"><input type='text' size='20' title='DateField Control' value='12 May 2009'/><img align='top' hspace='2' style='cursor:hand' src='calendar.gif' title='Calendar'/></td>
+ * </tr>
+ * </table>
+ *
+ * The DateField control provides a Date entry field and a popup Calendar
+ * &lt;div&gt;. Users can either key in a Date value or select a Date using the
+ * Calendar.
+ * <p/>
+ * Example:
+ * <pre class="prettyprint">
+ * public MyPage extends Page {
+ *
+ *     public void onInit() {
+ *         Form form = new Form("form");
+ *
+ *         // Create new DateField with default date format: 'dd MMM yyyy'
+ *         DateField dateField = new DateField("date");
+ *
+ *         // You can change the format to: 'yyyy-MM-dd'
+ *         dateField.setFormatPattern("yyyy-MM-dd");
+ *
+ *         // Finally add dateField to form
+ *         form.add(dateField);
+ *
+ *         addControl(form);
+ *     }
+ * } </pre>
+ *
+ * <a name="resources"></a>
+ * <h3>CSS and JavaScript resources</h3>
+ *
+ * The Calendar popup is provided by the <a target="_blank" class="external" href="http//www.prototypejs.org">Prototype</a>
+ * based <a target="_blank" class="external" href="http://code.google.com/p/calendardateselect/">CalendarDateSelect</a>
+ * library.
+ * <p/>
+ * <b>Please note:</b> if you don't want to have a dependency on the
+ * Prototype library you can use the <a class="external" target="_blank" href="http://code.google.com/p/click-calendar/">Click Calendar</a>
+ * CalendarField which is based on the <a class="external" target="_blank" href="http://www.dynarch.com/">Dynarch.com</a>
+ * library. Consider this option when using an alternative JavaScript library
+ * than Prototype, such as <a class="external" target="_blank" href="http://jquery.com">JQuery</a>.
+ * <p/>
+ * Alternatively you can switch off the Calendar popup by setting the
+ * {@link #setShowCalendar(boolean)} to false. No JavaScript and CSS will be
+ * included when this option is false.
+ * <p/>
+ * The DateField control makes use of the following resources
+ * (which Click automatically deploys to the application directories,
+ * <tt>/click/calendar</tt> and <tt>/click/prototype</tt>):
+ *
+ * <ul>
+ * <li><tt>click/calendar/{style}.css</tt> - where {style} is a specific Calendar style e.g. <tt>default</tt>, <tt>red</tt>, <tt>blue</tt> etc.</li>
+ * <li><tt>click/prototype/prototype.js</tt></li>
+ * <li><tt>click/calendar/calendar_date_select.js</tt></li>
+ * </ul>
+ *
+ * The Calendar popup is created as a &lt;div&gt; element using JavaScript.
+ * To enable the Calendar popup, reference <span class="blue">$headElements</span>
+ * and <span class="blue">$jsElements</span> in the page template. For example:
+ *
+ * <pre class="codeHtml">
+ * &lt;html&gt;
+ * &lt;head&gt;
+ * <span class="blue">$headElements</span>
+ * &lt;/head&gt;
+ * &lt;body&gt;
+ *
+ * <span class="red">$form</span>
+ *
+ * <span class="blue">$jsElements</span>
+ * &lt;/body&gt;
+ * &lt;/html&gt; </pre>
+ *
+ * <a name="styles"></a>
+ * <h3>Calendar Styles</h3>
+ *
+ * The default Calendar style is 'default' which has a gray theme.
+ * The Calendar styles include:
+ * <ul style="margin-top: 0.5em;">
+ * <li>blue</li>
+ * <li>default</li>
+ * <li>plain</li>
+ * <li>red</li>
+ * <li>silver</li>
+ * </ul>
+ *
+ * <h3>Default date format pattern</h3>
+ * The default date format pattern is set to the message <tt>"date-format-pattern"</tt>
+ * defined in the resource bundle <tt>/org/apache/click/extras/control/DateField.properties</tt>.
+ * <p/>
+ * You can easily customize the default date format pattern by overriding the
+ * <tt>"date-format-pattern"</tt> in your <tt>click-page<lang>.properties</tt>
+ * files.
+ * <p/>
+ * An example src/click-page.properties file is shown below:
+ * <pre class="prettyprint">
+ * date-format-pattern=dd-MM-yyyy </pre>
+ *
+ * <h3>Localization</h3>
+ * The following localization messages are available in the resource bundle:
+ * <tt>/org/apache/click/extras/control/DateField.properties</tt>.
+ * <ul>
+ *   <li><tt>date-title</tt> - the <tt>title</tt> attribute of the input field.</li>
+ *   <li><tt>calendar-image-title</tt> - the <tt>title</tt> attribute of the
+ *       calendar image icon</tt></li>
+ *   <li><tt>calendar-weekdays-heading</tt> - a comma separated list of
+ *       abbreviated week day names starting with Sunday. The default value is
+ *       <tt>"S,M,T,W,T,F,S"</tt>. If not defined for a locale, the abbreviated
+ *       week day names from the JDK is used. The names are used as the column
+ *       heading in the popup.</li>
+ *   <li><tt>calendar-ok</tt> - the label on the "OK" button.</li>
+ *   <li><tt>calendar-now</tt> - the label on the "Now" button.</li>
+ *   <li><tt>calendar-today</tt> - the label on the "Today" button.</li>
+ *   <li><tt>calendar-clear</tt> - the label on the "Clear" button.</li>
+ * </ul>
+ * The buttons are only shown when DateField popup also contains time:
+ * <tt>field.setShowTime(true);</tt>
+ * <p/>
+ * See also W3C HTML reference
+ * <a class="external" target="_blank" title="W3C HTML 4.01 Specification"
+ *    href="http://www.w3.org/TR/html401/interact/forms.html#h-17.4">INPUT</a>
+ */
+public class DateField extends TextField {
+
+    // Constants --------------------------------------------------------------
+
+    private static final long serialVersionUID = 1L;
+
+    // Instance Variables -----------------------------------------------------
+
+    /** The DateField's date value. */
+    protected Date date;
+
+    /** The date format. */
+    protected SimpleDateFormat dateFormat;
+
+    /** The date format pattern value. */
+    protected String formatPattern;
+
+    /** The JavaScript Calendar pattern. */
+    protected String calendarPattern;
+
+    /** The Calendar popup show time display bar flag. */
+    protected boolean showTime;
+
+    /**
+     * Flag indicating if the Calendar popup is displayed or not,
+     * default value is true.
+     */
+    protected boolean showCalendar = true;
+
+    /** The minimum year of the calendar, default value is 1930. */
+    protected int minimumYear = 1930;
+
+    /** The maximum year of the calendar, default value is 2050. */
+    protected int maximumYear = 2050;
+
+    /**
+     * The Calendar CSS style, default value: <tt>default</tt>.
+     * Available styles include:
+     * <tt>[blue, default, plain, red, silver]</tt>
+     */
+    protected String style = "default";
+
+    /** Indicates whether the help property should be rendered or not. */
+    private boolean renderHelp = true;
+
+    // Constructors -----------------------------------------------------------
+
+    /**
+     * Construct the Date Field with the given name.
+     *
+     * @param name the name of the field
+     */
+    public DateField(String name) {
+        super(name);
+    }
+
+    /**
+     * Construct the Date Field with the given name and label.
+     *
+     * @param name the name of the field
+     * @param label the label of the field
+     */
+    public DateField(String name, String label) {
+        super(name, label);
+    }
+
+    /**
+     * Construct the Date Field with the given name and required status.
+     *
+     * @param name the name of the field
+     * @param required the field required status
+     */
+    public DateField(String name, boolean required) {
+        this(name);
+        setRequired(required);
+    }
+
+    /**
+     * Construct the Date Field with the given name, label and required status.
+     *
+     * @param name the name of the field
+     * @param label the label of the field
+     * @param required the field required status
+     */
+    public DateField(String name, String label, boolean required) {
+        super(name, label, required);
+    }
+
+    /**
+     * Construct the Date Field with the given name, label and size.
+     *
+     * @param name the name of the field
+     * @param label the label of the field
+     * @param size the size of the field
+     */
+    public DateField(String name, String label, int size) {
+        this(name, label);
+        setSize(size);
+    }
+
+    /**
+     * Construct the Date Field with the given name, label, size and
+     * required status.
+     *
+     * @param name the name of the field
+     * @param label the label of the field
+     * @param size the size of the field
+     * @param required the field required status
+     */
+    public DateField(String name, String label, int size, boolean required) {
+        this(name, label, required);
+        setSize(size);
+    }
+
+    /**
+     * Create a Date Field with no name defined.
+     * <p/>
+     * <b>Please note</b> the control's name must be defined before it is valid.
+     */
+    public DateField() {
+        super();
+    }
+
+    // Public Attributes ------------------------------------------------------
+
+    /**
+     * Return the field Date value, or null if value was empty or a parsing
+     * error occurred.
+     *
+     * @return the field Date value
+     */
+    public Date getDate() {
+        return date;
+    }
+
+    /**
+     * Set the field Date value.
+     *
+     * @param date the Date value to set
+     */
+    public void setDate(Date date) {
+        this.date = date;
+        if (date != null) {
+            super.setValue(getDateFormat().format(date));
+        } else {
+            super.setValue(null);
+        }
+    }
+
+    /**
+     * Return the SimpleDateFormat for the {@link #formatPattern} property.
+     *
+     * @return the SimpleDateFormat for the formatPattern
+     */
+    public SimpleDateFormat getDateFormat() {
+        if (dateFormat == null) {
+            String formatPattern = getFormatPattern();
+            dateFormat = new SimpleDateFormat(formatPattern, getLocale());
+        }
+        return dateFormat;
+    }
+
+    /**
+     * Return the date format pattern. If the date format pattern is not defined
+     * it will be loaded through the method, {@link #loadFormatPattern()}.
+     *
+     * @return the date format pattern
+     */
+    public String getFormatPattern() {
+        if (formatPattern == null) {
+            loadFormatPattern();
+        }
+        return formatPattern;
+    }
+
+    /**
+     * Set the SimpleDateFormat pattern.
+     *
+     * <h4>SimpleDateFormat Pattern Characters</h4>
+     *
+     *  <table border="1" cellspacing="0" cellpadding="3">
+     *  <tr bgcolor="#ccccff">
+     *           <th align=left>Letter
+     *           <th align=left>Date or Time Component
+     *           <th align=left>Presentation
+     *           <th align=left>Examples
+     *       <tr>
+     *           <td><code>G</code>
+     *           <td>Era designator
+     *           <td>Text
+     *           <td><code>AD</code>
+     *       <tr bgcolor="#eeeeff">
+     *           <td><code>y</code>
+     *           <td>Year
+     *           <td>Year
+     *           <td><code>1996</code>; <code>96</code>
+     *       <tr>
+     *           <td><code>M</code>
+     *           <td>Month in year
+     *           <td>Month
+     *           <td><code>July</code>; <code>Jul</code>; <code>07</code>
+     *       <tr bgcolor="#eeeeff">
+     *           <td><code>w</code>
+     *           <td>Week in year
+     *           <td>Number
+     *           <td><code>27</code>
+     *       <tr>
+     *           <td><code>W</code>
+     *           <td>Week in month
+     *           <td>Number
+     *           <td><code>2</code>
+     *       <tr bgcolor="#eeeeff">
+     *           <td><code>D</code>
+     *           <td>Day in year
+     *           <td>Number
+     *           <td><code>189</code>
+     *       <tr>
+     *           <td><code>d</code>
+     *           <td>Day in month
+     *           <td>Number
+     *           <td><code>10</code>
+     *       <tr bgcolor="#eeeeff">
+     *           <td><code>F</code>
+     *           <td>Day of week in month
+     *           <td>Number
+     *           <td><code>2</code>
+     *       <tr>
+     *           <td><code>E</code>
+     *           <td>Day in week
+     *           <td>Text
+     *           <td><code>Tuesday</code>; <code>Tue</code>
+     *       <tr bgcolor="#eeeeff">
+     *           <td><code>a</code>
+     *           <td>Am/pm marker
+     *           <td>Text
+     *           <td><code>PM</code>
+     *       <tr>
+     *           <td><code>H</code>
+     *           <td>Hour in day (0-23)
+     *           <td>Number
+     *           <td><code>0</code>
+     *       <tr bgcolor="#eeeeff">
+     *           <td><code>k</code>
+     *           <td>Hour in day (1-24)
+     *           <td>Number
+     *           <td><code>24</code>
+     *       <tr>
+     *           <td><code>K</code>
+     *           <td>Hour in am/pm (0-11)
+     *           <td>Number
+     *           <td><code>0</code>
+     *       <tr bgcolor="#eeeeff">
+     *           <td><code>h</code>
+     *           <td>Hour in am/pm (1-12)
+     *           <td>Number
+     *           <td><code>12</code>
+     *       <tr>
+     *           <td><code>m</code>
+     *           <td>Minute in hour
+     *           <td>Number
+     *           <td><code>30</code>
+     *       <tr bgcolor="#eeeeff">
+     *           <td><code>s</code>
+     *           <td>Second in minute
+     *           <td>Number
+     *           <td><code>55</code>
+     *       <tr>
+     *           <td><code>S</code>
+     *           <td>Millisecond
+     *           <td>Number
+     *           <td><code>978</code>
+     *       <tr bgcolor="#eeeeff">
+     *           <td><code>z</code>
+     *           <td>Time zone
+     *           <td>General time zone
+     *           <td><code>Pacific Standard Time</code>; <code>PST</code>; <code>GMT-08:00</code>
+     *       <tr>
+     *           <td><code>Z</code>
+     *           <td>Time zone
+     *           <td>RFC 822 time zone
+     *           <td><code>-0800</code>
+     *   </table>
+     *
+     * @param pattern the SimpleDateFormat pattern
+     */
+    public void setFormatPattern(String pattern) {
+        if (pattern == null) {
+            throw new IllegalArgumentException("Null pattern parameter");
+        }
+        formatPattern = pattern;
+        calendarPattern = parseDateFormatPattern(pattern);
+    }
+
+    /**
+     * @see org.apache.click.control.Field#setName(String)
+     *
+     * @param name of the control
+     * @throws IllegalArgumentException if the name is null
+     */
+    @Override
+    public void setName(String name) {
+        super.setName(name);
+    }
+
+    /**
+     * Return the Timestamp value, or null if value was empty
+     * or a parsing error occurred.
+     *
+     * @return the Timestamp value
+     */
+    public Timestamp getTimestamp() {
+        Date date = getDate();
+
+        if (date != null) {
+            return new Timestamp(date.getTime());
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * Set the DateField value.
+     *
+     * @param value the DateField value
+     */
+    @Override
+    public void setValue(String value) {
+        if (value != null && value.length() > 0) {
+            try {
+                Date parsedDate = getDateFormat().parse(value);
+
+                // Cache date for subsequent retrievals
+                date = new Date(parsedDate.getTime());
+
+            } catch (ParseException pe) {
+                date = null;
+            }
+
+        } else {
+            date = null;
+        }
+        super.setValue(value);
+    }
+
+    /**
+     * Return the field Date value, or null if value was empty or a parsing
+     * error occurred.
+     *
+     * @return the Date object representation of the Field value
+     */
+    @Override
+    public Object getValueObject() {
+        return getDate();
+    }
+
+    /**
+     * Set the date value of the field using the given object.
+     *
+     * @param object the object value to set
+     */
+    @Override
+    public void setValueObject(Object object) {
+        if (object != null) {
+            if (Date.class.isAssignableFrom(object.getClass())) {
+                setDate((Date) object);
+
+            } else {
+                String msg =
+                    "Invalid object class: " + object.getClass().getName();
+                throw new IllegalArgumentException(msg);
+            }
+        }
+    }
+
+    /**
+     * Return the JavaScript Calendar pattern. The Calendar pattern is defined
+     * when you set the {@link #getFormatPattern() format pattern}.
+     * <p/>
+     * If the date format pattern is not defined it will be loaded through the
+     * method {@link #loadFormatPattern()}.
+     *
+     * @return the JavaScript Calendar pattern
+     */
+    public String getCalendarPattern() {
+        if (calendarPattern == null) {
+            loadFormatPattern();
+        }
+        return calendarPattern;
+    }
+
+    /**
+     * Return the DateField HTML head imports statements for the following
+     * resources:
+     *
+     * <ul>
+     * <li><tt>click/calendar/{style}.css</tt> - where {style} is a specific
+     * Calendar style e.g. <tt>default</tt>, <tt>red</tt>, <tt>blue</tt> etc.</li>
+     * <li><tt>click/control.js</tt></li>
+     * <li><tt>click/prototype/prototype.js</tt></li>
+     * <li><tt>click/calendar/calendar_date_select.js</tt></li>
+     * <li><tt>click/calendar/{lang}.js</tt> - where {lang} is the language
+     * specified by the browser e.g. <tt>fr</tt> (French), <tt>de</tt> (German)
+     * etc.</li>
+     * </ul>
+     *
+     * This method delegates to {@link #addCalendarOptions(java.util.List)} to
+     * include the Calendar Options script.
+     *
+     * @see org.apache.click.Control#getHeadElements()
+     *
+     * @return the HTML head import statements for the control
+     */
+    @Override
+    public List<Element> getHeadElements() {
+        // CLK-309. Skip imports if dateField is disabled, readonly or calendar
+        // should not be displayed.
+        if (isReadonly() || isDisabled() || !isShowCalendar()) {
+            return super.getHeadElements();
+        }
+
+        // Check that the field id has been set
+        String fieldName = getName();
+        if (fieldName == null) {
+            throw new IllegalStateException("DateField name"
+                + " is not defined. Set the name before calling"
+                + " getHeadElements().");
+        }
+
+        if (headElements == null) {
+            headElements = super.getHeadElements();
+
+            String versionIndicator = ClickUtils.getResourceVersionIndicator(getContext());
+
+            headElements.add(new CssImport("/click/calendar/" + getStyle()
+                + ".css", versionIndicator));
+            headElements.add(new JsImport("/click/control.js",
+                versionIndicator));
+            headElements.add(new JsImport("/click/prototype/prototype.js",
+                versionIndicator));
+            headElements.add(new JsImport("/click/calendar/calendar_date_select.js",
+                versionIndicator));
+
+            String language = getLocale().getLanguage();
+            // English is default language; only include translations for other
+            // languages
+            if (!"en".equals(language)) {
+                addCalenderTranslations(headElements);
+            }
+        }
+
+        addCalendarOptions(headElements);
+
+        return headElements;
+    }
+
+    /**
+     * Return true if the Calendar popup will show the time display bar.
+     *
+     * @return true if the Calendar popup will show the time display bar
+     */
+    public boolean isShowTime() {
+        return showTime;
+    }
+
+    /**
+     * Set the Calendar popup show the time display bar flag.
+     *
+     * @param showTime the flag to show the Calendar time display bar
+     */
+    public void setShowTime(boolean showTime) {
+        this.showTime = showTime;
+    }
+
+    /**
+     * Return true if the Calendar popup will be displayed, false otherwise.
+     * Default value is true.
+     *
+     * @return true if the Calendar popup will be displayed, false otherwise
+     */
+    public boolean isShowCalendar() {
+        return showCalendar;
+    }
+
+    /**
+     * Set whether the Calendar popup is displayed or not. If set to false the
+     * DateField will not include any JavaScript or CSS.
+     *
+     * @param showCalendar flag indicating whether the Calendar popup is
+     * displayed or not
+     */
+    public void setShowCalendar(boolean showCalendar) {
+        this.showCalendar = showCalendar;
+    }
+
+    /**
+     * Return the minimum year of the Calendar, default value is 1930.
+     *
+     * @return the minimum year of the Calendar
+     */
+    public int getMinimumYear() {
+        return minimumYear;
+    }
+
+    /**
+     * Set the minimum year of the Calendar.
+     *
+     * @param minimumYear the minimum year of the Calendar
+     */
+    public void setMinimumYear(int minimumYear) {
+        this.minimumYear = minimumYear;
+    }
+
+    /**
+     * Return the maximum year of the Calendar, default value is 2050.
+     *
+     * @return the minimum year of the Calendar
+     */
+    public int getMaximumYear() {
+        return maximumYear;
+    }
+
+    /**
+     * Set the maximum year of the Calendar.
+     *
+     * @param maximumYear the maximum year of the Calendar
+     */
+    public void setMaximumYear(int maximumYear) {
+        this.maximumYear = maximumYear;
+    }
+
+    /**
+     * Return the Calendar CSS style.
+     *
+     * @return the Calendar CSS style
+     */
+    public String getStyle() {
+        return style;
+    }
+
+    /**
+     * Set the Calendar CSS style.
+     * <p/>
+     * Available styles are: <tt>[blue, default, plain, red, silver]</tt>.
+     *
+     * @param style the Calendar CSS style
+     */
+    public void setStyle(String style) {
+        if (style == null) {
+            throw new IllegalArgumentException("Null style parameter");
+        }
+        this.style = style;
+    }
+
+    /**
+     * Return the field help text.
+     *
+     * @see org.apache.click.control.Field#getHelp()
+     *
+     * @return the help text of the Field
+     */
+    @Override
+    public String getHelp() {
+        // Conditionally render help property, otherwise return null.
+        if (renderHelp) {
+            return super.getHelp();
+        }
+        return null;
+    }
+
+    // Public Methods ---------------------------------------------------------
+
+    /**
+     * Validate the DateField request submission.
+     * <p/>
+     * A field error message is displayed if a validation error occurs.
+     * These messages are defined in the resource bundle:
+     * <blockquote>
+     * <ul>
+     *   <li>/click-control.properties
+     *     <ul>
+     *       <li>field-required-error</li>
+     *     </ul>
+     *   </li>
+     *   <li>/org/apache/click/extras/control/DateField.properties
+     *     <ul>
+     *       <li>date-format-error</li>
+     *     </ul>
+     *   </li>
+     * </ul>
+     * </blockquote>
+     */
+    @Override
+    public void validate() {
+        String formatPattern = getFormatPattern();
+
+        if (formatPattern == null) {
+            String msg = "dateFormat attribute is null for field: " + getName();
+            throw new IllegalStateException(msg);
+        }
+
+        super.validate();
+
+        if (isValid() && getValue().length() > 0) {
+            SimpleDateFormat dateFormat = getDateFormat();
+            dateFormat.setLenient(false);
+
+            try {
+                dateFormat.parse(getValue()).getTime();
+
+            } catch (ParseException pe) {
+                Object[] args = new Object[] {
+                    getErrorLabel(), formatPattern
+                };
+                setError(getMessage("date-format-error", args));
+            }
+        }
+    }
+
+    /**
+     * Render the HTML representation of the DateField. Note the button label is
+     * rendered as the HTML "value" attribute.
+     *
+     * @see #toString()
+     *
+     * @param buffer the specified buffer to render the control's output to
+     */
+    @Override
+    public void render(HtmlStringBuffer buffer) {
+
+        // Set default title
+        if (getTitle() == null) {
+            setTitle(getMessage("date-title", getFormatPattern()));
+        }
+
+        // Ensure help is not rendered by super implementation
+        renderHelp = false;
+
+        super.render(buffer);
+
+        renderHelp = true;
+
+        if (isShowCalendar()) {
+            renderCalendarButton(buffer);
+        }
+
+        // Render help
+        String help = getHelp();
+        if (help != null) {
+            buffer.append(help);
+        }
+    }
+
+    // Protected Methods ------------------------------------------------------
+
+    /**
+     * Render the calendar button HTML representation to the buffer.
+     *
+     * @param buffer the buffer to render the calendar button HTML
+     * representation to
+     */
+    protected void renderCalendarButton(HtmlStringBuffer buffer) {
+
+        if (!isReadonly() && !isDisabled()) {
+            Context context = getContext();
+            buffer.append("<img align=\"top\" ");
+            buffer.append("style=\"cursor:hand\" src=\"");
+            buffer.append(context.getRequest().getContextPath());
+            buffer.append("/click/calendar/calendar");
+            buffer.append(ClickUtils.getResourceVersionIndicator(context));
+            buffer.append(".gif\"");
+            String id = getId();
+            if (id != null) {
+                buffer.append(" id=\"");
+                buffer.append(getId());
+                buffer.append("-button\" ");
+            }
+
+            String calendarTitle = getMessage("calendar-image-title");
+            buffer.appendAttribute("alt", calendarTitle);
+            buffer.appendAttribute("title", calendarTitle);
+            buffer.elementEnd();
+        }
+    }
+
+    /**
+     * Add the calendar options as a script to the list of head elements.
+     * <p/>
+     * The default option script will render as (depending on the values):
+     *
+     * <pre class="prettyprint">
+     * Click.addLoadEvent(function() {
+     *   Event.observe('my-calendar-button', 'click', function(){
+     *     calendar = new CalendarDateSelect($('my-calendar'), {
+     *       minute_interval: 1,
+     *       popup_by: 'my-calendar-button',
+     *       embedded: false,
+     *       time: 'mixed',
+     *       formatValue: 'dd MMM yyyy',
+     *       year_range: [1930,2050]});
+     *     });
+     * }); </pre>
+     *
+     * You can override this method to set your own options using a
+     * {@link org.apache.click.element.JsScript}.
+     *
+     * @param headElements the list of head elements to include for this control
+     */
+    protected void addCalendarOptions(List<Element> headElements) {
+        String fieldId = getId();
+
+        JsScript script = new JsScript();
+        script.setId(fieldId + "-js-setup");
+
+        // Note: the setup script is recreated and checked if it is contained in
+        // the headElement. This check cater for when the field is used by another
+        // Control using the fly-weight pattern eg. FormTable.
+        if (!headElements.contains(script)) {
+
+            // Script must be executed as soon as browser dom is ready
+            script.setExecuteOnDomReady(true);
+
+            HtmlStringBuffer buffer = new HtmlStringBuffer(150);
+
+            buffer.append("Event.observe('").append(fieldId).append("-button").append("', 'click', function(){");
+            buffer.append(" calendar = new CalendarDateSelect($('").append(fieldId).append("'), {");
+            buffer.append("  minute_interval: 1, popup_by: '").append(fieldId).append("-button").append("',");
+            buffer.append("  embedded: false,");
+            buffer.append("  footer: false,");
+            buffer.append("  buttons: ").append(isShowTime()).append(",");
+            buffer.append("  time: ").append(isShowTime() ? "'mixed'," : "false,");
+            buffer.append("  formatValue: '").append(getCalendarPattern()).append("',");
+            buffer.append("  year_range: [").append(getMinimumYear()).append(",").append(getMaximumYear()).append("]");
+            buffer.append(" });");
+            buffer.append("});");
+
+            script.setContent(buffer.toString());
+            headElements.add(script);
+        }
+    }
+
+    /**
+     * Return the names of months and weekdays as a script.
+     */
+    protected void addCalenderTranslations(List<Element> headElements) {
+        JsScript script = new JsScript();
+        script.setId("datefield-js-setup-global");
+        if (!headElements.contains(script)) {
+            DateFormatSymbols dfs = new DateFormatSymbols(getLocale());
+
+            HtmlStringBuffer buffer = new HtmlStringBuffer(150);
+            buffer.append("Date.months=new Array(");
+            generateJavaScriptArray(buffer, dfs.getMonths(), 0, 12);
+            buffer.append(");\n");
+
+            buffer.append("Date.monthAbbreviations=new Array(");
+            generateJavaScriptArray(buffer, dfs.getShortMonths(), 0, 12);
+            buffer.append(");\n");
+
+            buffer.append("Date.dayNames=new Array(");
+            generateJavaScriptArray(buffer, dfs.getWeekdays(),
+                    Calendar.SUNDAY, Calendar.SATURDAY + 1);
+            buffer.append(");\n");
+
+            buffer.append("Date.dayAbbreviations=new Array(");
+            generateJavaScriptArray(buffer, dfs.getShortWeekdays(),
+                    Calendar.SUNDAY, Calendar.SATURDAY + 1);
+            buffer.append(");\n");
+
+            String[] weekdays = null;
+            if (getMessages().containsKey("calendar-weekdays-heading")) {
+                String headings = getMessage("calendar-weekdays-heading");
+                weekdays = StringUtils.splitPreserveAllTokens("," + headings, ',');
+            } else {
+                weekdays = dfs.getShortWeekdays();
+            }
+            String[] days = new String[7];
+            int firstDayOfWeek = getFirstDayOfWeek() - 1;
+            for (int i = 0; i < 7; i++) {
+                days[i] = weekdays[(i + firstDayOfWeek) % 7 + 1];
+            }
+            buffer.append("Date.weekdays=new Array(");
+            generateJavaScriptArray(buffer, days, 0, 7);
+            buffer.append(");\n");
+
+            buffer.append("Date.first_day_of_week=").append(firstDayOfWeek).append(";\n");
+            if (getMessages().containsKey("calendar-ok")) {
+                buffer.append("_translations[\"OK\"] = \"");
+                buffer.append(getMessage("calendar-ok"));
+                buffer.append("\";\n");
+            }
+            if (getMessages().containsKey("calendar-now")) {
+                buffer.append("_translations[\"Now\"] = \"");
+                buffer.append(getMessage("calendar-now"));
+                buffer.append("\";\n");
+            }
+            if (getMessages().containsKey("calendar-today")) {
+                buffer.append("_translations[\"Today\"] = \"");
+                buffer.append(getMessage("calendar-today"));
+                buffer.append("\";\n");
+            }
+            if (getMessages().containsKey("calendar-clear")) {
+                buffer.append("_translations[\"Clear\"] = \"");
+                buffer.append(getMessage("calendar-clear"));
+                buffer.append("\";\n");
+            }
+
+            script.setContent(buffer.toString());
+            headElements.add(script);
+        }
+    }
+
+    /**
+     * Append a list of quoted names delimited by commas.
+     * @param buffer the buffer to append to.
+     * @param names the list of names.
+     * @param start start index in the list.
+     * @param end end index in the list.
+     */
+    private void generateJavaScriptArray(HtmlStringBuffer buffer,
+           String[] names, int start, int end) {
+        for (int i = start; i < end; i++) {
+            buffer.append('"');
+            buffer.append(names[i]);
+            buffer.append('"');
+            if (i < end - 1) {
+                buffer.append(',');
+            }
+        }
+    }
+
+    /**
+     * Return the first day of the week. For example e.g., Sunday in US,
+     * Monday in France and Australia.
+     *
+     * @return the first day of the week
+     */
+    protected int getFirstDayOfWeek() {
+        Locale locale = getLocale();
+
+        if ("AU".equals(locale.getCountry())) {
+            return Calendar.MONDAY;
+        }
+        Calendar calendar = Calendar.getInstance(locale);
+
+        return calendar.getFirstDayOfWeek();
+    }
+
+    /**
+     * Returns the <tt>Locale</tt> that should be used in this control.
+     *
+     * @return the locale that should be used in this control
+     */
+    protected Locale getLocale() {
+        return getContext().getLocale();
+    }
+
+    /**
+     * Load the default date format pattern. The format pattern is set to the
+     * message <tt>"date-format-pattern"</tt> defined in the resource bundle
+     * <tt>/org/apache/click/extras/control/DateField.properties</tt>.
+     * <p/>
+     * The default date format pattern for English is: <tt>"dd MMM yyyy"</tt>.
+     */
+    protected void loadFormatPattern() {
+        String dateFormatPattern = getMessage("date-format-pattern");
+        setFormatPattern(dateFormatPattern);
+    }
+
+    /**
+     * Return the JavaScript Calendar pattern for the given Java DateFormat
+     * pattern.
+     *
+     * @param pattern the Java DateFormat pattern
+     * @return JavaScript Calendar pattern
+     */
+    protected String parseDateFormatPattern(String pattern) {
+        HtmlStringBuffer jsPattern = new HtmlStringBuffer(20);
+        int tokenStart = -1;
+        int tokenEnd = -1;
+        boolean debug = false;
+
+        for (int i = 0; i < pattern.length(); i++) {
+            char aChar = pattern.charAt(i);
+            if (debug) {
+                System.err.print("[" + i + "," + tokenStart + "," + tokenEnd
+                                 + "]=" + aChar);
+            }
+
+            // If character is in SimpleDateFormat pattern character set
+            if ("GyMwWDdFEaHkKhmsSzZ".indexOf(aChar) == - 1) {
+                if (debug) {
+                    System.err.println(" N");
+                }
+                if (tokenStart > - 1) {
+                    tokenEnd = i;
+                }
+            } else {
+                if (debug) {
+                    System.err.println(" Y");
+                }
+                if (tokenStart == - 1) {
+                    tokenStart = i;
+                }
+            }
+
+            if (tokenStart > -1) {
+
+                if (tokenEnd == -1 && i == pattern.length() - 1) {
+                    tokenEnd = pattern.length();
+                }
+
+                if (tokenEnd > -1) {
+                    String token = pattern.substring(tokenStart, tokenEnd);
+
+                    if ("yyyy".equals(token)) {
+                        jsPattern.append("yyyy");
+                    } else if ("yy".equals(token)) {
+                        jsPattern.append("yy");
+                    } else if ("y".equals(token)) {
+                        jsPattern.append("y");
+                    } else if ("MMMM".equals(token)) {
+                        jsPattern.append("MMM");
+                    } else if ("MMM".equals(token)) {
+                        jsPattern.append("NNN");
+                    } else if ("MM".equals(token)) {
+                        jsPattern.append("MM");
+                    } else if ("M".equals(token)) {
+                        jsPattern.append("M");
+                    } else if ("dd".equals(token)) {
+                        jsPattern.append("dd");
+                    } else if ("d".equals(token)) {
+                        jsPattern.append("d");
+                    } else if ("EEEE".equals(token)) {
+                        jsPattern.append("EE");
+                    } else if ("EEE".equals(token)) {
+                        jsPattern.append("E");
+                    } else if ("EE".equals(token)) {
+                        jsPattern.append("E");
+                    } else if ("E".equals(token)) {
+                        jsPattern.append("E");
+                    } else if ("aaa".equals(token)) {
+                        jsPattern.append("a");
+                    } else if ("aa".equals(token)) {
+                        jsPattern.append("a");
+                    } else if ("a".equals(token)) {
+                        jsPattern.append("a");
+                    } else if ("HH".equals(token)) {
+                        jsPattern.append("HH");
+                        setShowTime(true);
+                    } else if ("H".equals(token)) {
+                        jsPattern.append("H");
+                        setShowTime(true);
+                    } else if ("hh".equals(token)) {
+                        jsPattern.append("hh");
+                        setShowTime(true);
+                    } else if ("h".equals(token)) {
+                        jsPattern.append("h");
+                        setShowTime(true);
+                    } else if ("mm".equals(token)) {
+                        jsPattern.append("mm");
+                        setShowTime(true);
+                    } else if ("m".equals(token)) {
+                        jsPattern.append("m");
+                        setShowTime(true);
+                    } else if ("ss".equals(token)) {
+                        jsPattern.append("ss");
+                        setShowTime(true);
+                    } else if ("s".equals(token)) {
+                        jsPattern.append("s");
+                        setShowTime(true);
+                    } else {
+                        if (debug) {
+                            System.err.println("Not mapped:" + token);
+                        }
+                    }
+
+                    if (debug) {
+                        System.err.println("token[" + tokenStart + ","
+                                           + tokenEnd + "]='" + token + "'");
+                    }
+                    tokenStart = -1;
+                    tokenEnd = -1;
+                }
+            }
+
+            if (tokenStart == -1 && tokenEnd == -1) {
+                if ("GyMwWDdFEaHkKhmsSzZ".indexOf(aChar) == -1) {
+                    jsPattern.append(aChar);
+                }
+            }
+        }
+
+        return jsPattern.toString();
+    }
+}

Propchange: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/DateField.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/DateField.properties
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/DateField.properties?rev=1538295&view=auto
==============================================================================
--- click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/DateField.properties (added)
+++ click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/DateField.properties Sat Nov  2 22:15:31 2013
@@ -0,0 +1,21 @@
+# 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.
+
+calendar-image-title=Calendar
+date-format-error={0} is invalid. Date format is {1}
+date-format-pattern=dd MMM yyyy
+date-title=Date format: {0}

Propchange: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/DateField.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/DateField_cs.properties
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/DateField_cs.properties?rev=1538295&view=auto
==============================================================================
--- click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/DateField_cs.properties (added)
+++ click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/DateField_cs.properties Sat Nov  2 22:15:31 2013
@@ -0,0 +1,19 @@
+# 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.
+
+calendar-image-title=Kalend&#225;&#345;
+date-format-error={0} nen&#237; platn&#233; datum. Form&#225;t datumu je {1}
\ No newline at end of file

Propchange: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/DateField_cs.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/DateField_da.properties
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/DateField_da.properties?rev=1538295&view=auto
==============================================================================
--- click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/DateField_da.properties (added)
+++ click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/DateField_da.properties Sat Nov  2 22:15:31 2013
@@ -0,0 +1,21 @@
+# 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.
+calendar-weekdays-heading=S\u00f8,Ma,Ti,On,To,Fr,L\u00F8
+calendar-ok=V\u00E6lg
+calendar-now=Nu
+calendar-today=I dag
+calendar-clear=Slet

Propchange: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/DateField_da.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/DateField_de.properties
URL: http://svn.apache.org/viewvc/click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/DateField_de.properties?rev=1538295&view=auto
==============================================================================
--- click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/DateField_de.properties (added)
+++ click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/DateField_de.properties Sat Nov  2 22:15:31 2013
@@ -0,0 +1,23 @@
+# 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.
+
+calendar-image-title=Kalender
+date-format-error={0} ist ung\u00FCltig. Das Datums-Format ist {1}
+calendar-ok=OK
+calendar-now=Jetzt
+calendar-today=Heute
+calendar-clear=L\u00F6schen

Propchange: click/branches/click-3.0.0/click/prototypejs/src/org/apache/click/extras/prototypejs/DateField_de.properties
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message