You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by jk...@apache.org on 2007/04/19 00:00:56 UTC

svn commit: r530178 - in /tapestry/tapestry4/trunk: tapestry-examples/TimeTracker/src/context/ tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/ tapestry-framework/src/java/org/apache/tapestry/ tapestry-framework/src/java/org...

Author: jkuhnert
Date: Wed Apr 18 15:00:55 2007
New Revision: 530178

URL: http://svn.apache.org/viewvc?view=rev&rev=530178
Log:
Updated expression compiler to handle new ognl fixes. 

Optimized (slightly) tapestry core.js .

Modified:
    tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/Home.html
    tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/LocaleList.html
    tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/LocaleList.java
    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/link/DefaultLinkRenderer.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/link/DirectLink.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/HiveMindExpressionCompiler.java
    tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/core.js
    tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form.js
    tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form/validation.js
    tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/test.js

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?view=diff&rev=530178&r1=530177&r2=530178
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/Home.html (original)
+++ tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/Home.html Wed Apr 18 15:00:55 2007
@@ -60,11 +60,9 @@
 <div jwcid="testDialog@Dialog" hidden="ognl:dlHidden" >
 	<p style="display:block;background:#ffffff;width:20em;">
 	This is content hidden in a Dialog.
-	<!-- 
-	<a href="#" onClick="dojo.widget.byId('testDialog').hide();return false">Close</a>
-	 -->
-	 <a jwcid="@DirectLink" listener="listener:hideDialog" >Close</a>
-	</p>
+
+	    <a href="#" onClick="dojo.widget.byId('testDialog').hide();return false">Close</a>
+    </p>
 	
 	<div style="display:block;background:#ffffff;width:20em;">
 	<a jwcid="@DirectLink" listener="listener:showSubProject" updateComponents="subArea" >Show sub project</a>

Modified: tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/LocaleList.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/LocaleList.html?view=diff&rev=530178&r1=530177&r2=530178
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/LocaleList.html (original)
+++ tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/LocaleList.html Wed Apr 18 15:00:55 2007
@@ -72,7 +72,7 @@
 
 <div class="ognl:(selected != null and currLocale.toString() == selected.toString()) ? 'selected localeList' : 'localeList'" 
 		jwcid="localeList@For" 
-		source="ognl:locales" value="ognl:currLocale">
+		source="ognl:@org.apache.tapestry.timetracker.page.LocaleList@LOCALES" value="ognl:currLocale">
 	
 	<a jwcid="localeLink@DirectLink" listener="listener:selectLocale" parameters="ognl:{currLocale.language, currLocale.country, currLocale.variant}"
 		updateComponents="ognl:{'localeDetail',page.components.localeList.clientId}">

