tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkuhn...@apache.org
Subject svn commit: r569495 - in /tapestry/tapestry4/trunk: tapestry-examples/TimeTracker/src/context/ tapestry-examples/TimeTracker/src/context/css/ tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/ tapestry-framework/src/java/org/a...
Date Fri, 24 Aug 2007 19:56:48 GMT
Author: jkuhnert
Date: Fri Aug 24 12:56:47 2007
New Revision: 569495

URL: http://svn.apache.org/viewvc?rev=569495&view=rev
Log:
Partially finished work for TAPESTRY-1719 to add a new custom google calendar time picker that doesn't suck like the current widget does.

Added:
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/form/GTimePicker.java   (with props)
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/form/GTimePicker.jwc
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/form/GTimePicker.script
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/form/TestGTimePicker.java   (with props)
Modified:
    tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/Home.html
    tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/css/forms.css
    tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/TaskEntryPage.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/Framework.library
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/form/DropdownTimePicker.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/TranslatedField.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/TranslatedFieldSupport.java
    tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/widget/TimePicker.js
    tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/widget/test_AlertDialog.html
    tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/widget/test_TimePicker.html
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/form/TestDropdownTimePicker.java

Modified: tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/Home.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/Home.html?rev=569495&r1=569494&r2=569495&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/Home.html (original)
+++ tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/Home.html Fri Aug 24 12:56:47 2007
@@ -37,12 +37,12 @@
                 <td><div class="field required"><input jwcid="datePicker" /></div></td>
                 <td>
                     <div class="field required">
-                        <input jwcid="startPicker" />
+                        <input jwcid="startPicker" size="7" />
                     </div>
                 </td>
                 <td>
                     <div class="field required">
-                        <input jwcid="endPicker" />
+                        <input jwcid="endPicker" size="7" />
                     </div>
                 </td>
                 <td>

