2003/05/02 13:30:52
[org.ibex.core.git] / src / org / xwt / XWT.java
index 156fc0e..7d73e9c 100644 (file)
@@ -232,7 +232,19 @@ public final class XWT extends JSObject {
             public Object call(Context cx, Scriptable thisObj, Scriptable ctorObj, Object[] args) throws JavaScriptException {
                 if (args.length != 2) return null;
                 if (args[0] == null || args[1] == null) return null;
-                Template.retheme(args[0].toString(), args[1].toString());
+
+                for(int i=1; i<args.length; i++) {
+                    if (args[i] instanceof String) {
+                        String from = (String)args[0];
+                        String to = (String)args[i];
+                        if (Log.on) Log.log(this, "retheming from " + from + " to " + to);
+                        Resources.mapFrom.addElement(from);
+                        Resources.mapTo.addElement(to);
+                    }
+                }
+
+                Function callback = args[args.length - 1] instanceof Function ? (Function)args[args.length - 1] : null;
+                Template.retheme(callback);
                 return null;
             }
         };
@@ -428,8 +440,8 @@ public final class XWT extends JSObject {
         }
     }
 
-    private static final JSObject.JSFunction recursivePrintObject = new JSObject.JSFunction() {
-            public Object call(Context cx, Scriptable thisObj, Scriptable ctorObj, Object[] args) throws JavaScriptException {
+    static final JSObject.JSFunction recursivePrintObject = new JSObject.JSFunction() {
+            public Object call(Context cx, Scriptable thisObj, Scriptable ctorObj, Object[] args) {
                 if (args == null || args.length != 1) return null;
                 recurse("", "", args[0], cx);
                 return null;