Modified: tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/LocaleList.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/LocaleList.java?view=diff&rev=530178&r1=530177&r2=530178
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/LocaleList.java (original)
+++ tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/LocaleList.java Wed Apr 18 15:00:55 2007
@@ -23,10 +23,11 @@
 /**
  * Simple locale listing example.
  *
- * @author jkuhnert
  */
 public abstract class LocaleList extends BasePage
 {
+
+    public static Locale[] LOCALES = Locale.getAvailableLocales();
     
     public abstract Locale getCurrLocale();
     
@@ -35,11 +36,6 @@
     public abstract void setStatus(String status);
     
     public abstract ResponseBuilder getBuilder();
-    
-    public Locale[] getLocales()
-    {
-        return Locale.getAvailableLocales();
-    }
     
     public void selectLocale(BrowserEvent event, String language, String country, String variant)
     {

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?view=diff&rev=530178&r1=530177&r2=530178
==============================================================================
--- 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 Wed Apr 18 15:00:55 2007
@@ -114,12 +114,6 @@
         dlg.show();
     }
     
-    public void hideDialog()
-    {
-        Dialog dlg = (Dialog)getComponent("testDialog");
-        dlg.hide();
-    }
-    
     /**
      * Invoked by form to add a new task.
      */

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?view=diff&rev=530178&r1=530177&r2=530178
==============================================================================
--- 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 Wed Apr 18 15:00:55 2007
@@ -16,8 +16,8 @@
 -->
 
 <!DOCTYPE library-specification PUBLIC 
-  "-//Apache Software Foundation//Tapestry Specification 3.0//EN" 
-  "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
+  "-//Apache Software Foundation//Tapestry Specification 4.0//EN" 
+  "http://tapestry.apache.org/dtd/Tapestry_4_0.dtd">
 	
 <!--
  
@@ -67,7 +67,7 @@
     <component-type type="PropertySelection" specification-path="form/PropertySelection.jwc"/>
     <component-type type="Radio" specification-path="form/Radio.jwc"/>
     <component-type type="RadioGroup" specification-path="form/RadioGroup.jwc"/>
-    <component-type type="Relation" specification-path="html/Relation.jwc"/>    
+    <component-type type="Relation" specification-path="html/Relation.jwc"/>
     <component-type type="RenderBlock" specification-path="components/RenderBlock.jwc"/>
     <component-type type="RenderBody" specification-path="components/RenderBody.jwc"/>
     <component-type type="RequestDisplay" specification-path="html/RequestDisplay.jwc"/>
@@ -77,12 +77,12 @@
     <component-type type="Script" specification-path="html/Script.jwc"/>
     <component-type type="ScriptIncludes" specification-path="dojo/html/ScriptIncludes.jwc"/>
     <component-type type="Shell" specification-path="html/Shell.jwc"/>
-	<component-type type="Style" specification-path="html/Style.jwc"/>    
+	<component-type type="Style" specification-path="html/Style.jwc"/>
     <component-type type="Submit" specification-path="form/Submit.jwc"/>
     <component-type type="TextArea" specification-path="form/TextArea.jwc"/>
     <component-type type="TextField" specification-path="form/TextField.jwc"/>
     <component-type type="Upload" specification-path="form/Upload.jwc"/>
-    <component-type type="ValidField" specification-path="valid/ValidField.jwc"/>                
+    <component-type type="ValidField" specification-path="valid/ValidField.jwc"/>
 
     <page name="StaleLink" specification-path="pages/StaleLink.page"/>
     <page name="StaleSession" specification-path="pages/StaleSession.page"/>

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/link/DefaultLinkRenderer.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/link/DefaultLinkRenderer.java?view=diff&rev=530178&r1=530177&r2=530178
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/link/DefaultLinkRenderer.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/link/DefaultLinkRenderer.java Wed Apr 18 15:00:55 2007
@@ -14,26 +14,21 @@
 
 package org.apache.tapestry.link;
 
-import java.util.HashMap;
-import java.util.Map;
-
 import org.apache.hivemind.ApplicationRuntimeException;
 import org.apache.hivemind.HiveMind;
-import org.apache.tapestry.IMarkupWriter;
-import org.apache.tapestry.IRequestCycle;
-import org.apache.tapestry.PageRenderSupport;
-import org.apache.tapestry.Tapestry;
-import org.apache.tapestry.TapestryUtils;
+import org.apache.tapestry.*;
 import org.apache.tapestry.components.ILinkComponent;
 import org.apache.tapestry.engine.ILink;
 import org.apache.tapestry.util.ScriptUtils;
 
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * Default implementation of {@link org.apache.tapestry.link.ILinkRenderer},
  * which does nothing special. Can be used as a base class to provide additional
  * handling.
  * 
- * @author Howard Lewis Ship, David Solis
  * @since 3.0
  */
 
@@ -52,8 +47,7 @@
         IMarkupWriter wrappedWriter = null;
         
         if (cycle.getAttribute(Tapestry.LINK_COMPONENT_ATTRIBUTE_NAME) != null)
-            throw new ApplicationRuntimeException(LinkMessages.noNesting(),
-                    linkComponent, null, null);
+            throw new ApplicationRuntimeException(LinkMessages.noNesting(), linkComponent, null, null);
         
         cycle.setAttribute(Tapestry.LINK_COMPONENT_ATTRIBUTE_NAME, linkComponent);
         
@@ -139,10 +133,17 @@
      * the link is rendered (but only if the link is not disabled).
      * <p>
      * This implementation does nothing.
+     * </p>
+     *
+     * @param writer
+     *          Markup writer.
+     * @param cycle
+     *          Current request cycle.
+     * @param link
+     *          The link component being rendered.
      */
 
-    protected void beforeBodyRender(IMarkupWriter writer, IRequestCycle cycle,
-            ILinkComponent link)
+    protected void beforeBodyRender(IMarkupWriter writer, IRequestCycle cycle, ILinkComponent link)
     {
     }
 
@@ -150,12 +151,19 @@
      * Invoked after the body of the link is rendered, but before
      * {@link ILinkComponent#renderAdditionalAttributes(IMarkupWriter, IRequestCycle)}is
      * invoked (but only if the link is not disabled).
+     * 
      * <p>
      * This implementation does nothing.
+     * </p>
+     * @param writer
+     *          Markup writer.
+     * @param cycle
+     *          Current request cycle.
+     * @param link
+     *          The link component being rendered.
      */
 
-    protected void afterBodyRender(IMarkupWriter writer, IRequestCycle cycle,
-            ILinkComponent link)
+    protected void afterBodyRender(IMarkupWriter writer, IRequestCycle cycle, ILinkComponent link)
     {
     }
 
@@ -184,8 +192,7 @@
         
         if (!link.isParameterBound("onclick") && !link.isParameterBound("onClick")) {
             writer.attribute("onclick", 
-                    "return tapestry.linkOnClick(this.href,'" + link.getClientId() + "', " 
-                    + link.isJson() + ")");
+                    "return tapestry.linkOnClick(this.href,'" + link.getClientId() + "', " + link.isJson() + ")");
             return;
         }
         

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/link/DirectLink.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/link/DirectLink.java?view=diff&rev=530178&r1=530177&r2=530178
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/link/DirectLink.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/link/DirectLink.java Wed Apr 18 15:00:55 2007
@@ -14,24 +14,19 @@
 
 package org.apache.tapestry.link;
 
-import java.util.List;
-
-import org.apache.tapestry.IActionListener;
-import org.apache.tapestry.IDirect;
-import org.apache.tapestry.IRequestCycle;
-import org.apache.tapestry.IScript;
-import org.apache.tapestry.Tapestry;
+import org.apache.tapestry.*;
 import org.apache.tapestry.engine.DirectServiceParameter;
 import org.apache.tapestry.engine.IEngineService;
 import org.apache.tapestry.engine.ILink;
 import org.apache.tapestry.listener.ListenerInvoker;
 
+import java.util.List;
+
 /**
  * A component for creating a link using the direct service; used for actions that are not dependant
  * on dynamic page state. [ <a href="../../../../../ComponentReference/DirectLink.html">Component
  * Reference </a>]
  * 
- * @author Howard Lewis Ship
  */
 
 public abstract class DirectLink extends AbstractLinkComponent implements IDirect
@@ -61,10 +56,10 @@
      * @param parameterValue
      *            the input value which may be
      *            <ul>
-     *            <li>null (returns null)
-     *            <li>An array of Object (returns the array)
-     *            <li>A {@link List}(returns an array of the values in the List})
-     *            <li>A single object (returns the object as a single-element array)
+     *              <li>null (returns null)
+     *              <li>An array of Object (returns the array)
+     *              <li>A {@link List}(returns an array of the values in the List})
+     *              <li>A single object (returns the object as a single-element array)
      *            </ul>
      * @return An array representation of the input object.
      * @since 2.2

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/HiveMindExpressionCompiler.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/HiveMindExpressionCompiler.java?view=diff&rev=530178&r1=530177&r2=530178
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/HiveMindExpressionCompiler.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/HiveMindExpressionCompiler.java Wed Apr 18 15:00:55 2007
@@ -282,22 +282,9 @@
         if (getterCode == null || getterCode.trim().length() <= 0 && !ASTVarRef.class.isAssignableFrom(expression.getClass()))
             getterCode = "null";
 
