2003/06/16 07:58:57
[org.ibex.core.git] / src / org / xwt / Template.java
index 4022c42..4ac78db 100644 (file)
@@ -73,10 +73,10 @@ public class Template {
     private boolean changed = false;
 
     /** the script on the static node of this template, null if it has already been executed */
-    private JS.Function staticscript = null;
+    private JS.CompiledFunction staticscript = null;
 
     /** the script on this node */
-    private JS.Function script = null;
+    private JS.CompiledFunction script = null;
 
     /** during XML parsing, this holds the list of currently-parsed children; null otherwise */
     private Vec childvect = new Vec();
@@ -165,7 +165,7 @@ public class Template {
      *  @param pboxes a vector of all box parents on which to put $-references
      *  @param ptemplates a vector of the nodeNames to recieve private references on the pboxes
      */
-    void apply(Box b, Vec pboxes, Vec ptemplates, JS.Function callback, int numerator, int denominator) {
+    void apply(Box b, Vec pboxes, Vec ptemplates, JS.Callable callback, int numerator, int denominator) {
 
         int original_numerator = numerator;
 
@@ -206,7 +206,7 @@ public class Template {
         if (redirect != null && !"self".equals(redirect)) redir = (Box)b.get("$" + redirect);
 
         if (script != null) try {
-            script.cloneWithNewParentScope(b).call(new JS.Array());
+            script.call(new JS.Array(), b);
         } catch (JS.Exn e) {
             if (Log.on) Log.log(this, "WARNING: uncaught ecmascript exception: " + e.getMessage());
         }
@@ -264,7 +264,7 @@ public class Template {
     }
 
     /** adds a theme mapping, retemplatizing as needed */
-    public static void retheme(JS.Function callback) {
+    public static void retheme(JS.Callable callback) {
         XWF.flushXWFs();
 
         // clear changed marker and relink
@@ -363,7 +363,7 @@ public class Template {
         if (staticscript != null) try { 
             JS.Scope s = Static.createStatic(nodeName, false);
             if (staticscript != null) {
-                JS.Function temp = staticscript;
+                JS.CompiledFunction temp = staticscript;
                 staticscript = null;
 
                // we layer a transparent scope over the Static so that we can catch requests for the xwt object
@@ -374,7 +374,7 @@ public class Template {
                            if ("xwt".equals(key)) return XWT.singleton; else return super.get(key);
                        } };
 
-               temp.cloneWithNewParentScope(varScope).call(null);
+               temp.call(new JS.Array(), varScope);
             }
         } catch (JS.Exn e) {
             if (Log.on) Log.log(this, "WARNING: uncaught ecmascript exception: " + e.getMessage());
@@ -650,10 +650,10 @@ public class Template {
             }
         }
 
-        private JS.Function genscript(boolean isstatic) {
-            JS.Function thisscript = null;
+        private JS.CompiledFunction genscript(boolean isstatic) {
+            JS.CompiledFunction thisscript = null;
             try {
-                thisscript = JS.parse(new StringReader(t.content.toString()), t.nodeName + (isstatic ? "._" : ""), t.content_start);
+                thisscript = JS.parse(t.nodeName + (isstatic ? "._" : ""), t.content_start, new StringReader(t.content.toString()));
             } catch (JS.Exn ee) {
                 if (Log.on) Log.log(this, "  ERROR: " + ee.getMessage());
                 thisscript = null;