Author: jkuhnert
Date: Fri Apr 21 15:45:18 2006
New Revision: 396027

URL: http://svn.apache.org/viewcvs?rev=396027&view=rev
Log:
Started defining some of the tapestry dojo widget management functionality.

Added:
    tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/
      - copied from r395981, 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/ajax/
    
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/IWidget.java
    
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/Widget.js
Removed:
    tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/ajax/
    
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/package.html
Modified:
    tapestry/tapestry4/trunk/examples/TimeTracker/src/context/WEB-INF/Home.page
    
tapestry/tapestry4/trunk/examples/VlibBeans/src/java/org/apache/tapestry/vlib/ejb/impl/OperationsBean.java
    
tapestry/tapestry4/trunk/examples/Workbench/src/java/org/apache/tapestry/workbench/tree/examples/fsmodel/FolderObject.java
    
tapestry/tapestry4/trunk/examples/Workbench/src/java/org/apache/tapestry/workbench/upload/Upload.java
    
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/ApplicationServlet.java
    
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/components/ForBean.java
    
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/components/LinkEventType.java
    
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/AjaxShellDelegate.java
    
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/PropertySelection.java
    
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/PropertySelection.script
    
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/html/Shell.jwc
    
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/parse/TemplateParser.java
    
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/valid/ValidationConstraint.java
    
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/valid/ValidationStrings.java
    tapestry/tapestry4/trunk/framework/src/js/tapestry.profile.js
    
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/engine/RestartServiceTest.java
    
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/event/ReportStatusEventTest.java

Modified: 
tapestry/tapestry4/trunk/examples/TimeTracker/src/context/WEB-INF/Home.page
URL: 
http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/examples/TimeTracker/src/context/WEB-INF/Home.page?rev=396027&r1=396026&r2=396027&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/examples/TimeTracker/src/context/WEB-INF/Home.page 
(original)
+++ tapestry/tapestry4/trunk/examples/TimeTracker/src/context/WEB-INF/Home.page 
Fri Apr 21 15:45:18 2006
@@ -21,31 +21,5 @@
 
 <page-specification class="org.apache.tapestry.timetracker.page.TaskEntryPage">
     
-  <!-- 
-  <bean name="delegate" 
class="org.apache.tapestry.workbench.WorkbenchValidationDelegate" 
property="delegate"/>
-  
-  <property name="clientValidationEnabled" persist="client" 
initial-value="true"/>
-  <property name="includeWeek" persist="client"/>
-  <property name="startDate" persist="client"/>
-  <property name="endDate" persist="client"/>
-
-  <bean name="required" 
class="org.apache.tapestry.form.validator.Required"></bean>
-  <bean name="maxDate" class="org.apache.tapestry.form.validator.MaxDate">
-    <set name="maxDate" value="new java.util.Date()"></set>
-  </bean>
-  <bean name="minDate" class="org.apache.tapestry.form.validator.MinDate">
-    <set name="minDate" value="new java.util.Date()"></set>
-  </bean>
-  
-  <component id="inputEnabled" type="Checkbox">
-    <binding name="value" value="clientValidationEnabled"/> 
-    <binding name="onchange" 
value="literal:javascript:this.form.events.submit();"/>
-  </component>
-  
-  <component id="showError" type="ShowError">
-     <binding name="delegate" value="bean:delegate"/>
-  </component>
-    -->
-    
 </page-specification>
 

Modified: 
tapestry/tapestry4/trunk/examples/VlibBeans/src/java/org/apache/tapestry/vlib/ejb/impl/OperationsBean.java
URL: 
http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/examples/VlibBeans/src/java/org/apache/tapestry/vlib/ejb/impl/OperationsBean.java?rev=396027&r1=396026&r2=396027&view=diff
==============================================================================
--- 
tapestry/tapestry4/trunk/examples/VlibBeans/src/java/org/apache/tapestry/vlib/ejb/impl/OperationsBean.java
 (original)
+++ 
tapestry/tapestry4/trunk/examples/VlibBeans/src/java/org/apache/tapestry/vlib/ejb/impl/OperationsBean.java
 Fri Apr 21 15:45:18 2006
@@ -70,6 +70,50 @@
 
     private static final long serialVersionUID = -3942706099570269035L;
 
