You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by an...@apache.org on 2007/09/22 01:23:29 UTC

svn commit: r578320 - /tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/core.js

Author: andyhot
Date: Fri Sep 21 16:23:28 2007
New Revision: 578320

URL: http://svn.apache.org/viewvc?rev=578320&view=rev
Log:
TAPESTRY-1768 + TAPESTRY-1767: a few more helpers to allow cleaning up js

Modified:
    tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/core.js

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?rev=578320&r1=578319&r2=578320&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/core.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/core.js Fri Sep 21 16:23:28 2007
@@ -440,11 +440,64 @@
 	 * the global namespace "tapestry".
 	 */
 	cleanConnect:function(target, event, funcName){
+                target = dojo.byId(target);
 		if (!dj_undef(funcName, tapestry)){
         	dojo.event.disconnect(target, event, tapestry, funcName);
         }
 	},
+        
+	/**
+	 * Function: cleanConnectWidget
+         */        
+	cleanConnectWidget:function(target, event, funcName){
+                tapestry.cleanConnect(dojo.widget.byId(target), event, funcName);        
+	},        
+        
+	/**
+	 * Function: connect
+	 *
+	 * Utility used to connect an event/function.
+	 *
+	 * This assumes that the incoming function name is being attached to
+	 * the global namespace "tapestry".
+	 */
+	connect:function(target, event, funcName){
+                target = dojo.byId(target);
+		if (!dj_undef(funcName, tapestry)){
+        	dojo.event.connect(target, event, tapestry, funcName);
+        }
+	},
+        
+	/**
+	 * Function: connectBefore
+         */        
+	connectBefore:function(target, event, funcName){
+                target = dojo.byId(target);
+		if (!dj_undef(funcName, tapestry)){
+        	dojo.event.connect("before", target, event, tapestry, funcName);
+        }
+	},        
+        
+	/**
+	 * Function: connectWidget
+         */        
+	connectWidget:function(target, event, funcName){
+                tapestry.connect(dojo.widget.byId(target), event, funcName);        
+	},
 
+	/**
+	 * Function: byId
+         */                
+        byId:dojo.byId,                
+        
+	/**
+	 * Function: raise
+         */                
+        raise:dojo.raise,         
+
+	/**
+	 * Function: linkOnClick
+         */
 	linkOnClick:function(url, id, isJson){
 		var content={beventname:"onClick"};
 		content["beventtarget.id"]=id;
@@ -671,7 +724,12 @@
 		if (node.getAttribute("id")) {
 			props["beventtarget.id"]=node.getAttribute("id");
 		}
-	}
+	},
+        
+        /**
+         * Function: stopEvent
+         */
+        stopEvent:dojo.event.browser.stopEvent
 }
 
 tapestry.lang = {