-        Class returnType = null;
-
-        if (NodeType.class.isInstance(expression)) {
-            NodeType nType = (NodeType) expression;
-            returnType = nType.getGetterClass();
-
-            if (returnType != null && !String.class.isAssignableFrom(returnType)) {
-
-                pre = pre + " ($w) (";
-                post = post + ")";
-            }
-        }
-
         String castExpression = (String) context.get(PRE_CAST);
 
-        if (returnType == null) {
+        if (context.getCurrentType() == null || context.getCurrentType().isPrimitive() || Character.class.isAssignableFrom(context.getCurrentType())) {
             pre = pre + " ($w) (";
             post = post + ")";
         }
@@ -361,8 +348,6 @@
             body += "}";
 
             body = body.replaceAll("\\.\\.", ".");
-
-            // System.out.println("adding method " + ref.getName() + " with body:\n" + body + " and return type: " + ref.getType());
             
             MethodSignature method = new MethodSignature(ref.getType(), ref.getName(), params, null);
             classFab.addMethod(Modifier.PUBLIC, method, body);

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/core.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/core.js?view=diff&rev=530178&r1=530177&r2=530178
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/core.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/core.js Wed Apr 18 15:00:55 2007
@@ -7,8 +7,6 @@
 dojo.require("dojo.logging.Logger");
 dojo.require("dojo.io.BrowserIO");
 dojo.require("dojo.event.browser");
-dojo.require("dojo.widget.*");
-dojo.require("dojo.widget.Dialog");
 dojo.require("dojo.html.style");
 
 /**
@@ -18,7 +16,7 @@
  * Most of the functions in here are related to initiating and parsing IO 
  * requests. 
  */
-tapestry={
+var tapestry={
 	
 	// property: version 
 	// The current client side library version, usually matching the current java library version. (ie 4.1, etc..)
@@ -52,7 +50,7 @@
 		};
 		
 		// setup content type
-		if (typeof json != "undefined" && json == true) {
+		if (typeof json != "undefined" && json) {
 			parms.mimetype = "text/json";
 			parms.headers={"json":true};
 			parms.load=(function(){tapestry.loadJson.apply(this, arguments);});
@@ -117,22 +115,22 @@
 		var initScripts=[];
 		var rawData=[];
 		for (var i=0; i<elms.length; i++) {
-			var type=elms[i].getAttribute("type");
+			var elmType=elms[i].getAttribute("type");
 			var id=elms[i].getAttribute("id");
 			
-			if (type == "exception") {
+			if (elmType == "exception") {
 				dojo.log.err("Remote server exception received.");
 				tapestry.presentException(elms[i], kwArgs);
 				return;
 			}
 			
-			if (type == "page") {
+			if (elmType == "page") {
 				window.location=elms[i].getAttribute("url");
 				return;
 			}
 			
 			// handle javascript evaluations
-			if (type == "script") {
+			if (elmType == "script") {
 				
 				if (id == "initializationscript") {
 					initScripts.push(elms[i]);
@@ -355,7 +353,10 @@
 	 * 	kwArgs - The kwArgs used to initiate the original IO request.
 	 */
 	presentException:function(node, kwArgs) {
-		var excnode=document.createElement("div");
+        dojo.require("dojo.widget.*");
+        dojo.require("dojo.widget.Dialog");
+        
+        var excnode=document.createElement("div");
 		excnode.setAttribute("id", "exceptiondialog");
 		document.body.appendChild(excnode);
 		

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form.js?view=diff&rev=530178&r1=530177&r2=530178
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form.js Wed Apr 18 15:00:55 2007
@@ -219,7 +219,7 @@
 	 */
 	setFormValidating:function(formId, validate){
 		if (this.forms[formId]){
-			this.forms[formId].validateForm = validate ? true : false;
+			this.forms[formId].validateForm = validate;
 		}
 	},
 	
@@ -268,7 +268,7 @@
 	 * 					such as url/async/json/etc. 
 	 */
 	submit:function(form, submitName, parms){
-		var form=dojo.byId(form);
+		form=dojo.byId(form);
 		if (!form) {
 			dojo.raise("Form not found with id " + form);
 			return;
@@ -314,7 +314,7 @@
 	 * 					Submit/LinkSubmit/etc..
 	 */
 	cancel:function(form, submitName){
-		var form=dojo.byId(form);
+		form=dojo.byId(form);
 		if (!form){
 			dojo.raise("Form not found with id " + form);
 			return;
@@ -339,7 +339,7 @@
 	 * 					Submit/LinkSubmit/etc..
 	 */
 	refresh:function(form, submitName){
-		var form=dojo.byId(form);
+		form=dojo.byId(form);
 		if (!form){
 			dojo.raise("Form not found with id " + form);
 			return;
@@ -368,7 +368,7 @@
 	 * 					the submission.
 	 */
 	submitAsync:function(form, content, submitName, parms){
-		var form=dojo.byId(form);
+		form=dojo.byId(form);
 		if (!form) {
 			dojo.raise("Form not found with id " + id);
 			return;

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form/validation.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form/validation.js?view=diff&rev=530178&r1=530177&r2=530178
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form/validation.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form/validation.js Wed Apr 18 15:00:55 2007
@@ -248,8 +248,8 @@
 	},
 
 	isPalleteSelected:function(elem){
-		if (elem.length > 0) { return true; }
-		return false;
+		return elem.length > 0;
+
 	},
 
     /**

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/test.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/test.js?view=diff&rev=530178&r1=530177&r2=530178
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/test.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/test.js Wed Apr 18 15:00:55 2007
@@ -25,10 +25,9 @@
 	this.intercept=function(){
 		this.called=true;
 		jum.assertEquals("mockArgLength", this.mockArgs.length, arguments.length);
-		
+
 		for (var i=0; i < this.mockArgs.length; i++) {
 			jum.assertEquals("mockArgument", this.mockArgs[i], arguments[i]);
 		}
 	}
 }
-