+    /**
+     * All queries must use this exact set of select columns, so that
+     * [EMAIL PROTECTED] #convertRow(ResultSet, Object[])} can build the 
correct
+     * [EMAIL PROTECTED] Book} from each row.
+     */
+
+    private static final String[] BOOK_SELECT_COLUMNS = { "book.BOOK_ID",
+            "book.TITLE", "book.DESCRIPTION", "book.ISBN", "owner.PERSON_ID",
+            "owner.FIRST_NAME", "owner.LAST_NAME", "holder.PERSON_ID",
+            "holder.FIRST_NAME", "holder.LAST_NAME", "publisher.PUBLISHER_ID",
+            "publisher.NAME", "book.AUTHOR", "book.HIDDEN", "book.LENDABLE",
+            "book.DATE_ADDED" };
+
+    private static final String[] BOOK_ALIAS_COLUMNS = { "BOOK book",
+            "PERSON owner", "PERSON holder", "PUBLISHER publisher" };
+
+    private static final String[] BOOK_JOINS = {
+            "book.OWNER_ID = owner.PERSON_ID",
+            "book.HOLDER_ID = holder.PERSON_ID",
+            "book.PUBLISHER_ID = publisher.PUBLISHER_ID" };
+
+    private static final Map BOOK_SORT_ASCENDING = new HashMap();
+
+    private static final Map BOOK_SORT_DESCENDING = new HashMap();
+
+    static
+    {
+        BOOK_SORT_ASCENDING.put(SortColumn.TITLE, "book.TITLE");
+        BOOK_SORT_ASCENDING.put(SortColumn.HOLDER,
+                "holder.LAST_NAME, holder.FIRST_NAME");
+        BOOK_SORT_ASCENDING.put(SortColumn.OWNER,
+                "owner.FIRST_NAME, owner.LAST_NAME");
+        BOOK_SORT_ASCENDING.put(SortColumn.PUBLISHER, "publisher.NAME");
+        BOOK_SORT_ASCENDING.put(SortColumn.AUTHOR, "book.AUTHOR");
+
+        BOOK_SORT_DESCENDING.put(SortColumn.TITLE, "book.TITLE DESC");
+        BOOK_SORT_DESCENDING.put(SortColumn.HOLDER,
+                "holder.LAST_NAME DESC, holder.FIRST_NAME DESC");
+        BOOK_SORT_DESCENDING.put(SortColumn.OWNER,
+                "owner.FIRST_NAME DESC, owner.LAST_NAME DESC");
+        BOOK_SORT_DESCENDING.put(SortColumn.PUBLISHER, "publisher.NAME DESC");
+        BOOK_SORT_DESCENDING.put(SortColumn.AUTHOR, "book.AUTHOR DESC");
+    }
+    
     private transient Context _environment;
 
     private transient IBookHome _bookHome;
@@ -700,7 +744,7 @@
      * reassign the books holder back to the owner.
      */
 
