2003/09/21 10:26:53
[org.ibex.core.git] / src / org / xwt / XWT.java
index 0329a60..7e7e5fe 100644 (file)
@@ -12,6 +12,8 @@ import org.bouncycastle.util.encoders.Base64;
 /** Singleton class that provides all functionality in the xwt.* namespace */
 public final class XWT extends JS.Obj {
 
+    public Res resourceRoot = null;
+
     public static final XWT singleton = new XWT();
     private final JS xwtMath = new XWTMath();
     private final JS xwtString = new XWTString();
@@ -74,24 +76,6 @@ public final class XWT extends JS.Obj {
             return Res.stringToRes(args.elementAt(0).toString());
         }});
 
-        super.put("theme", new JS.Callable() { public Object call(JS.Array args) throws JS.Exn {
-                if (args.length() != 2) return null;
-                if (args.elementAt(0) == null || args.elementAt(1) == null) return null;
-                for(int i=1; i<args.length(); i++) {
-                    if (args.elementAt(i) instanceof String) {
-                        String from = (String)args.elementAt(0);
-                        String to = (String)args.elementAt(i);
-                        if (Log.on) Log.log(this, "retheming from " + from + " to " + to);
-                        Resources.mapFrom.addElement(from);
-                        Resources.mapTo.addElement(to);
-                    }
-                }
-                JS.Callable callback = args.elementAt(args.length() - 1) instanceof JS.Callable ?
-                    (JS.Callable)args.elementAt(args.length() - 1) : null;
-                Template.retheme(callback);
-                return null;
-        }});
-            
         super.put("println", new JS.Callable() { public Object call(JS.Array args) throws JS.Exn {
             if (args.length() != 1) return null;
             if (Log.on) Log.logJS(this, (args.elementAt(0) == null ? "**null**" : args.elementAt(0).toString()));
@@ -153,7 +137,7 @@ public final class XWT extends JS.Obj {
             Box ret = new Box();
             if (!(args.length() == 0 || args.elementAt(0) == null))
                 Template.getTemplate(args.elementAt(0).toString(),
-                                     Template.defaultImportList).apply(ret, null, null, callback, 0, 1);
+                                     Template.defaultImportList).apply(ret, null, null, callback, 0, 1, resourceRoot);
             for(int i=1; i<args.length(); i++)
                 if (args.elementAt(i) instanceof Box)
                     ret.put(ret.numChildren(), (Box)args.elementAt(i));