2003/09/19 05:26:46
authormegacz <megacz@xwt.org>
Fri, 30 Jan 2004 07:35:52 +0000 (07:35 +0000)
committermegacz <megacz@xwt.org>
Fri, 30 Jan 2004 07:35:52 +0000 (07:35 +0000)
darcs-hash:20040130073552-2ba56-dcb1fb26e09d187cc8db0c8527247a2adbcc8600.gz

src/org/xwt/Box.java.pp

index 2b3a305..4da565a 100644 (file)
@@ -514,7 +514,17 @@ public final class Box extends JS.Scope {
 
         } else if ("apply".equals(method)) {
             if (checkOnly) return Boolean.TRUE;
-            if (args.elementAt(0) instanceof String) {
+            if (args.elementAt(0) instanceof Res) {
+                Res res = (Res)args.elementAt(0);
+                res = res.addExtension(".xwt");
+                Template t = Template.buildTemplate(res, "fromResource");
+                if (ThreadMessage.suspendThread()) try {
+                    JS.Callable callback = args.length() < 2 ? null : (Callable)args.elementAt(1);
+                    t.apply(this, null, null, callback, 0, t.numUnits());
+                } finally {
+                    ThreadMessage.resumeThread();
+                }
+            } else if (args.elementAt(0) instanceof String) {
                 String templatename = (String)args.elementAt(0);
                 Template t = Template.getTemplate(templatename, null);
                 if (t == null) {