tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andy...@apache.org
Subject svn commit: r594152 - in /tapestry/tapestry4/trunk/tapestry-framework/src: descriptor/META-INF/ java/org/apache/tapestry/form/
Date Mon, 12 Nov 2007 14:08:37 GMT
Author: andyhot
Date: Mon Nov 12 06:08:36 2007
New Revision: 594152

URL: http://svn.apache.org/viewvc?rev=594152&view=rev
Log:
enable the javascript module and use it to get the widget-js in FormSupportImpl (instead of
looking for an IAsset attached to the form)

Modified:
    tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/hivemodule.xml
    tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.form.xml
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Form.jwc
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportFactoryImpl.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportImpl.java

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/hivemodule.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/hivemodule.xml?rev=594152&r1=594151&r2=594152&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/hivemodule.xml (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/hivemodule.xml Mon
Nov 12 06:08:36 2007
@@ -69,6 +69,7 @@
     <sub-module descriptor="tapestry.l10n.xml"/>
     <sub-module descriptor="tapestry.event.xml"/>
     <sub-module descriptor="tapestry.render.xml"/>
+    <sub-module descriptor="tapestry.js.xml"/>
 
 
     <service-point id="ClasspathResourceFactory">

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.form.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.form.xml?rev=594152&r1=594151&r2=594152&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.form.xml
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.form.xml
Mon Nov 12 06:08:36 2007
@@ -40,7 +40,11 @@
   </service-point>
   
   <service-point id="FormSupportFactory">
-      <create-instance class="FormSupportFactoryImpl"/>
+    <invoke-factory>
+        <construct class="FormSupportFactoryImpl">
+            <set-service property="javascriptManager" service-id="tapestry.js.JavascriptManager"/>
+        </construct>
+    </invoke-factory>      
   </service-point>
   
   <service-point id="GoFormSupportFactory" interface="FormSupportFactory">

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Form.jwc
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Form.jwc?rev=594152&r1=594151&r2=594152&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Form.jwc
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Form.jwc
Mon Nov 12 06:08:36 2007
@@ -116,8 +116,6 @@
     <reserved-parameter name="enctype" />
     <reserved-parameter name="id" />
 
-    <asset name="clientValidationScript" path="classpath:/dojo-0.4.3/dojo3.js" />
-
     <inject property="directService" object="engine-service:direct" />
     <inject property="response" object="infrastructure:response" />
     <inject property="listenerInvoker" object="infrastructure:listenerInvoker" />

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportFactoryImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportFactoryImpl.java?rev=594152&r1=594151&r2=594152&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportFactoryImpl.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportFactoryImpl.java
Mon Nov 12 06:08:36 2007
@@ -17,6 +17,7 @@
 import org.apache.tapestry.IForm;
 import org.apache.tapestry.IMarkupWriter;
 import org.apache.tapestry.IRequestCycle;
+import org.apache.tapestry.javascript.JavascriptManager;
 
 /**
  * The standard implementation of {@link FormSupportFactory}. It generates 
@@ -26,8 +27,15 @@
  */
 public class FormSupportFactoryImpl implements FormSupportFactory
 {
+    private JavascriptManager _javascriptManager;
+    
     public FormSupport createFormSupport(IMarkupWriter writer, IRequestCycle cycle, IForm
form) 
     {
-        return new FormSupportImpl(writer, cycle, form);
-    }    
+        return new FormSupportImpl(writer, cycle, form, _javascriptManager);
+    }
+    
+    public void setJavascriptManager(JavascriptManager javascriptManager)
+    {
+        _javascriptManager = javascriptManager;
+    }
 }

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportImpl.java?rev=594152&r1=594151&r2=594152&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportImpl.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportImpl.java
Mon Nov 12 06:08:36 2007
@@ -14,21 +14,40 @@
 
 package org.apache.tapestry.form;
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 import org.apache.hivemind.ApplicationRuntimeException;
 import org.apache.hivemind.HiveMind;
 import org.apache.hivemind.Location;
 import org.apache.hivemind.util.Defense;
-import org.apache.tapestry.*;
+import org.apache.tapestry.IComponent;
+import org.apache.tapestry.IForm;
+import org.apache.tapestry.IMarkupWriter;
+import org.apache.tapestry.IPage;
+import org.apache.tapestry.IRender;
+import org.apache.tapestry.IRequestCycle;
+import org.apache.tapestry.NestedMarkupWriter;
+import org.apache.tapestry.PageRenderSupport;
+import org.apache.tapestry.StaleLinkException;
+import org.apache.tapestry.Tapestry;
+import org.apache.tapestry.TapestryUtils;
 import org.apache.tapestry.engine.ILink;
 import org.apache.tapestry.event.BrowserEvent;
+import org.apache.tapestry.javascript.JavascriptManager;
 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;
 
-import java.util.*;
-
 /**
  * Encapsulates most of the behavior of a Form component.
  *
@@ -148,10 +167,18 @@
     /**
      * Used to detect whether or not a form component has been updated and will require form
sync on ajax requests
      */
-    private boolean _fieldUpdating;
+    private boolean _fieldUpdating;    
+    
+    private JavascriptManager _javascriptManager;
 
     public FormSupportImpl(IMarkupWriter writer, IRequestCycle cycle, IForm form)
     {
+        this(writer, cycle, form, null);
+    }
+    
+    public FormSupportImpl(IMarkupWriter writer, IRequestCycle cycle, 
+            IForm form, JavascriptManager javascriptManager)
+    {
         Defense.notNull(writer, "writer");
         Defense.notNull(cycle, "cycle");
         Defense.notNull(form, "form");
@@ -166,6 +193,8 @@
 
         _pageRenderSupport = TapestryUtils.getOptionalPageRenderSupport(cycle);
         _profile = new JSONObject();
+        
+        _javascriptManager = javascriptManager;
     }
 
     /**
@@ -565,11 +594,10 @@
 
             if (!page.hasWidgets())
             {
-                IAsset clientScript = _form.getAsset("clientValidationScript");
-
-                if (clientScript != null)
+                if (_javascriptManager != null && _javascriptManager.getMainJsWidgetAsset()
!= null)
                 {
-                    _pageRenderSupport.addExternalScript(_form, clientScript.getResourceLocation());
+                    _pageRenderSupport.addExternalScript(_form,
+                            _javascriptManager.getMainJsWidgetAsset().getResourceLocation());
                 }
             }
 



Mime
View raw message