2002/09/15 23:40:33
[org.ibex.core.git] / src / org / xwt / XWT.java
index 156fc0e..1544bdc 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;
             }
         };