-
- } else if ("apply".equals(method)) {
- if (checkOnly) return Boolean.TRUE;
- if (args.elementAt(0) instanceof Res) {
- Res res = (Res)args.elementAt(0);
- // res = res.addExtension(".xwt");
- Template t = Template.getTemplate(res);
- if (ThreadMessage.suspendThread()) try {
- JS.Callable callback = args.length() < 2 ? null : (Callable)args.elementAt(1);
-
- // FIXME!!! needs to be xwt.apply(template, box)
- t.apply(this, callback, 0, t.numUnits(), null);
- } finally {
- ThreadMessage.resumeThread();
- }
- } else if (args.elementAt(0) instanceof String) {
- String templatename = (String)args.elementAt(0);
- // FIXME
- Template t = Template.getTemplate(null);
- if (t == null) {
- if (Log.on) Log.logJS(this, "template " + templatename + " not found");
- } else {
- if (ThreadMessage.suspendThread()) try {
- JS.Callable callback = args.length() < 2 ? null : (Callable)args.elementAt(1);
- // FIXME!!! needs to be xwt.apply(template, box)
- t.apply(this, callback, 0, t.numUnits(), null);
- } finally {
- ThreadMessage.resumeThread();
- }
- }
- } else if (args.elementAt(0) instanceof JS && !(args.elementAt(0) instanceof Box)) {
- JS s = (JS)args.elementAt(0);
- Object[] keys = s.keys();
- for(int j=0; j<keys.length; j++) put(keys[j].toString(), s.get(keys[j]));
- }
- return this;