incubator-xap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmarga...@apache.org
Subject svn commit: r482856 - in /incubator/xap/trunk: WebContent/examples/dataBinding/simpleEmployees.xal src/xap/resolver/ResolutionHandler.js src/xap/taghandling/AbstractTagImpl.js
Date Wed, 06 Dec 2006 00:54:17 GMT
Author: jmargaris
Date: Tue Dec  5 16:54:16 2006
New Revision: 482856

URL: http://svn.apache.org/viewvc?view=rev&rev=482856
Log:
Now with 100% more escaping of values that start with \

Modified:
    incubator/xap/trunk/WebContent/examples/dataBinding/simpleEmployees.xal
    incubator/xap/trunk/src/xap/resolver/ResolutionHandler.js
    incubator/xap/trunk/src/xap/taghandling/AbstractTagImpl.js

Modified: incubator/xap/trunk/WebContent/examples/dataBinding/simpleEmployees.xal
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/dataBinding/simpleEmployees.xal?view=diff&rev=482856&r1=482855&r2=482856
==============================================================================
--- incubator/xap/trunk/WebContent/examples/dataBinding/simpleEmployees.xal (original)
+++ incubator/xap/trunk/WebContent/examples/dataBinding/simpleEmployees.xal Tue Dec  5 16:54:16
2006
@@ -50,6 +50,11 @@
 			<label 
 				text="{ bind(binding:employeeCount) }" 
 			/>
+			
+			<!-- should show up as the text {...} without the leading slash -->
+			<label 
+				text="\{ bind(binding:employeeCount) }" 
+			/>
 
 		</xm:append>
 	</xm:modifications>

Modified: incubator/xap/trunk/src/xap/resolver/ResolutionHandler.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/resolver/ResolutionHandler.js?view=diff&rev=482856&r1=482855&r2=482856
==============================================================================
--- incubator/xap/trunk/src/xap/resolver/ResolutionHandler.js (original)
+++ incubator/xap/trunk/src/xap/resolver/ResolutionHandler.js Tue Dec  5 16:54:16 2006
@@ -21,6 +21,7 @@
 Xap.require("xap.session.EventHandler") ;
 Xap.require("xap.resolver.ResolutionInfo");
 Xap.require("xap.util.TypeUtils");
+Xap.require("xap.util.EscapeSyntaxParser");
 
 /**
  * @param session{xap.session.ClientSession}
@@ -31,8 +32,34 @@
 	this._session = session ;
 }
 
+
 //TODO resolveTextNode
 
+/**
+ * We turn {...} into resolved values, which means we need some escape syntax.
+ * They can do \{...} to get {...}, or \\{...} to get \{....}
+ * We will recognize '\{', '\}' and '\\' and take off the first '\'.
+ * Note we ONLY need to call this if the thing STARTS with \,
+ * for example if they do 
+ * '{...\..\{}'
+ * that is fine. This is something to resolve, no need to escape anything
+ * 
+ * 
+ */
+xap.resolver.ResolutionHandler.escapeSyntax = 
+	new xap.util.EscapeSyntaxParser('\\', ['\\', '{', '}'], ['\\', '{', '}'], false);
+
+
+
+xap.resolver.ResolutionHandler.prototype.unescape = function( value ){
+	if (value && value.length>0 && value.charAt(0)=='\\'){
+		alert("Unescape string:" + value + " into " + xap.resolver.ResolutionHandler.escapeSyntax.parse(value));
+		return xap.resolver.ResolutionHandler.escapeSyntax.parse(value);
+	}
+	return value;
+}
+
+
 xap.resolver.ResolutionHandler.prototype.resolveAttribute = function(event,xapElement){
 	
 	var attributeValue=event.getNewValue() ;
@@ -56,12 +83,7 @@
 	
 	var handler = this._session.getEventHandler() ;
 
-	try{
-		// This will go to a more complete unescaping method later:
-		attributeValue = attributeValue.replace(/\\}/g,"}") ;
-		//Compactor needs this l-bracket escaped
-		attributeValue = attributeValue.replace(/\\\{/g,"{") ; 
-			
+	try{			
 		// we use parseArgument here because technically an object 
 		// event is just an argument as they can be imbedded in other 
 		// arguments etc  TODO: understand this
@@ -85,7 +107,7 @@
 }
 
 
-
+//true if it is in the form {....}
 xap.resolver.ResolutionHandler.prototype.needsResolving =function(attributeValue){ 
 	return !( attributeValue == null 
 				// Must have at least two brackets:

Modified: incubator/xap/trunk/src/xap/taghandling/AbstractTagImpl.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/taghandling/AbstractTagImpl.js?view=diff&rev=482856&r1=482855&r2=482856
==============================================================================
--- incubator/xap/trunk/src/xap/taghandling/AbstractTagImpl.js (original)
+++ incubator/xap/trunk/src/xap/taghandling/AbstractTagImpl.js Tue Dec  5 16:54:16 2006
@@ -685,9 +685,7 @@
 		event.setNewValue(resolver.resolveAttribute(event,this.getElement()));
 	}
 	else{
-		//if we didn't need resolving we might need to unescape the string
-		//IMPORTANT MAKE THIS WORK
-		//e.setNewValue(resolverRegistry.unescapeString(attributeValue));
+		event.setNewValue(resolver.unescape(event.getNewValue()));
 	}
 }
 



Mime
View raw message