tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkuhn...@apache.org
Subject svn commit: r418644 - in /tapestry/tapestry4/trunk: examples/TimeTracker/src/context/ examples/TimeTracker/src/context/WEB-INF/ examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/ framework/src/descriptor/META-INF/ framework/src/java/or...
Date Sun, 02 Jul 2006 20:12:52 GMT
Author: jkuhnert
Date: Sun Jul  2 13:12:51 2006
New Revision: 418644

URL: http://svn.apache.org/viewvc?rev=418644&view=rev
Log:
Some initial dynamic field support.

Modified:
    tapestry/tapestry4/trunk/examples/TimeTracker/src/context/Home.html
    tapestry/tapestry4/trunk/examples/TimeTracker/src/context/WEB-INF/Home.properties
    tapestry/tapestry4/trunk/examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/TaskEntryPage.java
    tapestry/tapestry4/trunk/framework/src/descriptor/META-INF/tapestry.services.xml
    tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/FormBehavior.java
    tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/engine/RequestCycle.java
    tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/error/StaleLinkExceptionPresenterImpl.java
    tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/AbstractFormComponent.java
    tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/Form.java
    tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/FormSupportImpl.java
    tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/IFormComponent.java
    tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/pages/StaleLink.html
    tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/pages/StaleSession.html
    tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/services/ResponseBuilder.java
    tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/services/impl/DefaultResponseBuilder.java
    tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/services/impl/DojoAjaxResponseBuilder.java
    tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/services/impl/DojoAjaxResponseContributorImpl.java
    tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/services/impl/JSONResponseBuilder.java
    tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/services/impl/RequestCycleFactoryImpl.java
    tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/wml/GoFormSupportImpl.java
    tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/MockForm.java
    tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/DojoAjaxResponseBuilderTest.java

Modified: tapestry/tapestry4/trunk/examples/TimeTracker/src/context/Home.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/examples/TimeTracker/src/context/Home.html?rev=418644&r1=418643&r2=418644&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/examples/TimeTracker/src/context/Home.html (original)
+++ tapestry/tapestry4/trunk/examples/TimeTracker/src/context/Home.html Sun Jul  2 13:12:51
2006
@@ -47,18 +47,16 @@
       </td>
     </tr>
     
-    <!--
-    <tr>
-    	<td>
-    		<div class="field required">
-    			<input jwcid="emailInput@TextField" value="ognl:email" 
-    					validators="validators:email,required" />
-    		</div>
-    	</td>
-    </tr>
-    -->
-    
     </table>
+    
+    <div jwcid="feedbackBlock@Any">
+    	<span jwcid="@If" condition="ognl:selectedProject">
+    		<label jwcid="@FieldLabel" field="component:feedbackField" />
+    		<input jwcid="feedbackField@TextField" displayName="message:feedback" 
+    				value="ognl:feedback" />
+    	</span>
+    </div>
+    
     </fieldset>
 </form>
 

Modified: tapestry/tapestry4/trunk/examples/TimeTracker/src/context/WEB-INF/Home.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/examples/TimeTracker/src/context/WEB-INF/Home.properties?rev=418644&r1=418643&r2=418644&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/examples/TimeTracker/src/context/WEB-INF/Home.properties (original)
+++ tapestry/tapestry4/trunk/examples/TimeTracker/src/context/WEB-INF/Home.properties Sun
Jul  2 13:12:51 2006
@@ -8,3 +8,5 @@
 task.end.time=End
 task.duration=Duration
 task.description=Description
+
+feedback=Feedback

Modified: tapestry/tapestry4/trunk/examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/TaskEntryPage.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/TaskEntryPage.java?rev=418644&r1=418643&r2=418644&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/TaskEntryPage.java
(original)
+++ tapestry/tapestry4/trunk/examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/TaskEntryPage.java
Sun Jul  2 13:12:51 2006
@@ -15,8 +15,6 @@
 
 import java.util.Date;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.tapestry.IRequestCycle;
 import org.apache.tapestry.annotations.Component;
 import org.apache.tapestry.annotations.EventListener;
