From e1da86ef35e219b79c3de0c099cf82b2500dc448 Mon Sep 17 00:00:00 2001 From: megacz Date: Fri, 30 Jan 2004 07:43:39 +0000 Subject: [PATCH] 2003/12/29 03:51:28 darcs-hash:20040130074339-2ba56-c10a9528c2df15f61bfee6e67a4204a9a361b0fe.gz --- src/org/xwt/Res.java | 2 +- src/org/xwt/Template.java | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/org/xwt/Res.java b/src/org/xwt/Res.java index 35f3b51..b529a4e 100644 --- a/src/org/xwt/Res.java +++ b/src/org/xwt/Res.java @@ -40,7 +40,7 @@ public abstract class Res extends JS { if ("".equals(key)) { try { Template t = Template.getTemplate(addExtension(".xwt")); - return t == null ? null : t.getStatic(); + return t == null ? null : t.getStatic(null); /** FIXME VERY BAD! */ } catch (Exception e) { Log.info(this, e); return null; diff --git a/src/org/xwt/Template.java b/src/org/xwt/Template.java index df20ee9..b1aa9ad 100644 --- a/src/org/xwt/Template.java +++ b/src/org/xwt/Template.java @@ -40,7 +40,7 @@ public class Template { // Instance Members that are only meaningful on root Template ////////////////////////////////////// - private JSScope staticJSScope = null; ///< the scope in which the static block is executed + private JSScope staticScope = null; ///< the scope in which the static block is executed private JSFunction staticscript = null; ///< the script on the static node of this template, null already performed @@ -94,13 +94,13 @@ public class Template { } /** called before this template is applied or its static object can be externally referenced */ - JSScope getStatic() throws JSExn { - if (staticJSScope == null) staticJSScope = new JSScope(null); - if (staticscript == null) return staticJSScope; + JSScope getStatic(XWT xwt) throws JSExn { + if (staticScope == null) staticScope = new PerInstantiationJSScope(null, xwt, null, null); + if (staticscript == null) return staticScope; JSFunction temp = staticscript; staticscript = null; - temp.cloneWithNewParentScope(staticJSScope).call(null, null, null, null, 0); - return staticJSScope; + temp.cloneWithNewParentScope(staticScope).call(null, null, null, null, 0); + return staticScope; } /** Applies the template to Box b @@ -121,7 +121,7 @@ public class Template { private void apply(Box b, XWT xwt, PerInstantiationJSScope parentPis) throws JSExn { - getStatic(); + getStatic(xwt); if (id != null) parentPis.putDollar(id, b); for(int i=0; i