You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sv...@apache.org on 2006/11/10 10:15:40 UTC

svn commit: r473277 [12/45] - in /myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource: ./ src/ src/animation/ src/cal/ src/charting/ src/charting/svg/ src/charting/vml/ src/collections/ src/crypto/ src/data/ src/data/...

Modified: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/event/topic.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/event/topic.js?view=diff&rev=473277&r1=473276&r2=473277
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/event/topic.js (original)
+++ myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/event/topic.js Fri Nov 10 01:15:01 2006
@@ -8,45 +8,99 @@
 		http://dojotoolkit.org/community/licensing.shtml
 */
 
-dojo.require("dojo.event");
+dojo.require("dojo.event.common");
 dojo.provide("dojo.event.topic");
 
 dojo.event.topic = new function(){
 	this.topics = {};
 
-	this.getTopic = function(topicName){
-		if(!this.topics[topicName]){
-			this.topics[topicName] = new this.TopicImpl(topicName);
+	this.getTopic = function(/*String*/topic){
+		// summary:
+		//		returns a topic implementation object of type
+		//		dojo.event.topic.TopicImpl
+		// topic:
+		//		a unique, opaque string that names the topic
+		if(!this.topics[topic]){
+			this.topics[topic] = new this.TopicImpl(topic);
 		}
-		return this.topics[topicName];
+		return this.topics[topic]; // a dojo.event.topic.TopicImpl object
 	}
 
-	this.registerPublisher = function(topic, obj, funcName){
+	this.registerPublisher = function(/*String*/topic, /*Object*/obj, /*String*/funcName){
+		// summary:
+		//		registers a function as a publisher on a topic. Subsequent
+		//		calls to the function will cause a publish event on the topic
+		//		with the arguments passed to the function passed to registered
+		//		listeners.
+		// topic: 
+		//		a unique, opaque string that names the topic
+		// obj:
+		//		the scope to locate the function in
+		// funcName:
+		//		the name of the function to register
 		var topic = this.getTopic(topic);
 		topic.registerPublisher(obj, funcName);
 	}
 
-	this.subscribe = function(topic, obj, funcName){
+	this.subscribe = function(/*String*/topic, /*Object*/obj, /*String*/funcName){
+		// summary:
+		//		susbscribes the function to the topic. Subsequent events
+		//		dispached to the topic will create a function call for the
+		//		obj.funcName() function.
+		// topic: 
+		//		a unique, opaque string that names the topic
+		// obj:
+		//		the scope to locate the function in
+		// funcName:
+		//		the name of the function to being registered as a listener
 		var topic = this.getTopic(topic);
 		topic.subscribe(obj, funcName);
 	}
 
-	this.unsubscribe = function(topic, obj, funcName){
+	this.unsubscribe = function(/*String*/topic, /*Object*/obj, /*String*/funcName){
+		// summary:
+		//		unsubscribes the obj.funcName() from the topic
+		// topic: 
+		//		a unique, opaque string that names the topic
+		// obj:
+		//		the scope to locate the function in
+		// funcName:
+		//		the name of the function to being unregistered as a listener
 		var topic = this.getTopic(topic);
 		topic.unsubscribe(obj, funcName);
 	}
 
-	this.destroy = function(topic){
+	this.destroy = function(/*String*/topic){
+		// summary: 
+		//		destroys the topic and unregisters all listeners
+		// topic:
+		//		a unique, opaque string that names the topic
 		this.getTopic(topic).destroy();
 		delete this.topics[topic];
 	}
 
-	this.publishApply = function(topic, args){
+	this.publishApply = function(/*String*/topic, /*Array*/args){
+		// summary: 
+		//		dispatches an event to the topic using the args array as the
+		//		source for the call arguments to each listener. This is similar
+		//		to JavaScript's built-in Function.apply()
+		// topic:
+		//		a unique, opaque string that names the topic
+		// args:
+		//		the arguments to be passed into listeners of the topic
 		var topic = this.getTopic(topic);
 		topic.sendMessage.apply(topic, args);
 	}
 
-	this.publish = function(topic, message){
+	this.publish = function(/*String*/topic, /*Object*/message){
+		// summary: 
+		//		manually "publish" to the passed topic
+		// topic:
+		//		a unique, opaque string that names the topic
+		// message:
+		//		can be an array of parameters (similar to publishApply), or
+		//		will be treated as one of many arguments to be passed along in
+		//		a "flat" unrolling
 		var topic = this.getTopic(topic);
 		// if message is an array, we treat it as a set of arguments,
 		// otherwise, we just pass on the arguments passed in as-is
@@ -60,12 +114,24 @@
 }
 
 dojo.event.topic.TopicImpl = function(topicName){
+	// summary: a class to represent topics
+
 	this.topicName = topicName;
 
-	this.subscribe = function(listenerObject, listenerMethod){
+	this.subscribe = function(/*Object*/listenerObject, /*Function or String*/listenerMethod){
+		// summary:
+		//		use dojo.event.connect() to attach the passed listener to the
+		//		topic represented by this object
+		// listenerObject:
+		//		if a string and listenerMethod is ommitted, this is treated as
+		//		the name of a function in the global namespace. If
+		//		listenerMethod is provided, this is the scope to find/execute
+		//		the function in.
+		// listenerMethod:
+		//		Optional. The function to register.
 		var tf = listenerMethod||listenerObject;
 		var to = (!listenerMethod) ? dj_global : listenerObject;
-		dojo.event.kwConnect({
+		return dojo.event.kwConnect({ // dojo.event.MethodJoinPoint
 			srcObj:		this, 
 			srcFunc:	"sendMessage", 
 			adviceObj:	to,
@@ -73,10 +139,20 @@
 		});
 	}
 
-	this.unsubscribe = function(listenerObject, listenerMethod){
+	this.unsubscribe = function(/*Object*/listenerObject, /*Function or String*/listenerMethod){
+		// summary:
+		//		use dojo.event.disconnect() to attach the passed listener to the
+		//		topic represented by this object
+		// listenerObject:
+		//		if a string and listenerMethod is ommitted, this is treated as
+		//		the name of a function in the global namespace. If
+		//		listenerMethod is provided, this is the scope to find the
+		//		function in.
+		// listenerMethod:
+		//		Optional. The function to unregister.
 		var tf = (!listenerMethod) ? listenerObject : listenerMethod;
 		var to = (!listenerMethod) ? null : listenerObject;
-		dojo.event.kwDisconnect({
+		return dojo.event.kwDisconnect({ // dojo.event.MethodJoinPoint
 			srcObj:		this, 
 			srcFunc:	"sendMessage", 
 			adviceObj:	to,
@@ -84,15 +160,41 @@
 		});
 	}
 
+	this._getJoinPoint = function(){
+		return dojo.event.MethodJoinPoint.getForMethod(this, "sendMessage");
+	}
+
+	this.setSquelch = function(/*Boolean*/shouldSquelch){
+		// summary: 
+		//		determine whether or not exceptions in the calling of a
+		//		listener in the chain should stop execution of the chain.
+		this._getJoinPoint().squelch = shouldSquelch;
+	}
+
 	this.destroy = function(){
-		dojo.event.MethodJoinPoint.getForMethod(this, "sendMessage").disconnect();
+		// summary: disconnects all listeners from this topic
+		this._getJoinPoint().disconnect();
 	}
 
-	this.registerPublisher = function(publisherObject, publisherMethod){
+	this.registerPublisher = function(	/*Object*/publisherObject, 
+										/*Function or String*/publisherMethod){
+		// summary:
+		//		registers the passed function as a publisher on this topic.
+		//		Each time the function is called, an event will be published on
+		//		this topic.
+		// publisherObject:
+		//		if a string and listenerMethod is ommitted, this is treated as
+		//		the name of a function in the global namespace. If
+		//		listenerMethod is provided, this is the scope to find the
+		//		function in.
+		// publisherMethod:
+		//		Optional. The function to register.
 		dojo.event.connect(publisherObject, publisherMethod, this, "sendMessage");
 	}
 
 	this.sendMessage = function(message){
+		// summary: a stub to be called when a message is sent to the topic.
+
 		// The message has been propagated
 	}
 }

Modified: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/experimental.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/experimental.js?view=diff&rev=473277&r1=473276&r2=473277
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/experimental.js (original)
+++ myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/experimental.js Fri Nov 10 01:15:01 2006
@@ -10,12 +10,21 @@
 
 dojo.provide("dojo.experimental");
 
-/**
- * Convenience for informing of experimental code.
- */
-dojo.experimental = function(packageName, extra){
-	var mess = "EXPERIMENTAL: " + packageName;
-	mess += " -- Not yet ready for use.  APIs subject to change without notice.";
-	if(extra){ mess += " " + extra; }
-	dojo.debug(mess);
+dojo.experimental = function(/* String */ moduleName, /* String? */ extra){
+	// summary: Marks code as experimental.
+	// description: 
+	//    This can be used to mark a function, file, or module as experimental.
+	//    Experimental code is not ready to be used, and the APIs are subject
+	//    to change without notice.  Experimental code may be completed deleted
+	//    without going through the normal deprecation process.
+	// moduleName: The name of a module, or the name of a module file or a specific function
+	// extra: some additional message for the user
+	
+	// examples:
+	//    dojo.experimental("dojo.data.Result");
+	//    dojo.experimental("dojo.weather.toKelvin()", "PENDING approval from NOAA");
+	var message = "EXPERIMENTAL: " + moduleName;
+	message += " -- Not yet ready for use.  APIs subject to change without notice.";
+	if(extra){ message += " " + extra; }
+	dojo.debug(message);
 }