-    private void returnBooksFromDeletedPersons(Integer deletedPersonIds[])
+    private void returnBooksFromDeletedPersons(Integer[] deletedPersonIds)
         throws RemoveException
     {
         StatementAssembly assembly = new StatementAssembly();
@@ -718,7 +762,7 @@
      * Invoked to execute a bulk update that moves books to the new admin.
      */
 
-    private void moveBooksFromDeletedPersons(Integer deletedPersonIds[],
+    private void moveBooksFromDeletedPersons(Integer[] deletedPersonIds,
             Integer adminId)
         throws RemoveException
     {
@@ -802,50 +846,6 @@
         if (firstName == null) return lastName;
 
         return firstName + " " + lastName;
-    }
-
-    /**
-     * All queries must use this exact set of select columns, so that
-     * [EMAIL PROTECTED] #convertRow(ResultSet, Object[])} can build the 
correct
-     * [EMAIL PROTECTED] Book} from each row.
-     */
-
-    private static final String[] BOOK_SELECT_COLUMNS = { "book.BOOK_ID",
-            "book.TITLE", "book.DESCRIPTION", "book.ISBN", "owner.PERSON_ID",
-            "owner.FIRST_NAME", "owner.LAST_NAME", "holder.PERSON_ID",
-            "holder.FIRST_NAME", "holder.LAST_NAME", "publisher.PUBLISHER_ID",
-            "publisher.NAME", "book.AUTHOR", "book.HIDDEN", "book.LENDABLE",
-            "book.DATE_ADDED" };
-
-    private static final String[] BOOK_ALIAS_COLUMNS = { "BOOK book",
-            "PERSON owner", "PERSON holder", "PUBLISHER publisher" };
-
-    private static final String[] BOOK_JOINS = {
-            "book.OWNER_ID = owner.PERSON_ID",
-            "book.HOLDER_ID = holder.PERSON_ID",
-            "book.PUBLISHER_ID = publisher.PUBLISHER_ID" };
-
-    private static final Map BOOK_SORT_ASCENDING = new HashMap();
-
-    private static final Map BOOK_SORT_DESCENDING = new HashMap();
-
-    static
-    {
-        BOOK_SORT_ASCENDING.put(SortColumn.TITLE, "book.TITLE");
-        BOOK_SORT_ASCENDING.put(SortColumn.HOLDER,
-                "holder.LAST_NAME, holder.FIRST_NAME");
-        BOOK_SORT_ASCENDING.put(SortColumn.OWNER,
-                "owner.FIRST_NAME, owner.LAST_NAME");
-        BOOK_SORT_ASCENDING.put(SortColumn.PUBLISHER, "publisher.NAME");
-        BOOK_SORT_ASCENDING.put(SortColumn.AUTHOR, "book.AUTHOR");
-
-        BOOK_SORT_DESCENDING.put(SortColumn.TITLE, "book.TITLE DESC");
-        BOOK_SORT_DESCENDING.put(SortColumn.HOLDER,
-                "holder.LAST_NAME DESC, holder.FIRST_NAME DESC");
-        BOOK_SORT_DESCENDING.put(SortColumn.OWNER,
-                "owner.FIRST_NAME DESC, owner.LAST_NAME DESC");
-        BOOK_SORT_DESCENDING.put(SortColumn.PUBLISHER, "publisher.NAME DESC");
-        BOOK_SORT_DESCENDING.put(SortColumn.AUTHOR, "book.AUTHOR DESC");
     }
 
     protected StatementAssembly buildBaseBookQuery()

Modified: 
tapestry/tapestry4/trunk/examples/Workbench/src/java/org/apache/tapestry/workbench/tree/examples/fsmodel/FolderObject.java
URL: 
http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/examples/Workbench/src/java/org/apache/tapestry/workbench/tree/examples/fsmodel/FolderObject.java?rev=396027&r1=396026&r2=396027&view=diff
==============================================================================
--- 
tapestry/tapestry4/trunk/examples/Workbench/src/java/org/apache/tapestry/workbench/tree/examples/fsmodel/FolderObject.java
 (original)
+++ 
tapestry/tapestry4/trunk/examples/Workbench/src/java/org/apache/tapestry/workbench/tree/examples/fsmodel/FolderObject.java
 Fri Apr 21 15:45:18 2006
@@ -22,10 +22,23 @@
 import org.apache.tapestry.contrib.tree.model.ITreeNode;
 import org.apache.tapestry.engine.IEngineService;
 
+/**
+ * 
+ * @author unknown
+ */
 public class FolderObject extends SFObject
 {
 
     /**
+     * serialVersionUID.
+     */
+    private static final long serialVersionUID = 1889745019885512018L;
+
+    private static final String openImage = 
"/org/apache/tapestry/workbench/tree/examples/fsmodel/TreeOpen.gif";
+
+    private static final String closedImage = 
"/org/apache/tapestry/workbench/tree/examples/fsmodel/TreeClosed.gif";
+    
+    /**
      * @associates <{File}>
      * @supplierCardinality 0..*
      * @link aggregation
@@ -157,10 +170,6 @@
     {
         return false;
     }
-
-    private final static String openImage = 
"/org/apache/tapestry/workbench/tree/examples/fsmodel/TreeOpen.gif";
-
-    private final static String closedImage = 
"/org/apache/tapestry/workbench/tree/examples/fsmodel/TreeClosed.gif";
 
     public AssetsHolder getAssets()
     {

Modified: 
tapestry/tapestry4/trunk/examples/Workbench/src/java/org/apache/tapestry/workbench/upload/Upload.java
URL: 
http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/examples/Workbench/src/java/org/apache/tapestry/workbench/upload/Upload.java?rev=396027&r1=396026&r2=396027&view=diff
==============================================================================
--- 
tapestry/tapestry4/trunk/examples/Workbench/src/java/org/apache/tapestry/workbench/upload/Upload.java
 (original)
+++ 
tapestry/tapestry4/trunk/examples/Workbench/src/java/org/apache/tapestry/workbench/upload/Upload.java
 Fri Apr 21 15:45:18 2006
@@ -29,6 +29,11 @@
 
 public abstract class Upload extends BasePage
 {
+    private static final String[] bytesPerLineOptions = new String[]
+    { "8", "16", "24", "32", "40", "48" };
+
+    private IPropertySelectionModel bplModel;
+
     public abstract IUploadFile getFile();
 
     public abstract boolean isShowAscii();
@@ -36,12 +41,7 @@
     public abstract String getBytesPerLine();
 
     public abstract IValidationDelegate getDelegate();
-
-    private static final String[] bytesPerLineOptions = new String[]
-    { "8", "16", "24", "32", "40", "48" };
-
-    private IPropertySelectionModel bplModel;
-
+    
     @InjectPage("UploadResults")
     public abstract UploadResults getUploadResults();
 
@@ -61,4 +61,4 @@
 
         return bplModel;
     }
-}
\ No newline at end of file
+}

Modified: 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/ApplicationServlet.java
URL: 
http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/ApplicationServlet.java?rev=396027&r1=396026&r2=396027&view=diff
==============================================================================
--- 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/ApplicationServlet.java
 (original)
+++ 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/ApplicationServlet.java
 Fri Apr 21 15:45:18 2006
@@ -68,18 +68,6 @@
     private static final Log LOG = LogFactory.getLog(ApplicationServlet.class);
 
     /**
-     * Invokes [EMAIL PROTECTED] #doService(HttpServletRequest, 
HttpServletResponse)}.
-     * 
-     * @since 1.0.6
-     */
-
-    public void doGet(HttpServletRequest request, HttpServletResponse 
response) throws IOException,
-            ServletException
-    {
-        doService(request, response);
-    }
-
-    /**
      * @since 2.3
      */
 
@@ -103,6 +91,18 @@
      * @since 4.0
      */
     private ServletRequestServicer _requestServicer;
+    
+    /**
+     * Invokes [EMAIL PROTECTED] #doService(HttpServletRequest, 
HttpServletResponse)}.
+     * 
+     * @since 1.0.6
+     */
+
+    public void doGet(HttpServletRequest request, HttpServletResponse 
response) throws IOException,
+            ServletException
+    {
+        doService(request, response);
+    }
 
     /**
      * Handles the GET and POST requests. Performs the following:

Modified: 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/components/ForBean.java
URL: 
http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/components/ForBean.java?rev=396027&r1=396026&r2=396027&view=diff
==============================================================================
--- 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/components/ForBean.java
 (original)
+++ 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/components/ForBean.java
 Fri Apr 21 15:45:18 2006
@@ -57,10 +57,17 @@
      */
     private static final char DESC_PRIMARY_KEY = 'P';
 
-    private final RepSource COMPLETE_REP_SOURCE = new CompleteRepSource();
+    private final RepSource _completeRepSource = new CompleteRepSource();
 
-    private final RepSource KEY_EXPRESSION_REP_SOURCE = new 
KeyExpressionRepSource();
+    private final RepSource _keyExpressionRepSource = new 
KeyExpressionRepSource();
 
+    // intermediate members
+    private Object _value;
+
+    private int _index;
+
+    private boolean _rendering;
+    
     // parameters
     public abstract String getElement();
 
@@ -81,13 +88,6 @@
 
     public abstract ExpressionEvaluator getExpressionEvaluator();
 
-    // intermediate members
-    private Object _value;
-
-    private int _index;
-
-    private boolean _rendering;
-
     /**
      * Gets the source binding and iterates through its values. For each, it 
updates the value
      * binding and render's its wrapped elements.
@@ -420,7 +420,7 @@
     }
 
     /**
-     * Uses the 'keyExpression' parameter to determine the primary key of the 
given value
+     * Uses the 'keyExpression' parameter to determine the primary key of the 
given value.
      * 
      * @param value
      *            The value from which the primary key should be extracted
@@ -438,7 +438,7 @@
     }
 
     /**
-     * Uses the 'converter' parameter to determine the primary key of the 
given value
+     * Uses the 'converter' parameter to determine the primary key of the 
given value.
      * 
      * @param value
      *            The value from which the primary key should be extracted
@@ -483,7 +483,7 @@
                     fullSourceIterator,
                     repToValueMap,
                     rep,
-                    COMPLETE_REP_SOURCE);
+                    _completeRepSource);
             if (value != null)
                 return value;
         }
@@ -507,7 +507,7 @@
                             fullSourceIterator,
                             repToValueMap,
                             rep,
-                            KEY_EXPRESSION_REP_SOURCE);
+                            _keyExpressionRepSource);
 
                 // If 'converter' is defined, try to perform conversion from 
primary key to value
                 if (value == null)
@@ -635,7 +635,7 @@
     }
 
     /**
-     * An interface that provides the string representation of a given value
+     * An interface that provides the string representation of a given value.
      */
     protected interface RepSource
     {

Modified: 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/components/LinkEventType.java
URL: 
http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/components/LinkEventType.java?rev=396027&r1=396026&r2=396027&view=diff
==============================================================================
--- 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/components/LinkEventType.java
 (original)
+++ 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/components/LinkEventType.java
 Fri Apr 21 15:45:18 2006
@@ -23,10 +23,6 @@
 
 public class LinkEventType
 {
-    private final String _name;
-
-    private final String _attributeName;
-
     /**
      * Type for <code>onMouseOver</code>. This may also be called "focus".
      */
@@ -71,6 +67,10 @@
 
     public static final LinkEventType MOUSE_UP = new LinkEventType("MOUSE_UP", 
"onMouseUp");
 
+    private final String _name;
+
+    private final String _attributeName;
+    
     /**
      * Constructs a new type of event. The name should match the static final 
variable (i.e.,
      * MOUSE_OVER) and the attributeName is the name of the HTML attribute to 
be managed (i.e.,
@@ -100,4 +100,4 @@
     {
         return "LinkEventType[" + _name + "]";
     }
-}
\ No newline at end of file
+}

Modified: 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/AjaxShellDelegate.java
URL: 
http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/AjaxShellDelegate.java?rev=396027&r1=395981&r2=396027&view=diff
==============================================================================
--- 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/AjaxShellDelegate.java
 (original)
+++ 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/AjaxShellDelegate.java
 Fri Apr 21 15:45:18 2006
@@ -11,7 +11,7 @@
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 // See the License for the specific language governing permissions and
 // limitations under the License.
-package org.apache.tapestry.ajax;
+package org.apache.tapestry.dojo;
 
 import org.apache.tapestry.IAsset;
 import org.apache.tapestry.IMarkupWriter;

Added: 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/IWidget.java
URL: 
http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/IWidget.java?rev=396027&view=auto
==============================================================================
--- 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/IWidget.java
 (added)
+++ 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/IWidget.java
 Fri Apr 21 15:45:18 2006
@@ -0,0 +1,40 @@
+// Copyright Apr 21, 2006 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package org.apache.tapestry.dojo;
+
+import org.apache.tapestry.IMarkupWriter;
+import org.apache.tapestry.IRequestCycle;
+
+
+/**
+ * Represents a tapestry component that delegates part of its
+ * functionality / UI to a corresponding browser <a 
href="http://dojotoolkit.org";>dojo</a>
+ * widget instance.
+ * 
+ * @author jkuhnert
+ */
+public interface IWidget
+{
+    
+    /**
+     * Similar to the semantics involved with normal 
<code>AbstractComponent.renderComponent</code>
+     * method writing component state to the output stream.
+     * 
+     * @param writer
+     *          The markup writer used to write any output.
+     * @param cycle
+     *          The corresponding request.
+     */
+    void renderWidget(IMarkupWriter writer, IRequestCycle cycle);
+}

Added: 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/Widget.js
URL: 
http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/Widget.js?rev=396027&view=auto
==============================================================================
--- 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/Widget.js 
(added)
+++ 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/Widget.js 
Fri Apr 21 15:45:18 2006
@@ -0,0 +1,63 @@
+// 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.
+dojo.provide("tapestry.widget");
+
+dojo.require("dojo.widget");
+dojo.require("dojo.dom");
+dojo.require("dojo.event");
+dojo.require("dojo.lang.common");
+
+// global Tapestry object definition
+//var tapestry;
+//if(dj_undef("tapestry")){ tapestry={}; }
+
+// Define core widget management methods
+tapestry.widget = {
+       
+       /**
+        * Ensures that the widget specified currently exists, 
+        * and if not creates a new widget via dojo.widget.createWidget().
+        * 
+        * @param widgetId 
+        *                      The unique widgetId to search for, will also be
+        *                      used to locate and create the widget via the 
corresponding
+        *                      dom node id if the widget doesn't already exist.
+        * @param type 
+        *                      The dojo widget type string. Ie "dialog" / 
"combobox" / etc..
+        * @param props 
+        *                      The js properties object to create the widget 
with.
+        */
+       synchronizeWidgetState : function(widgetId, type, props){
+               var widget = dojo.widget.byId(widgetId);
+               
+               if (!widget)
+                       this.createWidget(widgetId, type, props);
+       },
+       
+       /**
+        * Creates a new widget (if possible) via dojo.widget.createWidget()
+        */
+       createWidget : function(widgetId, type, props) {
+               var node = dojo.byId(widgetId);
+               if (!node) {
+                       dojo.raise("createWidget() Node not found with 
specified id of '" + widgetId + "'.");
+                       return;
+               }
+               
+               if (!props["widgetId"]) props["widgetId"]=widgetId;
+               
+               dojo.widget.createWidget(type, props, node);
+       }
+       
+}
\ No newline at end of file

Modified: 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/PropertySelection.java
URL: 
http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/PropertySelection.java?rev=396027&r1=396026&r2=396027&view=diff
==============================================================================
--- 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/PropertySelection.java
 (original)
+++ 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/PropertySelection.java
 Fri Apr 21 15:45:18 2006
@@ -17,8 +17,6 @@
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.tapestry.IDirect;
 import org.apache.tapestry.IJSONRender;
 import org.apache.tapestry.IMarkupWriter;
@@ -27,6 +25,7 @@
 import org.apache.tapestry.PageRenderSupport;
 import org.apache.tapestry.Tapestry;
 import org.apache.tapestry.TapestryUtils;
+import org.apache.tapestry.dojo.IWidget;
 import org.apache.tapestry.engine.DirectServiceParameter;
 import org.apache.tapestry.engine.IEngineService;
 import org.apache.tapestry.engine.ILink;
@@ -60,11 +59,8 @@
  * @author Jesse Kuhnert
  */
 public abstract class PropertySelection extends AbstractFormComponent 
-    implements ValidatableField, IJSONRender, IDirect
+    implements ValidatableField, IJSONRender, IDirect, IWidget
 {
-    /* logger */
-    protected static final Log _log = 
LogFactory.getLog(PropertySelection.class);
-    
     /**
      * @see 
org.apache.tapestry.form.AbstractFormComponent#renderFormComponent(org.apache.tapestry.IMarkupWriter,
 org.apache.tapestry.IRequestCycle)
      */
@@ -83,25 +79,7 @@
         
         renderIdAttribute(writer, cycle);
         
-        // if filtering add additional scripts
-        // TODO: This isn't real yet, just getting things mostly working first
-        if (isFilterOnChange()) {
-            
-            DirectServiceParameter dsp = 
-                new DirectServiceParameter(this, new Object[]{}, 
-                        new String[]{getId()}, true);
-            ILink link = getDirectService().getLink(true, dsp);
-            
-            writer.attribute("dojoType", "ComboBox");
-            writer.attribute("dataUrl", link.getURL());
-            writer.attribute("mode", "remote");
-            
-            Map parms = new HashMap();
-            parms.put("select", this);
-            
-            PageRenderSupport prs = TapestryUtils.getPageRenderSupport(cycle, 
this);
-            getScript().execute(cycle, prs, parms);
-        }
+        renderWidget(writer, cycle);
         
         renderDelegateAttributes(writer, cycle);
         
@@ -143,7 +121,7 @@
         }
         
         writer.end(); // <select>
-
+        
         renderDelegateSuffix(writer, cycle);
     }
 
@@ -173,37 +151,53 @@
      */
     public void renderComponent(IJSONWriter writer, IRequestCycle cycle)
     {
-        _log.warn("renderComponent() JSON request");
         IPropertySelectionModel model = getModel();
         
         if (model == null)
             throw Tapestry.createRequiredParameterException(this, "model");
         
         int count = model.getOptionCount();
-        _log.warn("total count:" + count);
         
         for (int i = 0; i < count; i++)
         {
             String value = model.getValue(i);
             String label = model.getLabel(i);
             
-            _log.warn("Filter value:" + getFilter() + "with label:" + label + 
" on count:" + i);
-            
             if (getFilter() == null || getFilter().length() <= 0) {
                 writer.put(value, label);
-                _log.warn("Writing filter value");
                 continue;
             }
             
             // primitive filter, for now
             // TODO: Create filter interface in IPropertySelectionModel
-            if (getFilter() != null 
+            if (getFilter() != null && getFilter().trim().length() > 0
                     && label.toLowerCase().indexOf(getFilter().toLowerCase()) 
> -1) {
                 writer.put(value, label);
             }
         }
     }
     
+    /**
+     * 
+     * [EMAIL PROTECTED]
+     */
+    public void renderWidget(IMarkupWriter writer, IRequestCycle cycle)
+    {
+        if (!isFilterOnChange() || cycle.isRewinding()) return;
+        
+        DirectServiceParameter dsp = 
+            new DirectServiceParameter(this, new Object[]{}, 
+                    new String[]{getId()}, true);
+        ILink link = getDirectService().getLink(true, dsp);
+        
+        Map parms = new HashMap();
+        parms.put("id", this.getClientId());
+        parms.put("props", "{dataUrl:'" + link.getURL() + "', mode: 
'remote'}");
+        
+        PageRenderSupport prs = TapestryUtils.getPageRenderSupport(cycle, 
this);
+        getScript().execute(cycle, prs, parms);
+    }
+    
     /** 
      * [EMAIL PROTECTED]
      */
@@ -219,9 +213,9 @@
      */
     public void trigger(IRequestCycle cycle)
     {
-        setFilter("zeit");
+        setFilter(cycle.getParameter("searchString"));
     }
-
+    
     private boolean isEqual(Object left, Object right)
     {
         // Both null, or same object, then are equal

Modified: 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/PropertySelection.script
URL: 
http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/PropertySelection.script?rev=396027&r1=396026&r2=396027&view=diff
==============================================================================
--- 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/PropertySelection.script
 (original)
+++ 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/PropertySelection.script
 Fri Apr 21 15:45:18 2006
@@ -3,7 +3,10 @@
   "-//Apache Software Foundation//Tapestry Script Specification 3.0//EN"
   "http://jakarta.apache.org/tapestry/dtd/Script_3_0.dtd";>
 <script>
-<input-symbol key="select" required="yes" />
+<include-script resource-path="/org/apache/tapestry/dojo/Widget.js"/>
+
+<input-symbol key="id" required="yes" />
+<input-symbol key="props" required="yes" />
     <body>
         <unique>
             dojo.require("dojo.io");
@@ -13,11 +16,6 @@
         </unique>
     </body>
     <initialization>
-        dojo.event.connect(window, "onload", function() {
-            dojo.debug("Parsing combo box");
-            // djConfig.searchIds.push("${select.getId()}");
-            // dojo.debug("searchIds length:" + djConfig.searchIds.length);
-            // dojo.hostenv.makeWidgets();
-        });
+        tapestry.widget.synchronizeWidgetState("${id}", "combobox", ${props});
     </initialization>
 </script>

Modified: 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/html/Shell.jwc
URL: 
http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/html/Shell.jwc?rev=396027&r1=396026&r2=396027&view=diff
==============================================================================
--- 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/html/Shell.jwc 
(original)
+++ 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/html/Shell.jwc 
Fri Apr 21 15:45:18 2006
@@ -119,7 +119,7 @@
   <inject property="baseTagWriter" 
object="service:tapestry.url.BaseTagWriter"/>
   <inject property="assetService" object="service:tapestry.services.Asset"/>
   
-  <bean name="coreAjaxDelegate" 
class="org.apache.tapestry.ajax.AjaxShellDelegate">
+  <bean name="coreAjaxDelegate" 
class="org.apache.tapestry.dojo.AjaxShellDelegate">
    <set name="dojoSource" value="dojoSource" />
    <set name="assetService" value="assetService" />
    <set name="dojoPath" value="dojoPath" />

Modified: 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/parse/TemplateParser.java
URL: 
http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/parse/TemplateParser.java?rev=396027&r1=396026&r2=396027&view=diff
==============================================================================
--- 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/parse/TemplateParser.java
 (original)
+++ 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/parse/TemplateParser.java
 Fri Apr 21 15:45:18 2006
@@ -91,21 +91,6 @@
 public class TemplateParser implements ITemplateParser
 {
     /**
-     * A "magic" component id that causes the tag with the id and its entire 
body to be ignored
-     * during parsing.
-     */
-
-    private static final String REMOVE_ID = "$remove$";
-
-    /**
-     * A "magic" component id that causes the tag to represent the true 
content of the template. Any
-     * content prior to the tag is discarded, and any content after the tag is 
ignored. The tag
-     * itself is not included.
-     */
-
-    private static final String CONTENT_ID = "$content$";
-
-    /**
      * The attribute, checked for in &lt;span&gt; tags, that signfies that the 
span is being used as
      * an invisible localization.
      * 
@@ -123,17 +108,9 @@
      */
 
     public static final String RAW_ATTRIBUTE_NAME = "raw";
-
-    /**
-     * Attribute name used to identify components.
-     * 
-     * @since 4.0
-     */
-
-    private String _componentAttributeName;
-
-    private static final String PROPERTY_NAME_PATTERN = "_?[a-zA-Z]\\w*";
-
+    
+    public static final String PROPERTY_NAME_PATTERN = "_?[a-zA-Z]\\w*";
+    
     /**
      * Pattern used to recognize ordinary components (defined in the 
specification).
      * 
@@ -141,7 +118,7 @@
      */
 
     public static final String SIMPLE_ID_PATTERN = "^(" + 
PROPERTY_NAME_PATTERN + ")$";
-
+    
     /**
      * Pattern used to recognize implicit components (whose type is defined in 
the template).
      * Subgroup 1 is the id (which may be null) and subgroup 2 is the type 
(which may be qualified
@@ -154,6 +131,21 @@
     public static final String IMPLICIT_ID_PATTERN = "^(" + 
PROPERTY_NAME_PATTERN + ")?@((("
             + PROPERTY_NAME_PATTERN + "):)?((" + PROPERTY_NAME_PATTERN + "/)*"
             + PROPERTY_NAME_PATTERN + "))$";
+    
+    /**
+     * A "magic" component id that causes the tag with the id and its entire 
body to be ignored
+     * during parsing.
+     */
+
+    private static final String REMOVE_ID = "$remove$";
+
+    /**
+     * A "magic" component id that causes the tag to represent the true 
content of the template. Any
+     * content prior to the tag is discarded, and any content after the tag is 
ignored. The tag
+     * itself is not included.
+     */
+
+    private static final String CONTENT_ID = "$content$";
 
     private static final int IMPLICIT_ID_PATTERN_ID_GROUP = 1;
 
@@ -163,6 +155,42 @@
 
     private static final int IMPLICIT_ID_PATTERN_SIMPLE_TYPE_GROUP = 5;
 
+    private static final char[] COMMENT_START = new char[]
+                                                         { '<', '!', '-', '-' 
};
+
+    private static final char[] COMMENT_END = new char[]
+                                                       { '-', '-', '>' };
+
+    private static final char[] CLOSE_TAG = new char[]
+                                                     { '<', '/' };
+    
+    private static final int WAIT_FOR_ATTRIBUTE_NAME = 0;
+
+    private static final int COLLECT_ATTRIBUTE_NAME = 1;
+
+    private static final int ADVANCE_PAST_EQUALS = 2;
+
+    private static final int WAIT_FOR_ATTRIBUTE_VALUE = 3;
+
+    private static final int COLLECT_QUOTED_VALUE = 4;
+
+    private static final int COLLECT_UNQUOTED_VALUE = 5;
+    
+    /**
+     * Conversions needed by [EMAIL PROTECTED] 
#convertEntitiesToPlain(String)}.
+     */
+
+    private static final String[] CONVERSIONS =
+    { "&lt;", "<", "&gt;", ">", "&quot;", "\"", "&amp;", "&" };
+    
+    /**
+     * Attribute name used to identify components.
+     * 
+     * @since 4.0
+     */
+
+    private String _componentAttributeName;
+    
     private Pattern _simpleIdPattern;
 
     private Pattern _implicitIdPattern;
@@ -198,11 +226,15 @@
     private char[] _templateData;
 
     /**
-     * List of Tag
+     * List of Tag.
      */
 
     private List _stack = new ArrayList();
 
+    /**
+     * 
+     * @author hls
+     */
     private static class Tag
     {
         // The element, i.e., <jwc> or virtually any other element (via jwcid 
attribute)
@@ -409,7 +441,6 @@
      */
 
     protected void templateParseProblem(ApplicationRuntimeException exception, 
int line, int cursor)
-            throws ApplicationRuntimeException
     {
         throw exception;
     }
@@ -449,15 +480,6 @@
         }
     }
 
-    private static final char[] COMMENT_START = new char[]
-    { '<', '!', '-', '-' };
-
-    private static final char[] COMMENT_END = new char[]
-    { '-', '-', '>' };
-
-    private static final char[] CLOSE_TAG = new char[]
-    { '<', '/' };
-
     protected void parse() throws TemplateParseException
     {
         _cursor = 0;
@@ -557,18 +579,6 @@
         _blockStart = -1;
     }
 
-    private static final int WAIT_FOR_ATTRIBUTE_NAME = 0;
-
-    private static final int COLLECT_ATTRIBUTE_NAME = 1;
-
-    private static final int ADVANCE_PAST_EQUALS = 2;
-
-    private static final int WAIT_FOR_ATTRIBUTE_VALUE = 3;
-
-    private static final int COLLECT_QUOTED_VALUE = 4;
-
-    private static final int COLLECT_UNQUOTED_VALUE = 5;
-
     private void startTag() throws TemplateParseException
     {
         int cursorStart = _cursor;
@@ -1371,13 +1381,6 @@
 
         return null;
     }
-
-    /**
-     * Conversions needed by [EMAIL PROTECTED] #convertEntitiesToPlain(String)}
-     */
-
-    private static final String[] CONVERSIONS =
-    { "&lt;", "<", "&gt;", ">", "&quot;", "\"", "&amp;", "&" };
 
     /**
      * Provided a raw input string that has been recognized to be an 
expression, this removes excess

Modified: 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/valid/ValidationConstraint.java
URL: 
http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/valid/ValidationConstraint.java?rev=396027&r1=396026&r2=396027&view=diff
==============================================================================
--- 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/valid/ValidationConstraint.java
 (original)
+++ 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/valid/ValidationConstraint.java
 Fri Apr 21 15:45:18 2006
@@ -24,8 +24,6 @@
 
 public class ValidationConstraint implements Serializable
 {
-    private static final long serialVersionUID = 371593028205311930L;
-
     /**
      * Indicates that no value (or a value consisting only of white space) was 
provided for a field
      * that requires a non-null value.
@@ -98,7 +96,7 @@
     public static final ValidationConstraint CONSISTENCY = new 
ValidationConstraint("CONSISTENCY");
 
     /**
-     * Indicates that a URL is not of the correct format
+     * Indicates that a URL is not of the correct format.
      * 
      * @since 3.0
      */
@@ -106,7 +104,7 @@
     public static final ValidationConstraint URL_FORMAT = new 
ValidationConstraint("URL_FORMAT");
 
     /**
-     * Indicates that the URL does not use one of the specified protocols
+     * Indicates that the URL does not use one of the specified protocols.
      * 
      * @since 3.0
      */
@@ -114,6 +112,8 @@
     public static final ValidationConstraint DISALLOWED_PROTOCOL = new 
ValidationConstraint(
             "DISALLOWED_PROTOCOL");
 
+    private static final long serialVersionUID = 371593028205311930L;
+    
     private final String _name;
 
     /**
@@ -129,4 +129,4 @@
     {
         return "ValidationConstraint[" + _name + "]";
     }
-}
\ No newline at end of file
+}

Modified: 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/valid/ValidationStrings.java
URL: 
http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/valid/ValidationStrings.java?rev=396027&r1=396026&r2=396027&view=diff
==============================================================================
--- 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/valid/ValidationStrings.java
 (original)
+++ 
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/valid/ValidationStrings.java
 Fri Apr 21 15:45:18 2006
@@ -45,6 +45,11 @@
     
     private static final String RESOURCE_BUNDLE = 
ValidationStrings.class.getName();
     
+    private ValidationStrings()
+    {
+        // Disable construction
+    }
+    
     /**
      * Fetches the appropriate validation message pattern from the appropriate 
localized resource.
      * This method should be called with the locale of the current request.
@@ -54,8 +59,4 @@
         return ResourceBundle.getBundle(RESOURCE_BUNDLE, 
locale).getString(key);
     }
     
-    private ValidationStrings()
-    {
-        // Disable construction
-    }
 }

Modified: tapestry/tapestry4/trunk/framework/src/js/tapestry.profile.js
URL: 
http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/js/tapestry.profile.js?rev=396027&r1=396026&r2=396027&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/tapestry.profile.js (original)
+++ tapestry/tapestry4/trunk/framework/src/js/tapestry.profile.js Fri Apr 21 
15:45:18 2006
@@ -7,7 +7,11 @@
        "dojo.io.IO",
        "dojo.io.BrowserIO",
        "dojo.event.*", // NOTE: this includes topic support
-       "dojo.lang.*",
+       "dojo.lang.common",
+       "dojo.event",
+       "dojo.dom",
+       "dojo.html",
+       "dojo.json",
        "dojo.widget.Manager"
 ];
 

Modified: 
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/engine/RestartServiceTest.java
URL: 
http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/engine/RestartServiceTest.java?rev=396027&r1=396026&r2=396027&view=diff
==============================================================================
--- 
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/engine/RestartServiceTest.java
 (original)
+++ 
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/engine/RestartServiceTest.java
 Fri Apr 21 15:45:18 2006
@@ -20,7 +20,6 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.tapestry.IRequestCycle;
-import org.apache.tapestry.services.AbsoluteURLBuilder;
 
 /**
  * Tests for [EMAIL PROTECTED] org.apache.tapestry.engine.RestartService}.
@@ -61,11 +60,6 @@
         setReturnValue(request, session);
     }
 
-    private AbsoluteURLBuilder newBuilder()
-    {
-        return (AbsoluteURLBuilder) newMock(AbsoluteURLBuilder.class);
-    }
-
     private HttpServletResponse newServletResponse()
     {
         return (HttpServletResponse) newMock(HttpServletResponse.class);
@@ -146,4 +140,4 @@
 
         verifyControls();
     }
-}
\ No newline at end of file
+}

Modified: 
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/event/ReportStatusEventTest.java
URL: 
http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/event/ReportStatusEventTest.java?rev=396027&r1=396026&r2=396027&view=diff
==============================================================================
--- 
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/event/ReportStatusEventTest.java
 (original)
+++ 
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/event/ReportStatusEventTest.java
 Fri Apr 21 15:45:18 2006
@@ -57,7 +57,7 @@
         receiver.property("boolean-false", false);
         receiver.property("byte", (byte) 37);
         receiver.property("char", 'z');
-        receiver.property("double", (double) 3.14);
+        receiver.property("double", 3.14);
         receiver.property("float", (float) 9.99);
         receiver.property("int", -373);
         receiver.property("long", 373737l);
@@ -76,7 +76,7 @@
         event.property("boolean-false", false);
         event.property("byte", (byte) 37);
         event.property("char", 'z');
-        event.property("double", (double) 3.14);
+        event.property("double", 3.14);
         event.property("float", (float) 9.99);
         event.property("int", -373);
         event.property("long", 373737l);



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to