@@ -42,7 +40,6 @@
  */
 public abstract class TaskEntryPage extends BasePage
 {
-    private static final Log _log = LogFactory.getLog(TaskEntryPage.class);
     
     @Component(type = "Autocompleter", id = "projectChoose",
             bindings = { "model=projectModel", "value=selectedProject",
@@ -61,7 +58,7 @@
     @Component(type = "DropdownDatePicker", id = "datePicker",
             bindings = {"value=date", 
             "displayName=message:task.start.date", 
-            "validators=validators:required,maxDate=05/29/2006"})
+            "validators=validators:required"})
     public abstract DropdownDatePicker getDatePicker();
     public abstract Date getDate();
     
@@ -87,7 +84,7 @@
     @InjectObject("service:timetracker.dao.TaskDao")
     public abstract TaskDao getTaskDao();
     
-    public abstract String getEmail();
+    public abstract String getFeedback();
     
     /**
      * Selection model for projects.
@@ -106,8 +103,8 @@
             submitForm = "taskForm")
     public void projectSelected(IRequestCycle cycle)
     {
-        _log.debug("projectSelected() " + getSelectedProject());
         cycle.getResponseBuilder().updateComponent("projectDescription");
+        cycle.getResponseBuilder().updateComponent("feedbackBlock");
     }
     
     /**

Modified: tapestry/tapestry4/trunk/framework/src/descriptor/META-INF/tapestry.services.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/descriptor/META-INF/tapestry.services.xml?rev=418644&r1=418643&r2=418644&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/descriptor/META-INF/tapestry.services.xml (original)
+++ tapestry/tapestry4/trunk/framework/src/descriptor/META-INF/tapestry.services.xml Sun Jul
 2 13:12:51 2006
@@ -247,6 +247,8 @@
                 <set-object property="webResponse" value="infrastructure:response"/>
                 <set-object property="webRequest" value="infrastructure:request"/>
                 <set-object property="exceptionPageName" value="infrastructure:exceptionPageName"/>
+                <set-object property="staleSessionPageName" value="infrastructure:staleSessionPageName"
/>
+                <set-object property="staleLinkPageName" value="infrastructure:staleLinkPageName"
/>
             </construct>
         </invoke-factory>
     </service-point>

Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/FormBehavior.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/FormBehavior.java?rev=418644&r1=418643&r2=418644&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/FormBehavior.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/FormBehavior.java Sun
Jul  2 13:12:51 2006
@@ -168,4 +168,29 @@
      * @return {@link JSONObject} profile.
      */
     JSONObject getProfile();
+    
+    /**
+     * Sets a flag denoting whether or not an {@link IFormComponent} field has been
+     * updated according to the logic defined in 
+     * {@link org.apache.tapestry.services.ResponseBuilder#updateComponent(String)}.
+     * 
+     * <p>
+     * Currently this flag is used during ajax/json responses so that cooperating 
+     * {@link ResponseBuilder}s can be worked with to ensure form state is properly
+     * updated on the client. Specifically, that the hidden form input fields and 
+     * any associated validation profiles are updated.
+     * </p>
+     * 
+     * @param value 
+     *          The value to set.
+     */
+    void setFormFieldUpdating(boolean value);
+    
+    /**
+     * Checks to see if a form field has been updated. 
+     * 
+     * @see #setFormFieldUpdating(boolean)
+     * @return
+     */
+    boolean isFormFieldUpdating();
 }

Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/engine/RequestCycle.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/engine/RequestCycle.java?rev=418644&r1=418643&r2=418644&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/engine/RequestCycle.java
(original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/engine/RequestCycle.java
Sun Jul  2 13:12:51 2006
@@ -288,7 +288,7 @@
 
         return result;
     }
