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;
}
};
}
}
- 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;