Modified: tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/css/forms.css
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/css/forms.css?rev=569495&r1=569494&r2=569495&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/css/forms.css (original)
+++ tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/css/forms.css Fri Aug 24 12:56:47 2007
@@ -1,11 +1,11 @@
 div.requiredClause {
-	width:auto;
-	float:right;
-	padding-left:2px;
-	border-left:3px solid #ff660a;
-	margin-top:1.5em;
-	font-size: 0.7em;
-	font-weight:bold;
+    width:auto;
+    float:right;
+    padding-left:2px;
+    border-left:3px solid #ff660a;
+    margin-top:1.5em;
+    font-size: 0.7em;
+    font-weight:bold;
 }
 
 form { clear:both; border:1px solid #d0d8e2; margin:0; margin-bottom:1.5em; }
@@ -23,10 +23,10 @@
 
 /* input elements */
 form div.dropdown,
-form input.text,
-form input.numeric,
-form select,
-form textarea { border: 1px solid #a2da87; padding: 0.15em; width:100%; }
+    form input.text,
+    form input.numeric,
+    form select,
+    form textarea { border: 1px solid #a2da87; padding: 0.15em; width:100%; }
 form div.dropdown{ padding:0; height:22px; background-color:#fff;}
 form textarea { font-family:sans-serif; font-size:0.8em; margin: 0.55em 0; }
 * html form textarea { width:auto; }
@@ -41,17 +41,17 @@
 form h4 { font: 0.8em Tahoma, Myriad, sans-serif; font-weight:bold; margin:0; margin-top:1em; border-bottom: 1px solid #ddd; }
 
 .submitButton,.submitButton:focus,.alertButton {
-	width: auto;
-	border: none;
-	background-color: #699ED9;
-	color: #fff;
-	padding: 0.1em;
-	border-bottom: 1px solid #5885b6 !important;
-	border-right: 1px solid #5885b6 !important;
-	border-top: 1px solid #92b8e2 !important;
-	border-left: 1px solid #92b8e2 !important;
-	cursor: hand;
-	cursor: pointer;
+    width: auto;
+    border: none;
+    background-color: #699ED9;
+    color: #fff;
+    padding: 0.1em;
+    border-bottom: 1px solid #5885b6 !important;
+    border-right: 1px solid #5885b6 !important;
+    border-top: 1px solid #92b8e2 !important;
+    border-left: 1px solid #92b8e2 !important;
+    cursor: hand;
+    cursor: pointer;
 }
 
 .alertDialog {
@@ -99,3 +99,20 @@
     list-style:none;
     font-style:italic;
 }
+
+.dropdownCombobox {
+    background: #ffffff;
+    border: 1px solid #545454;
+}
+
+.dropdownOption {
+    font-family: arial;
+    font-size: 0.8em;
+    padding: 0.1em 0 0.1em 0.2em;
+    cursor:pointer;
+}
+
+.optionHover {
+    background: cornflowerblue;
+    color: #ffffff;
+}
\ No newline at end of file

Modified: tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/TaskEntryPage.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/TaskEntryPage.java?rev=569495&r1=569494&r2=569495&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/TaskEntryPage.java (original)
+++ tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/TaskEntryPage.java Fri Aug 24 12:56:47 2007
@@ -66,12 +66,12 @@
     
     @Component(bindings = {"value=startTime", "displayName=message:task.start.time",
             "validators=validators:required"})
-    public abstract DropdownTimePicker getStartPicker();
+    public abstract GTimePicker getStartPicker();
     public abstract Date getStartTime();
     
     @Component(bindings = {"value=endTime", "displayName=message:task.end.time",
             "validators=validators:required,differ=startPicker"})
-    public abstract DropdownTimePicker getEndPicker();
+    public abstract GTimePicker getEndPicker();
     public abstract Date getEndTime();
     
     @Component(bindings = { "value=description", 

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/Framework.library
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/Framework.library?rev=569495&r1=569494&r2=569495&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/Framework.library (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/Framework.library Fri Aug 24 12:56:47 2007
@@ -52,6 +52,7 @@
     <component-type type="For" specification-path="components/For.jwc"/>
     <component-type type="Form" specification-path="form/Form.jwc"/>
     <component-type type="GenericLink" specification-path="link/GenericLink.jwc"/>
+    <component-type type="GTimePicker" specification-path="dojo/form/GTimePicker.jwc"/>
     <component-type type="Hidden" specification-path="form/Hidden.jwc"/>
     <component-type type="If" specification-path="components/If.jwc"/>
     <component-type type="Image" specification-path="html/Image.jwc"/>

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/form/DropdownTimePicker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/form/DropdownTimePicker.java?rev=569495&r1=569494&r2=569495&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/form/DropdownTimePicker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/form/DropdownTimePicker.java Fri Aug 24 12:56:47 2007
@@ -31,8 +31,6 @@
  * Implementation of the dojo DropdownTimePicker widget as a tapestry
  * component. Wraps a form input field with a date picker icon next to it
  * that when clicked on reveals a pane to choose time values from. 
- * 
- * @author jkuhnert
  */
 public abstract class DropdownTimePicker extends AbstractFormWidget implements TranslatedField
 {

Added: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/form/GTimePicker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/form/GTimePicker.java?rev=569495&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/form/GTimePicker.java (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/form/GTimePicker.java Fri Aug 24 12:56:47 2007
@@ -0,0 +1,168 @@
+package org.apache.tapestry.dojo.form;
+
+import org.apache.tapestry.IMarkupWriter;
+import org.apache.tapestry.IRequestCycle;
+import org.apache.tapestry.IScript;
+import org.apache.tapestry.TapestryUtils;
+import org.apache.tapestry.form.TranslatedField;
+import org.apache.tapestry.form.TranslatedFieldSupport;
+import org.apache.tapestry.form.ValidatableFieldSupport;
+import org.apache.tapestry.json.JSONLiteral;
+import org.apache.tapestry.json.JSONObject;
+import org.apache.tapestry.valid.ValidatorException;
+
+import java.util.*;
+
+/**
+ * Implementation of an html form input field that has a dynamic drop down selection list of
+ * time segments displayed in the {@link org.apache.tapestry.IPage}'s {@link java.util.Locale}.
+ */
+public abstract class GTimePicker  extends AbstractFormWidget implements TranslatedField
+{
+    /** For a full day broken up in to half hour segments */
+    static final int TIME_SEGMENT_LENGTH = 48;
+
+    /** parameter. */
+    public abstract Object getValue();
+
+    public abstract void setValue(Object value);
+
+    public abstract boolean isDisabled();
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void renderFormWidget(IMarkupWriter writer, IRequestCycle cycle)
+    {
+        String value = getTranslatedFieldSupport().format(this, getValue());
+
+        renderDelegatePrefix(writer, cycle);
+
+        writer.beginEmpty("input");
+
+        writer.attribute("type", "text");
+
+        writer.attribute("name", getName());
+
+        if (isDisabled())
+            writer.attribute("disabled", "disabled");
+
+        if (value != null)
+            writer.attribute("value", value);
+
+        renderIdAttribute(writer, cycle);
+
+        renderDelegateAttributes(writer, cycle);
+
+        getTranslatedFieldSupport().renderContributions(this, writer, cycle);
+        getValidatableFieldSupport().renderContributions(this, writer, cycle);
+
+        renderInformalParameters(writer, cycle);
+
+        writer.closeTag();
+
+        renderDelegateSuffix(writer, cycle);
+
+        // Build up options value list
+
+        Locale locale = getPage().getLocale();
+        
+        GregorianCalendar cal = (GregorianCalendar) GregorianCalendar.getInstance(getPage().getLocale());
+        cal.set(Calendar.HOUR, 0);
+        cal.set(Calendar.AM_PM, Calendar.AM);
+
+        StringBuffer optStr = new StringBuffer("[");
+
+        int selectedIndex = -1;
+        
+        for(int i=0, hour=0; i < TIME_SEGMENT_LENGTH; i++)
+        {
+            if (i != 0)
+            {
+                optStr.append(",");
+            }
+            
+            if (i == 24)
+            {
+                hour = 0;
+                cal.set(Calendar.AM_PM, Calendar.PM);
+            }
+            
+            cal.set(Calendar.HOUR,  hour);
+            cal.set(Calendar.MINUTE, (i % 2 > 0) ? 30 : 0);
+
+            String option = getTranslator().format(this, locale, cal.getTime());
+
+            optStr.append("\"").append(option).append("\"");
+            
+            if (selectedIndex < 0 && value != null && value.equals(option))
+            {
+                selectedIndex = i;
+            }
+
+            if (i % 2 > 0)
+            {
+                hour++;
+            }
+        }
+
+        optStr.append("]");
+        
+        // now create widget parms
+
+        JSONObject json = new JSONObject();
+        json.put("inputNodeId", getClientId());
+        json.put("optionValues", new JSONLiteral(optStr.toString()));
+
+        if (selectedIndex > -1)
+        {
+            json.put("selectedIndex", selectedIndex);
+        }
+
+        Map parms = new HashMap();
+        parms.put("clientId", getClientId());
+        parms.put("props", json.toString());
+        parms.put("widget", this);
+
+        getScript().execute(this, cycle, TapestryUtils.getPageRenderSupport(cycle, this), parms);
+    }
+
+    /**
+     * @see org.apache.tapestry.form.AbstractFormComponent#rewindFormComponent(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle)
+     */
+    protected void rewindFormWidget(IMarkupWriter writer, IRequestCycle cycle)
+    {
+        String value = cycle.getParameter(getName());
+
+        try
+        {
+            Object translated = getTranslatedFieldSupport().parse(this, value);
+
+            getValidatableFieldSupport().validate(this, writer, cycle, translated);
+
+            setValue(translated);
+        }
+        catch (ValidatorException e)
+        {
+            getForm().getDelegate().record(e);
+        }
+    }
+
+    /**
+     * @see org.apache.tapestry.form.AbstractFormComponent#isRequired()
+     */
+    public boolean isRequired()
+    {
+        return getValidatableFieldSupport().isRequired(this);
+    }
+
+    /** Injected. */
+    public abstract IScript getScript();
+
+    /** Injected. */
+    public abstract TranslatedFieldSupport getTranslatedFieldSupport();
+
+    /** Injected. */
+    public abstract ValidatableFieldSupport getValidatableFieldSupport();
+
+}
\ No newline at end of file

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/form/GTimePicker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/form/GTimePicker.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/form/GTimePicker.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/form/GTimePicker.jwc
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/form/GTimePicker.jwc?rev=569495&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/form/GTimePicker.jwc (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/form/GTimePicker.jwc Fri Aug 24 12:56:47 2007
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Copyright 2006 The Apache Software Foundation
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+
+<!DOCTYPE component-specification PUBLIC
+  "-//Apache Software Foundation//Tapestry Specification 4.0//EN"
+  "http://tapestry.apache.org/dtd/Tapestry_4_0.dtd">
+
+<component-specification class="org.apache.tapestry.dojo.form.GTimePicker" allow-body="no">
+
+  <parameter name="value" required="yes"/>
+  <parameter name="disabled"/>
+
+  <parameter name="displayName"/>
+  <parameter name="translator" default-value="translator:date,pattern=h:mm a"/>
+  <parameter name="validators"/>
+
+  <inject property="script" type="script" object="GTimePicker.script"/>
+  <inject property="translatedFieldSupport" object="service:tapestry.form.TranslatedFieldSupport"/>
+  <inject property="validatableFieldSupport" object="service:tapestry.form.ValidatableFieldSupport"/>
+
+</component-specification>

Added: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/form/GTimePicker.script
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/form/GTimePicker.script?rev=569495&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/form/GTimePicker.script (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/form/GTimePicker.script Fri Aug 24 12:56:47 2007
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<!DOCTYPE script PUBLIC
+  "-//Apache Software Foundation//Tapestry Script Specification 3.0//EN"
+  "http://tapestry.apache.org/dtd/Script_3_0.dtd">
+<script>
+<input-symbol key="clientId" required="yes" />
+<input-symbol key="props" required="yes" />
+<input-symbol key="widget" required="yes" />
+    <body>
+        <unique>
+            dojo.require("dojo.widget.Manager");
+            dojo.require("tapestry.widget.Widget");
+        </unique>
+    </body>
+    <initialization>
+        tapestry.widget.synchronizeWidgetState("${clientId}", "tapestry:timepicker", ${props}, ${widget.destroy});
+    </initialization>
+</script>

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/TranslatedField.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/TranslatedField.java?rev=569495&r1=569494&r2=569495&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/TranslatedField.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/TranslatedField.java Fri Aug 24 12:56:47 2007
@@ -17,8 +17,9 @@
 import org.apache.tapestry.form.translator.Translator;
 
 /**
- * 
- * @author unknown
+ * Represents an input field that can be translated.
+ *
+ * @see {@link TranslatedFieldSupport}. 
  */
 public interface TranslatedField extends ValidatableField
 {

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/TranslatedFieldSupport.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/TranslatedFieldSupport.java?rev=569495&r1=569494&r2=569495&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/TranslatedFieldSupport.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/TranslatedFieldSupport.java Fri Aug 24 12:56:47 2007
@@ -26,27 +26,38 @@
 
     /**
      * Formats the field translation.
+     *
      * @param field
+     *          The field the value is being formatted for.
      * @param object
+     *          The object value to be formatted.
+     *
+     * @return The formatted string value of the given object.
      */
     String format(TranslatedField field, Object object);
 
     /**
      * Parses the field value.
      * @param field
+     *          The field to parse the value from.
      * @param text
-     * 
-     * @throws ValidatorException
+     *          The input text.
+     *
+     * @return The parsed field value in its translated object form.
+     * @throws ValidatorException On validation error.
      */
     Object parse(TranslatedField field, String text)
         throws ValidatorException;
 
     /**
-     * Renders any contributions.
+     * Renders client side / misc contributions when the field is being rendered.
+     *
      * @param field
+     *          The field being rendered.
      * @param writer
+     *          The markup writer to use.
      * @param cycle
+     *          The current request.
      */
-    void renderContributions(TranslatedField field,
-            IMarkupWriter writer, IRequestCycle cycle);
+    void renderContributions(TranslatedField field, IMarkupWriter writer, IRequestCycle cycle);
 }

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/widget/TimePicker.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/widget/TimePicker.js?rev=569495&r1=569494&r2=569495&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/widget/TimePicker.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/widget/TimePicker.js Fri Aug 24 12:56:47 2007
@@ -1,337 +1,174 @@
 dojo.provide("tapestry.widget.TimePicker");
 
 dojo.require("dojo.widget.HtmlWidget");
-dojo.require("dojo.date.common");
-dojo.require("dojo.date.format");
-dojo.require("dojo.lang.common");
+dojo.require("dojo.html.style");
+dojo.require("dojo.html.util");
+dojo.require("dojo.html.metrics");
+dojo.require("dojo.html.iframe");
 
 dojo.widget.defineWidget(
-	"tapestry.widget.TimePicker",
-	dojo.widget.HtmlWidget,
-	{
-		
-	}
+        "tapestry.widget.TimePicker",
+        dojo.widget.HtmlWidget,
+{
+    inputNodeId:null, // unique element id of form input text field
+    optionValues:[], // param of 12 hour clock selection values
+    selectedIndex:null, // param of what the default selected index should be
+    dropdownClass:"dropdownCombobox",
+    dropdownOptionClass:"dropdownOption",
+    optionHoverClass:"optionHover",
+
+    inputNode:null, // form input text node
+    selectedNode:null, // currently selected node
+    dropdownNode:null, // drop down div container
+    bgIframe:null,
+    options:[], // option div nodes
+    dropdownPositioned:false,
+    showing:false,
+
+    postCreate: function() {
+        this.inputNode = dojo.byId(this.inputNodeId);
+
+        this.dropdownNode = document.createElement("div");
+        this.dropdownNode.setAttribute("id", this.widgetId + "dropdown");
+        this.dropdownNode.style["display"] = "none";
+        dojo.html.setClass(this.dropdownNode, this.dropdownClass);
+
+        var contDiv = document.createElement("div");
+        this.dropdownNode.appendChild(contDiv);
+        
+        for (var i=0; i < this.optionValues.length; i++){
+            var option = document.createElement("div");
+            option.setAttribute("id", "combooption-" + i);
+            dojo.html.setClass(option, this.dropdownOptionClass);
+            option.appendChild(document.createTextNode(this.optionValues[i]));
+            
+            contDiv.appendChild(option);
+            this.options.push(option);
+
+            if (this.selectedIndex && i == this.selectedIndex){
+                this.selectedNode = option;
+
+                if (!this.inputNode.value || this.inputNode.value.length < 1){
+                    this.inputNode.value=this.optionValues[i];
+                }
+            }
+
+            dojo.event.connect(option, "onmouseover", this, "onOptionMouseOver");
+            dojo.event.connect(option, "onmouseout", this, "onOptionMouseOut");
+            dojo.event.connect(option, "onmousedown", this, "onOptionClicked");
+        }
+
+        var m = dojo.html.getCachedFontMeasurements();
+        var st=this.dropdownNode.style;
+        st["overflow"]="auto";
+        st["zIndex"]=9000;
+        st["position"]="absolute";
+        st["width"]=(m["1em"] * 6) + "px"
+        st["height"]=(m["1em"] * 11) + "px";
+
+        dojo.body().appendChild(this.dropdownNode);
+
+        if (dojo.render.html.ie){
+            this.bgIframe = new dojo.html.BackgroundIframe();
+            this.bgIframe.setZIndex(this.dropdownNode);
+        }
+        
+        dojo.event.connect(this.inputNode, "onclick", this, "onInputClick");
+        dojo.event.connect(this.inputNode, "onblur", this, "hide");
+        
+        dojo.event.connect(dojo.body(), "onkeyup", this, "onKeyUp");
+    },
+
+    onOptionMouseOver: function(evt) {
+        if (!dojo.html.hasClass(evt.target, this.optionHoverClass)) {
+            dojo.html.addClass(evt.target, this.optionHoverClass);
+        }
+    },
+
+    onOptionMouseOut: function(evt) {
+        dojo.html.removeClass(evt.target, this.optionHoverClass);
+    },
+
+    onChange:function() {},
+
+    onOptionClicked: function(evt) {
+        this.selectedNode=evt.target;
+        
+        this.inputNode.value=tapestry.html.getContentAsString(this.selectedNode);
+        this.hide(evt);
+        dojo.html.removeClass(this.selectedNode, this.optionHoverClass);
+
+        this.onChange(evt);
+    },
+
+    onInputClick: function() {
+        if (this.showing){
+            this.hide();
+            return;
+        }
+        
+        this.show();
+
+        if (this.selectedNode){
+            dojo.html.scrollIntoView(this.selectedNode);
+        }
+    },
+
+    onKeyUp: function(evt) {
+        if (evt.keyCode == evt.KEY_ESCAPE) {
+            this.hide(evt);
+        }
+    },
+
+    hide: function(evt) {
+        dojo.html.hide(this.dropdownNode);
+        
+        if (this.bgIframe){
+            this.bgIframe.hide();
+        }
+
+        this.showing=false;
+    },
+
+    show: function(evt) {
+        if (!this.dropdownPositioned){
+            dojo.html.placeOnScreenAroundElement(this.dropdownNode, this.inputNode,
+                                            null, dojo.html.boxSizing.BORDER_BOX,
+                                            {'BL': 'TL', 'TL': 'BL'});
+            this.dropdownPositioned = true;
+        }
+
+        dojo.html.show(this.dropdownNode);
+        
+        if (this.bgIframe){
+            this.bgIframe.size(this.dropdownNode);
+            this.bgIframe.show();
+        }
+
+        this.showing=true;
+    },
+
+    destroyRendering: function(finalize){
+        try{
+            dojo.widget.HtmlWidget.prototype.destroyRendering.call(this, finalize);
+
+            dojo.event.disconnect(this.inputNode, "onclick", this, "onInputClick");
+            dojo.event.disconnect(this.inputNode, "onblur", this, "hide");
+            dojo.event.browser.clean(this.inputNode);
+            
+            dojo.dom.destroyNode(this.dropdownNode);
+            delete this.dropdownNode;
+
+            dojo.event.disconnect(dojo.body(), "onkeyup", this, "onKeyUp");
+
+             if (this.bgIframe){
+                this.bgIframe.remove();
+            }
+        } catch (e) { }
+    },
+
+    getValue:function(){
+        return this.inputNode.value;
+    }
+}
 );
-
-tapestry.widget.TimePicker=function(){
-	dojo.widget.HtmlWidget.call(this);
-	
-	this.widgetType="TimePicker";
-	this.isContainer=false;
-
-	this.hourElement=null;
-	this.minuteElement=null;
-	this.secondElement=null;
-	this.amPmElement=null;
-
-	this.hourUpElement=null;
-	this.hourDownElement=null;
-	this.minuteUpElement=null;
-	this.minuteDownElement=null;
-	this.secondUpElement=null;
-	this.secondDownElement=null;
-	this.amPmUpElement=null;
-	this.amPmDownElement=null;
-
-	//	values
-	this.is24HourClock=false;
-	this.isPm=false;
-	this.date=null;
-
-	//	options
-	this.displayHours=true;
-	this.displayMinutes=true;
-	this.displaySeconds=false;
-
-	this.adjustHoursBy=1;
-	this.adjustMinutesBy=15;
-	this.adjustSecondsBy=15;
-};
-dojo.inherits(tapestry.widget.TimePicker, dojo.widget.HtmlWidget);
-
-dojo.lang.extend(tapestry.widget.TimePicker, {
-	
-	templatePath:null,
-	templateCssPath:null,
-	imagePath:dojo.uri.dojoUri("../tapestry/widget/templates/images/"),
-	
-	getValue:function(){
-		return this.date;
-	},
-	
-	setValue:function(date){
-		if (dojo.lang.isString(date)) { this.date=new Date(date); }
-		else { this.date=date; }
-		
-		this.isPm=this.date.getHours()>=12;
-	},
-	parseValue:function(str){
-		var a=str.match(/\d{1,2}/g);
-		var t=str.match(/(am|pm|a|p)/ig);
-		if(a){
-			var d=new Date();
-			var h=a[0];
-			var m=a[1]?a[1]:0;
-			if(t) t=String(t[0]);
-			if(t&&t.charAt(0).toLowerCase()=="p") h=h%12+12;
-			d.setHours(h);
-			d.setMinutes(m);
-			setValue(d);
-		}
-	},
-
-	adjust:function(){
-		//	set up for set value.
-		var h=this.date.getHours();
-		if(!this.is24HourClock&&this.isPm&&h<12){
-			h+=12;
-		}
-		this.date.setHours(h);
-		this.setValue(this.date);
-
-		var h=this.date.getHours();
-		var m=""+this.date.getMinutes();
-		var s=""+this.date.getSeconds();
-		this.isPm=h>=12?true:false;	//	isPm
-
-		if(h==0) h=24;
-		if(h>12) h-=12;
-		if(m.length==1) m="0"+m;
-		if(s.length==1) s="0"+s;
-
-		this.hourElement.value=h;
-		this.minuteElement.value=m;
-		if (this.secondElement) this.secondElement.value=s;
-		if (!this.is24HourClock){
-			if(this.amPmElement) this.amPmElement.innerHTML=((this.isPm)?"pm":"am");
-		}
-
-	},
-
-	//	event handlers
-	adjustHours:function(e){
-		if(e.target==this.hourUpElement){
-			this.date.setHours(this.date.getHours()+parseInt(this.adjustHoursBy));
-		}
-		if(e.target==this.hourDownElement){
-			this.date.setHours(this.date.getHours()-parseInt(this.adjustHoursBy));
-		}
-		if(e.target==this.hourElement){
-			this.date.setHours(parseInt(this.hourElement.value));
-		}
-		this.adjust();
-	},
-	adjustMinutes:function(e){
-		if(e.target==this.minuteUpElement){
-			this.date.setMinutes(this.date.getMinutes()+parseInt(this.adjustMinutesBy));
-		}
-		if(e.target==this.minuteDownElement){
-			this.date.setMinutes(this.date.getMinutes()-parseInt(this.adjustMinutesBy));
-		}
-		if(e.target==this.minuteElement){
-			this.date.setMinutes(parseInt(this.minuteElement.value));
-		}
-		this.adjust();
-	},
-	adjustSeconds:function(e){
-		if(e.target==this.secondUpElement){
-			this.date.setSeconds(this.date.getSeconds()+parseInt(this.adjustSecondsBy));
-		}
-		if(e.target==this.secondDownElement){
-			this.date.setSeconds(this.date.getSeconds()-parseInt(this.adjustSecondsBy));
-		}
-		if(e.target==this.minuteElement){
-			this.date.setSeconds(parseInt(this.secondElement.value));
-		}
-		this.adjust();
-	},
-	adjustAmPm:function(e){
-		this.isPm=!this.isPm;
-		if(this.date.getHours()>12) this.date.setHours(this.date.getHours()-12);
-		this.adjust();
-	},
-
-	postCreate:function(args){
-		//	make sure any attributes are the right type.
-		this.is24HourClock=Boolean(this.is24HourClock);
-		if (args.date) { this.date = new Date(args.date); }
-		else { this.date = new Date(); }
-		this.isPm=Boolean(this.isPm);
-		
-		//	options
-		this.displayHours=Boolean(this.displayHours);
-		this.displayMinutes=Boolean(this.displayMinutes);
-		this.displaySeconds=Boolean(this.displaySeconds);
-
-		this.adjustHoursBy=parseInt(this.adjustHoursBy);
-		this.adjustMinutesBy=parseInt(this.adjustMinutesBy);
-		this.adjustSecondsBy=parseInt(this.adjustSecondsBy);
-	
-		//	from here we build.
-		this.hourElement=document.createElement("input");
-		this.hourElement.style.width="20px";
-		this.hourElement.style.textAlign="right";
-		dojo.event.connect(this.hourElement, "onchange", this, "adjustHours");
-
-		this.minuteElement=document.createElement("input");
-		this.minuteElement.style.width="20px";
-		this.minuteElement.style.textAlign="right";
-		dojo.event.connect(this.minuteElement, "onchange", this, "adjustMinutes");
-		
-		if (this.displaySeconds){
-			this.secondElement=document.createElement("input");
-			this.secondElement.style.width="20px";
-			this.secondElement.style.textAlign="right";
-			dojo.event.connect(this.secondElement, "onchange", this, "adjustSeconds");
-		}
-		
-		if (!this.is24HourClock){
-			this.amPmElement=document.createElement("span");
-			this.amPmElement.style.width="24px";
-		}
-		
-		this.adjust();
-
-		var container=document.createElement("table");
-		container.setAttribute("cellpadding","0");
-		container.setAttribute("cellspacing","0");
-		container.setAttribute("border","0");
-
-		var row=document.createElement("tr");
-		container.appendChild(row);
-
-		var cell=document.createElement("td");
-		cell.setAttribute("rowspan","2");
-		cell.style.padding="0";
-		cell.appendChild(this.hourElement);
-		row.appendChild(cell);
-
-		cell=document.createElement("td");
-		cell.setAttribute("width","12");
-		cell.style.padding="0";
-		this.hourUpElement=document.createElement("img");
-		this.hourUpElement.setAttribute("src", this.imagePath + "domain_up.gif");
-		this.hourUpElement.setAttribute("width","10");
-		this.hourUpElement.setAttribute("height","10");
-		cell.appendChild(this.hourUpElement);
-		dojo.event.connect(this.hourUpElement, "onclick", this, "adjustHours");
-		row.appendChild(cell);
-
-		cell=document.createElement("td");
-		cell.setAttribute("rowspan","2");
-		cell.style.padding="0";
-		cell.style.paddingLeft="2px";
-		cell.appendChild(this.minuteElement);
-		row.appendChild(cell);
-
-		cell=document.createElement("td");
-		cell.setAttribute("width","12");
-		cell.style.padding="0";
-		this.minuteUpElement=document.createElement("img");
-		this.minuteUpElement.setAttribute("src", this.imagePath + "domain_up.gif");
-		this.minuteUpElement.setAttribute("width","10");
-		this.minuteUpElement.setAttribute("height","10");
-		cell.appendChild(this.minuteUpElement);
-		dojo.event.connect(this.minuteUpElement, "onclick", this, "adjustMinutes");
-		row.appendChild(cell);
-
-		if (this.displaySeconds){
-			cell=document.createElement("td");
-			cell.style.padding="0";
-			cell.setAttribute("rowspan","2");
-			cell.appendChild(this.secondElement);
-			cell.style.paddingLeft="2px";
-			row.appendChild(cell);
-
-			cell=document.createElement("td");
-			cell.setAttribute("width","12");
-			cell.style.padding="0";
-			this.secondUpElement=document.createElement("img");
-			this.secondUpElement.setAttribute("src", this.imagePath + "domain_up.gif");
-			this.secondUpElement.setAttribute("width","10");
-			this.secondUpElement.setAttribute("height","10");
-			cell.appendChild(this.secondUpElement);
-			dojo.event.connect(this.secondUpElement, "onclick", this, "adjustSeconds");
-			row.appendChild(cell);
-		}
-
-		if (!this.is24HourClock){
-			cell=document.createElement("td");
-			cell.setAttribute("rowspan","2");
-			cell.setAttribute("valign","bottom");
-			cell.setAttribute("align","right");
-			cell.style.padding="0 2px";
-			cell.style.border="1px solid #ededde";
-			cell.appendChild(this.amPmElement);
-			row.appendChild(cell);
-
-			cell=document.createElement("td");
-			cell.setAttribute("width","12");
-			cell.style.padding="0";
-			this.amPmUpElement=document.createElement("img");
-			this.amPmUpElement.setAttribute("src", this.imagePath + "domain_up.gif");
-			this.amPmUpElement.setAttribute("width","10");
-			this.amPmUpElement.setAttribute("height","10");
-			cell.appendChild(this.amPmUpElement);
-			dojo.event.connect(this.amPmUpElement, "onclick", this, "adjustAmPm");
-			row.appendChild(cell);
-		}
-
-		row=document.createElement("tr");
-		container.appendChild(row);
-
-		cell=document.createElement("td");
-		cell.setAttribute("width","12");
-		cell.setAttribute("valign","bottom");
-		cell.style.padding="0";
-		this.hourDownElement=document.createElement("img");
-		this.hourDownElement.setAttribute("src", this.imagePath + "domain_down.gif");
-		this.hourDownElement.setAttribute("width","10");
-		this.hourDownElement.setAttribute("height","10");
-		cell.appendChild(this.hourDownElement);
-		dojo.event.connect(this.hourDownElement, "onclick", this, "adjustHours");
-		row.appendChild(cell);
-
-		cell=document.createElement("td");
-		cell.setAttribute("width","12");
-		cell.setAttribute("valign","bottom");
-		cell.style.padding="0";
-		this.minuteDownElement=document.createElement("img");
-		this.minuteDownElement.setAttribute("src", this.imagePath + "domain_down.gif");
-		this.minuteDownElement.setAttribute("width","10");
-		this.minuteDownElement.setAttribute("height","10");
-		cell.appendChild(this.minuteDownElement);
-		dojo.event.connect(this.minuteDownElement, "onclick", this, "adjustMinutes");
-		row.appendChild(cell);
-
-		if (this.displaySeconds){
-			cell=document.createElement("td");
-			cell.setAttribute("width","12");
-			cell.setAttribute("valign","bottom");
-			cell.style.padding="0";
-			this.secondDownElement=document.createElement("img");
-			this.secondDownElement.setAttribute("src", this.imagePath + "domain_down.gif");
-			this.secondDownElement.setAttribute("width","10");
-			this.secondDownElement.setAttribute("height","10");
-			cell.appendChild(this.secondDownElement);
-			dojo.event.connect(this.secondDownElement, "onclick", this, "adjustSeconds");
-			row.appendChild(cell);
-		}
-
-		if (!this.is24HourClock){
-			cell=document.createElement("td");
-			cell.setAttribute("width","12");
-			cell.setAttribute("valign","bottom");
-			cell.style.padding="0";
-			this.amPmDownElement=document.createElement("img");
-			this.amPmDownElement.setAttribute("src", this.imagePath + "domain_down.gif");
-			this.amPmDownElement.setAttribute("width","10");
-			this.amPmDownElement.setAttribute("height","10");
-			cell.appendChild(this.amPmDownElement);
-			dojo.event.connect(this.amPmDownElement, "onclick", this, "adjustAmPm");
-			row.appendChild(cell);
-		}
-
-		this.domNode.appendChild(container);
-	}
-});

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/widget/test_AlertDialog.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/widget/test_AlertDialog.html?rev=569495&r1=569494&r2=569495&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/widget/test_AlertDialog.html (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/widget/test_AlertDialog.html Fri Aug 24 12:56:47 2007
@@ -5,39 +5,42 @@
 -->
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
-<title>DatePicker Test</title>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
+    <title>AlertDialog Test</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 
-<script type="text/javascript">
-var djConfig = {
-    isDebug: true
-};
-</script>
-<script type="text/javascript" src="../../dojo-0.4.2/dojo.js"></script>
-<script type="text/javascript" src="../../tapestry/core.js"></script>
+    <script type="text/javascript">
+        var djConfig = {
+            isDebug: true
+        };
+    </script>
+    <script type="text/javascript" src="../../dojo-0.4.3/dojo.js"></script>
+    <script type="text/javascript" src="../../dojo-0.4.3/dojo2.js"></script>
+    <script type="text/javascript" src="../../dojo-0.4.3/dojo3.js"></script>
+    <script type="text/javascript" src="../../tapestry/core.js"></script>
 
 </head>
 
 <body>
 <style>
-	
-	.alertDialog {
-		width:260px;
-		border:2px solid #ff660a;
-		padding:1em;
-		padding-bottom:1.7em;
-	}
-
-	.alertDialog .dojoButton {
-		float:right;
-	}
+
+    .alertDialog {
+        width:260px;
+        border:2px solid #ff660a;
+        padding:1em;
+        padding-bottom:1.7em;
+    }
+
+    .alertDialog .dojoButton {
+        float:right;
+    }
 </style>
 
 <script type="text/javascript">
+    dojo.require("tapestry.form");
     dojo.require("tapestry.namespace");
-    
+
     dojo.addOnLoad(function() {
-    	dojo.widget.byId("alertDialog").show();
+        dojo.widget.byId("alertDialog").show();
     });
 </script>
 <p>la la la la lalala lala </p>

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/widget/test_TimePicker.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/widget/test_TimePicker.html?rev=569495&r1=569494&r2=569495&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/widget/test_TimePicker.html (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/widget/test_TimePicker.html Fri Aug 24 12:56:47 2007
@@ -5,31 +5,153 @@
 -->
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
-<title>TimePicker Test</title>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
+    <title>TimePicker Test</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 
-<script type="text/javascript">
-var djConfig = {
-    isDebug: true
-};
-</script>
-<script type="text/javascript" src="../../dojo-0.4.2/dojo.js"></script>
-<script type="text/javascript" src="../../tapestry/core.js"></script>
+    <script type="text/javascript">
+        var djConfig = {
+            isDebug: true,
+            parseWidgets: false
+        };
+    </script>
+    <script type="text/javascript" src="../../dojo-0.4.3/dojo.js"></script>
+    <script type="text/javascript" src="../../dojo-0.4.3/dojo2.js"></script>
+    <script type="text/javascript" src="../../dojo-0.4.3/dojo3.js"></script>
+    <script type="text/javascript" src="../../tapestry/core.js"></script>
 
 </head>
 
 <body>
 <script type="text/javascript">
-    dojo.require("tapestry.widget.TimePicker");
-    
+    dojo.require("tapestry.namespace");
+
     dojo.addOnLoad(function() {
-    	
+
+        dojo.widget.createWidget("tapestry:TimePicker", {
+            widgetId: "test",
+            inputNodeId:"timeInput",
+            optionValues:["12:00am","12:30am","1:00am","1:30am","2:00am","2:30am","3:00am","3:30am","4:00am","4:30am",
+                    "5:00am","5:30am","6:00am","6:30am","7:00am","7:30am","8:00am","8:30am","9:00am","9:30am","10:00am",
+                    "10:30am","11:00am","11:30am","12:00pm","12:30pm","1:00pm","1:30pm","2:00pm","2:30pm","3:00pm","3:30pm",
+                    "4:00pm","4:30pm","5:00pm","5:30pm","6:00pm","6:30pm","7:00pm","7:30pm","8:00pm","8:30pm","9:00pm","9:30pm",
+                    "10:00pm","10:30pm","11:00pm","11:30pm"],
+            selectedIndex:26
+        });
+
+        dojo.widget.createWidget("tapestry:TimePicker", {
+            widgetId: "test2",
+            inputNodeId:"another",
+            optionValues:["12:00am","12:30am","1:00am","1:30am","2:00am","2:30am","3:00am","3:30am","4:00am","4:30am",
+                    "5:00am","5:30am","6:00am","6:30am","7:00am","7:30am","8:00am","8:30am","9:00am","9:30am","10:00am",
+                    "10:30am","11:00am","11:30am","12:00pm","12:30pm","1:00pm","1:30pm","2:00pm","2:30pm","3:00pm","3:30pm",
+                    "4:00pm","4:30pm","5:00pm","5:30pm","6:00pm","6:30pm","7:00pm","7:30pm","8:00pm","8:30pm","9:00pm","9:30pm",
+                    "10:00pm","10:30pm","11:00pm","11:30pm"]
+        });
     });
 </script>
 
-<p>
-<div dojoType="tapestry:TimePicker" widgetId="picker" ></div>
-</p>
+<style type="text/css">
+    .dropdownCombobox {
+        background: #ffffff;
+        border: 1px solid #545454;
+    }
+
+    .dropdownOption {
+        font-family: arial;
+        font-size: 0.8em;
+        padding: 0.1em 0 0.1em 0.2em;
+        cursor:pointer;
+    }
+
+    .optionHover {
+        background: cornflowerblue;
+        color: #ffffff;
+    }
+</style>
+
+<form action="#">
+    <fieldset>
+        <table>
+            <tr>
+                <td>
+                    <input id="timeInput" type="text" size="7" value="8:24am" />
+                </td>
+                <td>
+                    <input id="another" type="text" size="11" />
+                </td>
+            </tr>
+        </table>
+    </fieldset>
+
+    <fieldset>
+        <select name="selectEr">
+            <option value="1">1 cat ate grass and puked</option>
+            <option value="1">2 cats ate grass and puked</option>
+            <option value="1">3 cats ate grass and puked</option>
+            <option value="1">5 cats ate grass and puked</option>
+            <option value="1">12 cats ate grass and puked</option>
+            <option value="1">4 cats ate grass and puked</option>
+        </select>
+    </fieldset>
+    <fieldset>
+        <input type="password" size="9" />
+    </fieldset>
+</form>
+
+<!--
+<div id="when-st_combobox" class="CB_menu" style="overflow: auto; display: none; position: absolute; top: 39px; left: 23px; width: 5.5em; height: 120px; z-index: 2;">
+    <div>
+        <div id="when-st_combobox_0" class="CB_option">12:00am</div>
+        <div id="when-st_combobox_1" class="CB_option">12:30am</div>
+        <div id="when-st_combobox_2" class="CB_option">1:00am</div>
+        <div id="when-st_combobox_3" class="CB_option">1:30am</div>
+        <div id="when-st_combobox_4" class="CB_option">2:00am</div>
+        <div id="when-st_combobox_5" class="CB_option">2:30am</div>
+        <div id="when-st_combobox_6" class="CB_option">3:00am</div>
+        <div id="when-st_combobox_7" class="CB_option">3:30am</div>
+        <div id="when-st_combobox_8" class="CB_option">4:00am</div>
+        <div id="when-st_combobox_9" class="CB_option">4:30am</div>
+        <div id="when-st_combobox_10" class="CB_option">5:00am</div>
+        <div id="when-st_combobox_11" class="CB_option">5:30am</div>
+        <div id="when-st_combobox_12" class="CB_option">6:00am</div>
+        <div id="when-st_combobox_13" class="CB_option">6:30am</div>
+        <div id="when-st_combobox_14" class="CB_option">7:00am</div>
+        <div id="when-st_combobox_15" class="CB_option">7:30am</div>
+        <div id="when-st_combobox_16" class="CB_option">8:00am</div>
+        <div id="when-st_combobox_17" class="CB_option">8:30am</div>
+        <div id="when-st_combobox_18" class="CB_option">9:00am</div>
+        <div id="when-st_combobox_19" class="CB_option">9:30am</div>
+        <div id="when-st_combobox_20" class="CB_option">10:00am</div>
+        <div id="when-st_combobox_21" class="CB_option">10:30am</div>
+        <div id="when-st_combobox_22" class="CB_option">11:00am</div>
+        <div id="when-st_combobox_23" class="CB_option">11:30am</div>
+        <div id="when-st_combobox_24" class="CB_option">12:00pm</div>
+        <div id="when-st_combobox_25" class="CB_option">12:30pm</div>
+        <div id="when-st_combobox_26" class="CB_option">1:00pm</div>
+        <div id="when-st_combobox_27" class="CB_option">1:30pm</div>
+        <div id="when-st_combobox_28" class="CB_option">2:00pm</div>
+        <div id="when-st_combobox_29" class="CB_option">2:30pm</div>
+        <div id="when-st_combobox_30" class="CB_option">3:00pm</div>
+        <div id="when-st_combobox_31" class="CB_option">3:30pm</div>
+        <div id="when-st_combobox_32" class="CB_option">4:00pm</div>
+        <div id="when-st_combobox_33" class="CB_option">4:30pm</div>
+        <div id="when-st_combobox_34" class="CB_option">5:00pm</div>
+        <div id="when-st_combobox_35" class="CB_option CB_selected">5:30pm</div>
+        <div id="when-st_combobox_36" class="CB_option">6:00pm</div>
+        <div id="when-st_combobox_37" class="CB_option">6:30pm</div>
+        <div id="when-st_combobox_38" class="CB_option">7:00pm</div>
+        <div id="when-st_combobox_39" class="CB_option">7:30pm</div>
+        <div id="when-st_combobox_40" class="CB_option">8:00pm</div>
+        <div id="when-st_combobox_41" class="CB_option">8:30pm</div>
+        <div id="when-st_combobox_42" class="CB_option">9:00pm</div>
+        <div id="when-st_combobox_43" class="CB_option">9:30pm</div>
+        <div id="when-st_combobox_44" class="CB_option">10:00pm</div>
+        <div id="when-st_combobox_45" class="CB_option">10:30pm</div>
+        <div id="when-st_combobox_46" class="CB_option">11:00pm</div>
+        <div id="when-st_combobox_47" class="CB_option">11:30pm</div>
+    </div>
+</div>
+-->
 
 </body>
 </html>

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/form/TestDropdownTimePicker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/form/TestDropdownTimePicker.java?rev=569495&r1=569494&r2=569495&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/form/TestDropdownTimePicker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/form/TestDropdownTimePicker.java Fri Aug 24 12:56:47 2007
@@ -30,93 +30,90 @@
 
 /**
  * Tests functionality of {@link DropdownTimePicker} component.
- * 
+ *
  * @author jkuhnert
  */
 @Test
 public class TestDropdownTimePicker extends BaseFormComponentTestCase
 {
-    
+
     public void test_Render()
     {
         ValidatableFieldSupport vfs = newMock(ValidatableFieldSupport.class);
         DateTranslator translator = new DateTranslator();
         translator.setPattern("hh:mm a");
         ResponseBuilder resp = newMock(ResponseBuilder.class);
-        
+
         IRequestCycle cycle = newMock(IRequestCycle.class);
         IForm form = newMock(IForm.class);
         checkOrder(form, false);
         IPage page = newPage();
         Locale locale = Locale.getDefault();
-        
+
         MockDelegate delegate = new MockDelegate();
-        
+
         IScript script = newMock(IScript.class);
-        
+
         Date dtValue = new Date();
-        
-        DropdownTimePicker component = newInstance(DropdownTimePicker.class, 
-                new Object[] { 
-            "name", "fred",
-            "script", script,
-            "validatableFieldSupport", vfs,
-            "translator", translator,
-            "value", dtValue,
-            "page", page
-        });
-        
+
+        DropdownTimePicker component = newInstance(DropdownTimePicker.class,
+                                                   "name", "fred",
+                                                   "script", script,
+                                                   "validatableFieldSupport", vfs,
+                                                   "translator", translator,
+                                                   "value", dtValue,
+                                                   "page", page);
+
         expect(cycle.renderStackPush(component)).andReturn(component);
-        
         expect(form.getName()).andReturn("testform").anyTimes();
-        
+
         form.setFormFieldUpdating(true);
-        
+
         IMarkupWriter writer = newBufferWriter();
-        
+
         trainGetForm(cycle, form);
         trainWasPrerendered(form, writer, component, false);
-        
+
         trainGetDelegate(form, delegate);
-        
+
         delegate.setFormComponent(component);
-        
+
         trainGetElementId(form, component, "fred");
         trainIsRewinding(form, false);
         expect(cycle.isRewinding()).andReturn(false).anyTimes();
-        
+
         delegate.setFormComponent(component);
-        
+
         expect(cycle.getResponseBuilder()).andReturn(resp).anyTimes();
         expect(resp.isDynamic()).andReturn(false).anyTimes();
-        
+
         vfs.renderContributions(component, writer, cycle);
 
         expect(page.getLocale()).andReturn(locale).anyTimes();
 
         PageRenderSupport prs = newPageRenderSupport();
         trainGetPageRenderSupport(cycle, prs);
-        
+
         script.execute(eq(component), eq(cycle), eq(prs), isA(Map.class));
-        
+
         expect(cycle.renderStackPop()).andReturn(component);
-        
+
         replay();
-        
+
         component.render(writer, cycle);
-        
+
         verify();
-        
+
         assertBuffer("<span class=\"prefix\"><div id=\"fred\" class=\"validation-delegate\"> </div></span>");
     }
-    
+
     public void test_Json_Time()
     {
         long time = System.currentTimeMillis();
-        
+
         JSONObject json = new JSONObject();
         json.put("time", time);
-        
+
         assertEquals(json.toString(), "{\"time\":"+time+"}");
     }
 }

Added: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/form/TestGTimePicker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/form/TestGTimePicker.java?rev=569495&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/form/TestGTimePicker.java (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/form/TestGTimePicker.java Fri Aug 24 12:56:47 2007
@@ -0,0 +1,100 @@
+package org.apache.tapestry.dojo.form;
+
+import org.apache.tapestry.*;
+import org.apache.tapestry.form.BaseFormComponentTestCase;
+import org.apache.tapestry.form.MockDelegate;
+import org.apache.tapestry.form.TranslatedFieldSupport;
+import org.apache.tapestry.form.ValidatableFieldSupport;
+import org.apache.tapestry.form.translator.DateTranslator;
+import org.apache.tapestry.services.ResponseBuilder;
+import static org.easymock.EasyMock.*;
+import org.testng.annotations.Test;
+
+import java.util.Date;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * Tests functionality of {@link GTimePicker} component.
+ */
+@Test
+public class TestGTimePicker extends BaseFormComponentTestCase
+{
+
+    public void test_Render()
+    {
+        ValidatableFieldSupport vfs = newMock(ValidatableFieldSupport.class);
+        TranslatedFieldSupport tfs = newMock(TranslatedFieldSupport.class);
+
+        DateTranslator translator = new DateTranslator();
+        translator.setPattern("hh:mm a");
+        ResponseBuilder resp = newMock(ResponseBuilder.class);
+
+        IRequestCycle cycle = newMock(IRequestCycle.class);
+        IForm form = newMock(IForm.class);
+        checkOrder(form, false);
+        IPage page = newPage();
+        Locale locale = Locale.getDefault();
+
+        MockDelegate delegate = new MockDelegate();
+
+        IScript script = newMock(IScript.class);
+
+        Date dtValue = new Date();
+
+        GTimePicker component = newInstance(GTimePicker.class,
+                                            "name", "fred",
+                                            "script", script,
+                                            "validatableFieldSupport", vfs,
+                                            "translatedFieldSupport", tfs,
+                                            "translator", translator,
+                                            "value", dtValue,
+                                            "page", page);
+
+        expect(cycle.renderStackPush(component)).andReturn(component);
+        expect(form.getName()).andReturn("testform").anyTimes();
+
+        form.setFormFieldUpdating(true);
+
+        IMarkupWriter writer = newBufferWriter();
+
+        trainGetForm(cycle, form);
+        trainWasPrerendered(form, writer, component, false);
+
+        trainGetDelegate(form, delegate);
+
+        delegate.setFormComponent(component);
+
+        trainGetElementId(form, component, "fred");
+        trainIsRewinding(form, false);
+        expect(cycle.isRewinding()).andReturn(false).anyTimes();
+
+        delegate.setFormComponent(component);
+
+        expect(cycle.getResponseBuilder()).andReturn(resp).anyTimes();
+        expect(resp.isDynamic()).andReturn(false).anyTimes();
+
+        expect(tfs.format(component, dtValue)).andReturn(dtValue.toString());
+
+        tfs.renderContributions(component, writer, cycle);
+        vfs.renderContributions(component, writer, cycle);
+
+        expect(page.getLocale()).andReturn(locale).anyTimes();
+
+        PageRenderSupport prs = newPageRenderSupport();
+        trainGetPageRenderSupport(cycle, prs);
+
+        script.execute(eq(component), eq(cycle), eq(prs), isA(Map.class));
+
+        expect(cycle.renderStackPop()).andReturn(component);
+
+        replay();
+
+        component.render(writer, cycle);
+
+        verify();
+
+        assertBuffer("<span class=\"prefix\"><input type=\"text\" name=\"fred\" "
+                     + "value=\"" + dtValue.toString() + "\" id=\"fred\" class=\"validation-delegate\" /></span>");
+    }
+}

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/form/TestGTimePicker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/form/TestGTimePicker.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/form/TestGTimePicker.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message