summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/modules/implementation-widget-runtime-dojo
diff options
context:
space:
mode:
authorbdaniel <bdaniel@13f79535-47bb-0310-9956-ffa450edef68>2009-04-30 15:32:36 +0000
committerbdaniel <bdaniel@13f79535-47bb-0310-9956-ffa450edef68>2009-04-30 15:32:36 +0000
commite3dc3942342fb235a3625c1d115a2a6bba8a9f91 (patch)
tree5cd231b983554b6b6c04d7fa0bd924c72a5e9d1a /branches/sca-java-1.x/modules/implementation-widget-runtime-dojo
parent4bd58916e3e72d14787ba292d8f970cd5ac89fc5 (diff)
TUSCANY-2993 Fix global variable handling that was causing store-dojo to fail with internet explorer
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@770287 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/implementation-widget-runtime-dojo')
-rw-r--r--branches/sca-java-1.x/modules/implementation-widget-runtime-dojo/src/main/java/org/apache/tuscany/sca/implementation/widget/dojo/DojoJavaScriptComponentGeneratorImpl.java28
1 files changed, 15 insertions, 13 deletions
diff --git a/branches/sca-java-1.x/modules/implementation-widget-runtime-dojo/src/main/java/org/apache/tuscany/sca/implementation/widget/dojo/DojoJavaScriptComponentGeneratorImpl.java b/branches/sca-java-1.x/modules/implementation-widget-runtime-dojo/src/main/java/org/apache/tuscany/sca/implementation/widget/dojo/DojoJavaScriptComponentGeneratorImpl.java
index f293f38b4d..28e8f81810 100644
--- a/branches/sca-java-1.x/modules/implementation-widget-runtime-dojo/src/main/java/org/apache/tuscany/sca/implementation/widget/dojo/DojoJavaScriptComponentGeneratorImpl.java
+++ b/branches/sca-java-1.x/modules/implementation-widget-runtime-dojo/src/main/java/org/apache/tuscany/sca/implementation/widget/dojo/DojoJavaScriptComponentGeneratorImpl.java
@@ -128,29 +128,32 @@ public class DojoJavaScriptComponentGeneratorImpl implements ComponentJavaScript
* @throws IOException
*/
private static void generateJavaScriptNamespace(PrintWriter pw) throws IOException {
- pw.println("if (!tuscany) { \n" +
- "var tuscany = {}; \n" +
+ pw.println("if (!window.tuscany) { \n" +
+ "window.tuscany = {}; \n" +
"}");
- pw.println("if (!tuscany.sca) { \n" +
- "tuscany.sca = {}; \n" +
+ pw.println("var __tus = window.tuscany;");
+
+ pw.println("if (!__tus.sca) { \n" +
+ "__tus.sca = {}; \n" +
"}");
}
+
/**
* Generate JavaScript code to inject SCA Properties
* @param pw
* @throws IOException
*/
private static void generateJavaScriptPropertyFunction(RuntimeComponent component, PrintWriter pw) throws IOException {
- pw.println("tuscany.sca.propertyMap = new String();");
+ pw.println("__tus.sca.propertyMap = {};");
for(ComponentProperty property : component.getProperties()) {
String propertyName = property.getName();
- pw.println("tuscany.sca.propertyMap." + propertyName + " = new String(\"" + getPropertyValue(property) + "\");");
+ pw.println("__tus.sca.propertyMap." + propertyName + " = new String(\"" + getPropertyValue(property) + "\");");
}
- pw.println("tuscany.sca.Property = function (name) {");
- pw.println(" return tuscany.sca.propertyMap[name];");
+ pw.println("__tus.sca.Property = function (name) {");
+ pw.println(" return __tus.sca.propertyMap[name];");
pw.println("}");
}
@@ -183,7 +186,7 @@ public class DojoJavaScriptComponentGeneratorImpl implements ComponentJavaScript
*/
private static void generateJavaScriptReferenceFunction (RuntimeComponent component, JavascriptProxyFactoryExtensionPoint javascriptProxyFactories, PrintWriter pw) throws IOException {
- pw.println("tuscany.sca.referenceMap = new Object();");
+ pw.println("__tus.sca.referenceMap = {};");
for(ComponentReference reference : component.getReferences()) {
Binding binding = reference.getBindings().get(0);
@@ -192,15 +195,14 @@ public class DojoJavaScriptComponentGeneratorImpl implements ComponentJavaScript
String referenceName = reference.getName();
JavascriptProxyFactory jsProxyFactory = javascriptProxyFactories.getProxyFactory(binding.getClass());
- pw.println("tuscany.sca.referenceMap." + referenceName + " = new " + jsProxyFactory.createJavascriptReference(reference) + ";");
+ pw.println("__tus.sca.referenceMap." + referenceName + " = new " + jsProxyFactory.createJavascriptReference(reference) + ";");
}
}
- pw.println("tuscany.sca.Reference = function (name) {");
- pw.println(" return tuscany.sca.referenceMap[name];");
+ pw.println("__tus.sca.Reference = function (name) {");
+ pw.println(" return __tus.sca.referenceMap[name];");
pw.println("}");
}
-
}