-
+    
     public void setResponseBuilder(ResponseBuilder builder)
     {
         //if (_responseBuilder != null)

Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/error/StaleLinkExceptionPresenterImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/error/StaleLinkExceptionPresenterImpl.java?rev=418644&r1=418643&r2=418644&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/error/StaleLinkExceptionPresenterImpl.java
(original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/error/StaleLinkExceptionPresenterImpl.java
Sun Jul  2 13:12:51 2006
@@ -44,7 +44,7 @@
         throws IOException
     {
         IPage exceptionPage = cycle.getPage(_pageName);
-
+        
         PropertyUtils.write(exceptionPage, "message", cause.getMessage());
 
         cycle.activate(exceptionPage);

Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/AbstractFormComponent.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/AbstractFormComponent.java?rev=418644&r1=418643&r2=418644&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/AbstractFormComponent.java
(original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/AbstractFormComponent.java
Sun Jul  2 13:12:51 2006
@@ -19,6 +19,7 @@
 import org.apache.tapestry.IMarkupWriter;
 import org.apache.tapestry.IRequestCycle;
 import org.apache.tapestry.TapestryUtils;
+import org.apache.tapestry.engine.NullWriter;
 import org.apache.tapestry.valid.IValidationDelegate;
 import org.apache.tapestry.valid.ValidationConstants;
 
@@ -98,31 +99,34 @@
         IForm form = TapestryUtils.getForm(cycle, this);
 
         setForm(form);
-
+        
         if (form.wasPrerendered(writer, this))
             return;
 
         IValidationDelegate delegate = form.getDelegate();
 
         delegate.setFormComponent(this);
-
+        
         setName(form);
-
+        
         if (form.isRewinding())
         {
             if (!isDisabled())
             {
                 rewindFormComponent(writer, cycle);
             }
-
+            
             // This is for the benefit of the couple of components (LinkSubmit) that allow
a body.
             // The body should render when the component rewinds.
-
+            
             if (getRenderBodyOnRewind())
                 renderBody(writer, cycle);
         }
         else if (!cycle.isRewinding())
         {
+            if (!NullWriter.class.isInstance(writer))
+                form.setFormFieldUpdating(true);
+            
             renderFormComponent(writer, cycle);
 
             if (getCanTakeFocus() && !isDisabled())

Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/Form.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/Form.java?rev=418644&r1=418643&r2=418644&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/Form.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/Form.java Sun Jul
 2 13:12:51 2006
@@ -452,4 +452,20 @@
     {
         return _formSupport.getProfile();
     }
+
+    /** 
+     * {@inheritDoc}
+     */
+    public boolean isFormFieldUpdating()
+    {
+        return _formSupport.isFormFieldUpdating();
+    }
+
+    /** 
+     * {@inheritDoc}
+     */
+    public void setFormFieldUpdating(boolean value)
+    {
+        _formSupport.setFormFieldUpdating(value);
+    }
 }

Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/FormSupportImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/FormSupportImpl.java?rev=418644&r1=418643&r2=418644&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/FormSupportImpl.java
(original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/FormSupportImpl.java
Sun Jul  2 13:12:51 2006
@@ -41,6 +41,7 @@
 import org.apache.tapestry.engine.ILink;
 import org.apache.tapestry.event.BrowserEvent;
 import org.apache.tapestry.json.JSONObject;
+import org.apache.tapestry.services.ResponseBuilder;
 import org.apache.tapestry.services.ServiceConstants;
 import org.apache.tapestry.util.IdAllocator;
 import org.apache.tapestry.valid.IValidationDelegate;
@@ -160,6 +161,8 @@
 
     private final JSONObject _profile;
     
+    private boolean _fieldUpdating;
+    
     public FormSupportImpl(IMarkupWriter writer, IRequestCycle cycle, IForm form)
     {
         Defense.notNull(writer, "writer");
@@ -170,7 +173,7 @@
         _cycle = cycle;
         _form = form;
         _delegate = form.getDelegate();
-
+        
         _rewinding = cycle.isRewound(form);
         _allocatedIdIndex = 0;
         
@@ -268,14 +271,14 @@
                 sep = ",";
                 hasExtra = true;
             }
-
+            
             addHiddenFieldsForLinkParameter(link, name);
         }
-
+        
         if (hasExtra)
             addHiddenValue(RESERVED_FORM_IDS, extraIds.toString());
     }
-
+    
     public void addHiddenValue(String name, String value)
     {
         _hiddenValues.add(new HiddenFieldData(name, value));
@@ -638,54 +641,70 @@
         writer.beginEmpty("input");
         writer.attribute("type", "hidden");
         writer.attribute("name", name);
-
+        
         if (HiveMind.isNonBlank(id))
             writer.attribute("id", id);
-
+        
         writer.attribute("value", value == null ? "" : value);
         writer.println();
     }
 
-    private void writeHiddenField(String name, String id, String value)
-    {
-        writeHiddenField(_writer, name, id, value);
-    }
-
     /**
      * Writes out all hidden values previously added by
      * {@link #addHiddenValue(String, String, String)}. Writes a &lt;div&gt; tag
around
      * {@link #writeHiddenFieldList()}. Overriden by
      * {@link org.apache.tapestry.wml.GoFormSupportImpl}.
      */
-
+    
     protected void writeHiddenFields()
     {
-        _writer.begin("div");
-        _writer.attribute("style", "display:none;");
-
-        writeHiddenFieldList();
-
-        _writer.end();
+        IMarkupWriter writer = getHiddenFieldWriter();
+        
+        writer.begin("div");
+        writer.attribute("style", "display:none;");
+        writer.attribute("id", _form.getName() + "hidden");
+        
+        writeHiddenFieldList(writer);
+        
+        writer.end();
     }
-
+    
     /**
      * Writes out all hidden values previously added by
      * {@link #addHiddenValue(String, String, String)}, plus the allocated id list.
      */
-
-    protected void writeHiddenFieldList()
+    
+    protected void writeHiddenFieldList(IMarkupWriter writer)
     {
-        writeHiddenField(FORM_IDS, null, buildAllocatedIdList());
-
+        writeHiddenField(writer, FORM_IDS, null, buildAllocatedIdList());
+        
         Iterator i = _hiddenValues.iterator();
         while (i.hasNext())
         {
             HiddenFieldData data = (HiddenFieldData) i.next();
-
-            writeHiddenField(data.getName(), data.getId(), data.getValue());
+            
+            writeHiddenField(writer, data.getName(), data.getId(), data.getValue());
         }
     }
-
+    
+    /**
+     * Determines if a hidden field change has occurred, which would require
+     * that we write hidden form fields using the {@link ResponseBuilder} 
+     * writer.
+     * 
+     * @return The default {@link IMarkupWriter} if not doing a managed ajax/json
+     *          response, else whatever is returned from {@link ResponseBuilder}.
+     */
+    protected IMarkupWriter getHiddenFieldWriter()
+    {
+        if (!_fieldUpdating || !_cycle.getResponseBuilder().isDynamic()) {
+            return _writer;
+        }
+        
+        return _cycle.getResponseBuilder().getWriter(_form.getName() + "hidden", 
+                ResponseBuilder.ELEMENT_TYPE);
+    }
+    
     private void addHiddenFieldsForLinkParameter(ILink link, String parameterName)
     {
         String[] values = link.getParameterValues(parameterName);
@@ -763,5 +782,21 @@
     public JSONObject getProfile()
     {
         return _profile;
+    }
+
+    /** 
+     * {@inheritDoc}
+     */
+    public boolean isFormFieldUpdating()
+    {
+        return _fieldUpdating;
+    }
+    
+    /** 
+     * {@inheritDoc}
+     */
+    public void setFormFieldUpdating(boolean value)
+    {
+        _fieldUpdating = value;
     }
 }

Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/IFormComponent.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/IFormComponent.java?rev=418644&r1=418643&r2=418644&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/IFormComponent.java
(original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/IFormComponent.java
Sun Jul  2 13:12:51 2006
@@ -28,7 +28,7 @@
 {
     /**
      * Returns the {@link org.apache.tapestry.IForm} which contains the component, or null
if the
-     * component is not contained by a form, of if the containing Form is not currently renderring.
+     * component is not contained by a form, or if the containing Form is not currently rendering.
      */
 
     IForm getForm();

Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/pages/StaleLink.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/pages/StaleLink.html?rev=418644&r1=418643&r2=418644&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/pages/StaleLink.html (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/pages/StaleLink.html Sun
Jul  2 13:12:51 2006
@@ -1,5 +1,5 @@
 
-<span jwcid="@Shell" stylesheet="ognl:assets.stylesheet" title="Stale Link">
+<span jwcid="@Shell" stylesheet="ognl:assets.stylesheet" doctype="ognl:''" title="Stale
Link">
 
 <body>
 
@@ -9,12 +9,13 @@
 <span jwcid="@Insert" value="ognl:message" class="exception-message">
 Exception message goes here.
 </span>
+</p>
 
 <p>This is most likely the result of using your
-browser's <b>back</b> button, but can also be an application error.
+browser's <b>back</b> button, but can also be an application error.</p>
 
 <p>You may continue by returning to the
-application's
+application's</p>
 
 <b>
 <a jwcid="home">home page</a></b>.

Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/pages/StaleSession.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/pages/StaleSession.html?rev=418644&r1=418643&r2=418644&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/pages/StaleSession.html
(original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/pages/StaleSession.html
Sun Jul  2 13:12:51 2006
@@ -1,18 +1,18 @@
 
-<span jwcid="@Shell" title="Stale Session" stylesheet="ognl:assets.stylesheet">
+<span jwcid="@Shell" title="Stale Session" doctype="ognl:''" stylesheet="ognl:assets.stylesheet">
 
 <body>
 Your session has timed out.
 
 <p>Web applications store information about what you are doing on the server.  This
information
-is called the <em>session</em>.
+is called the <em>session</em>.</p>
 
 <p>Web servers must track many, many sessions.  If you
 are inactive for a long enough time (usually, a few minutes), this information is discarded
to
-make room for active users.
+make room for active users.</p>
 
 <p>At this point you may <b>
-<a jwcid="restart">restart</a></b> the session to continue.
+<a jwcid="restart">restart</a></b> the session to continue.</p>
 
 </body>
 </span>

Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/services/ResponseBuilder.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/services/ResponseBuilder.java?rev=418644&r1=418643&r2=418644&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/services/ResponseBuilder.java
(original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/services/ResponseBuilder.java
Sun Jul  2 13:12:51 2006
@@ -30,6 +30,27 @@
  */
 public interface ResponseBuilder {
     
+    /**
+     * Inside a {@link org.apache.tapestry.util.ContentType}, the output encoding is called
+     * "charset".
+     */
+    String ENCODING_KEY = "charset";
+
+    /**
+     * The content type of the response that will be returned.
+     */
+    String CONTENT_TYPE = "text/xml";
+
+    /**
+     * The response element type.
+     */
+    String ELEMENT_TYPE = "element";
+
+    /**
+     * The response exception type.
+     */
+    String EXCEPTION_TYPE = "exception";
+
     String SCRIPT_TYPE = "script";
     
     String BODY_SCRIPT = "bodyscript";
@@ -37,6 +58,13 @@
     String INCLUDE_SCRIPT = "includescript";
     
     String INITIALIZATION_SCRIPT = "initializationscript";
+    
+    /**
+     * Implementors that manage content writes dynamically (ie {@link DojoAjaxResponseBuilder})
should
+     * return true to denote that dynamic behaviour is on for a particular response.
+     * @return
+     */
+    boolean isDynamic();
     
     /**
      * Renders the response to a client. Handles transitioning logic

Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/services/impl/DefaultResponseBuilder.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/services/impl/DefaultResponseBuilder.java?rev=418644&r1=418643&r2=418644&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/services/impl/DefaultResponseBuilder.java
(original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/services/impl/DefaultResponseBuilder.java
Sun Jul  2 13:12:51 2006
@@ -38,13 +38,6 @@
  */
 public class DefaultResponseBuilder implements ResponseBuilder
 {   
-    /**
-     * Inside a {@link org.apache.tapestry.util.ContentType}, the output encoding is called
-     * "charset".
-     */
-    
-    public static final String ENCODING_KEY = "charset";
-    
     private RequestLocaleManager _localeManager;
     
     private MarkupWriterSource _markupWriterSource;
@@ -84,6 +77,15 @@
         _markupWriterSource = markupWriterSource;
         _webResponse = webResponse;
         _renderWorker = renderWorker;
+    }
+    
+    /**
+     * 
+     * {@inheritDoc}
+     */
+    public boolean isDynamic()
+    {
+        return Boolean.FALSE;
     }
     
     /**

Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/services/impl/DojoAjaxResponseBuilder.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/services/impl/DojoAjaxResponseBuilder.java?rev=418644&r1=418643&r2=418644&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/services/impl/DojoAjaxResponseBuilder.java
(original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/services/impl/DojoAjaxResponseBuilder.java
Sun Jul  2 13:12:51 2006
@@ -46,29 +46,11 @@
  */
 public class DojoAjaxResponseBuilder implements ResponseBuilder
 {
-    /**
-     * Inside a {@link org.apache.tapestry.util.ContentType}, the output encoding is called
-     * "charset".
-     */
-    public static final String ENCODING_KEY = "charset";
-    /**
-     * The content type of the response that will be returned.
-     */
-    public static final String CONTENT_TYPE = "text/xml";
-    /**
-     * The response element type.
-     */
-    public static final String ELEMENT_TYPE = "element";
-    /**
-     * The response exception type.
-     */
-    public static final String EXCEPTION_TYPE = "exception";
-    
     // used to create IMarkupWriter
     private RequestLocaleManager _localeManager;
     private MarkupWriterSource _markupWriterSource;
     private WebResponse _webResponse;
-    private String _exceptionPageName;
+    private List _errorPages;
     
     // our response writer
     private IMarkupWriter _writer;
@@ -106,12 +88,21 @@
      */
     public DojoAjaxResponseBuilder(RequestLocaleManager localeManager, 
             MarkupWriterSource markupWriterSource,
-            WebResponse webResponse, String exceptionPageName)
+            WebResponse webResponse, List errorPages)
     {
         _localeManager = localeManager;
         _markupWriterSource = markupWriterSource;
         _webResponse = webResponse;
-        _exceptionPageName = exceptionPageName;
+        _errorPages = errorPages;
+    }
+    
+    /**
+     * 
+     * {@inheritDoc}
+     */
+    public boolean isDynamic()
+    {
+        return Boolean.TRUE;
     }
     
     /** 
@@ -266,7 +257,7 @@
         writer.printRaw("\n//]]>\n");
         writer.end();
     }
-
+    
     /** 
      * {@inheritDoc}
      */
@@ -277,10 +268,12 @@
             return;
         }
         
-        if (IPage.class.isInstance(render)
-                && ((IPage)render).getPageName().indexOf(_exceptionPageName) >
-1) {
-            render.render(getWriter(_exceptionPageName, EXCEPTION_TYPE), cycle);
-            return;
+        if (IPage.class.isInstance(render)) {
+            String errorPage = getErrorPage(((IPage)render).getPageName());
+            if (errorPage != null) {
+                render.render(getWriter(errorPage, EXCEPTION_TYPE), cycle);
+                return;
+            }
         }
         
         if (IComponent.class.isInstance(render)
@@ -291,6 +284,17 @@
         }
         
         render.render(NullWriter.getSharedInstance(), cycle);
+    }
+    
+    private String getErrorPage(String pageName)
+    {
+        for (int i=0; i < _errorPages.size(); i++) {
+            String page = (String)_errorPages.get(i);
+            if (pageName.indexOf(page) > -1)
+                return page;
+        }
+        
+        return null;
     }
     
     /**

Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/services/impl/DojoAjaxResponseContributorImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/services/impl/DojoAjaxResponseContributorImpl.java?rev=418644&r1=418643&r2=418644&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/services/impl/DojoAjaxResponseContributorImpl.java
(original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/services/impl/DojoAjaxResponseContributorImpl.java
Sun Jul  2 13:12:51 2006
@@ -14,6 +14,8 @@
 package org.apache.tapestry.services.impl;
 
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.tapestry.IRequestCycle;
 import org.apache.tapestry.markup.MarkupWriterSource;
@@ -43,14 +45,23 @@
     
     private String _exceptionPageName;
     
+    private String _staleSessionPageName;
+    
+    private String _staleLinkPageName;
+    
     /** 
      * {@inheritDoc}
      */
     public ResponseBuilder createBuilder(IRequestCycle cycle)
         throws IOException
     {
+        List errorPages = new ArrayList();
+        errorPages.add(_exceptionPageName);
+        errorPages.add(_staleSessionPageName);
+        errorPages.add(_staleLinkPageName);
+        
         return new DojoAjaxResponseBuilder(_localeManager, _markupWriterSource,
-                _webResponse, _exceptionPageName);
+                _webResponse, errorPages);
     }
     
     /** 
@@ -84,5 +95,15 @@
     public void setExceptionPageName(String name)
     {
         _exceptionPageName = name;
+    }
+    
+    public void setStaleSessionPageName(String name)
+    {
+        _staleSessionPageName = name;
+    }
+    
+    public void setStaleLinkPageName(String name)
+    {
+        _staleLinkPageName = name;
     }
 }

Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/services/impl/JSONResponseBuilder.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/services/impl/JSONResponseBuilder.java?rev=418644&r1=418643&r2=418644&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/services/impl/JSONResponseBuilder.java
(original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/services/impl/JSONResponseBuilder.java
Sun Jul  2 13:12:51 2006
@@ -41,13 +41,6 @@
  */
 public class JSONResponseBuilder implements ResponseBuilder
 {
-    /**
-     * Inside a {@link org.apache.tapestry.util.ContentType}, the output encoding is called
-     * "charset".
-     */
-    
-    public static final String ENCODING_KEY = "charset";
-
     /** Writer that creates JSON output response. */
     protected IJSONWriter _writer;
     /** Passed in to bypass normal rendering. */
@@ -80,6 +73,15 @@
         _localeManager = localeManager;
         _markupWriterSource = markupWriterSource;
         _webResponse = webResponse;
+    }
+    
+    /**
+     * 
+     * {@inheritDoc}
+     */
+    public boolean isDynamic()
+    {
+        return Boolean.TRUE;
     }
     
     /**

Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/services/impl/RequestCycleFactoryImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/services/impl/RequestCycleFactoryImpl.java?rev=418644&r1=418643&r2=418644&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/services/impl/RequestCycleFactoryImpl.java
(original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/services/impl/RequestCycleFactoryImpl.java
Sun Jul  2 13:12:51 2006
@@ -72,9 +72,9 @@
         WebRequest request = _infrastructure.getRequest();
         
         QueryParameterMap parameters = extractParameters(request);
-
+        
         decodeParameters(request.getActivationPath(), request.getPathInfo(), parameters);
-
+        
         String serviceName = findService(parameters);
         
         IRequestCycle cycle = new RequestCycle(engine, parameters, serviceName, _environment);

Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/wml/GoFormSupportImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/wml/GoFormSupportImpl.java?rev=418644&r1=418643&r2=418644&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/wml/GoFormSupportImpl.java
(original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/wml/GoFormSupportImpl.java
Sun Jul  2 13:12:51 2006
@@ -48,10 +48,10 @@
     {
         // The super-implementation writes a <div> tag that's not
         // valid as WML.
-
-        writeHiddenFieldList();
+        
+        writeHiddenFieldList(getHiddenFieldWriter());
     }
-
+    
     protected void writeHiddenField(IMarkupWriter writer, String name,
             String id, String value)
     {

Modified: tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/MockForm.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/MockForm.java?rev=418644&r1=418643&r2=418644&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/MockForm.java (original)
+++ tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/MockForm.java Sun
Jul  2 13:12:51 2006
@@ -383,4 +383,20 @@
     {
         return _profile;
     }
-}
\ No newline at end of file
+
+    /** 
+     * {@inheritDoc}
+     */
+    public boolean isFormFieldUpdating()
+    {
+        return false;
+    }
+
+    /** 
+     * {@inheritDoc}
+     */
+    public void setFormFieldUpdating(boolean value)
+    {
+        
+    }
+}

Modified: tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/DojoAjaxResponseBuilderTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/DojoAjaxResponseBuilderTest.java?rev=418644&r1=418643&r2=418644&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/DojoAjaxResponseBuilderTest.java
(original)
+++ tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/DojoAjaxResponseBuilderTest.java
Sun Jul  2 13:12:51 2006
@@ -144,7 +144,7 @@
         
         nested.begin("response");
         nested.attribute("id", "id1");
-        nested.attribute("type", DojoAjaxResponseBuilder.ELEMENT_TYPE);
+        nested.attribute("type", ResponseBuilder.ELEMENT_TYPE);
         
         comp1.render(nested, cycle);
         



Mime
View raw message