if (staticscript == null) return staticScope;
JS.CompiledFunction temp = staticscript;
staticscript = null;
- temp.call(new JS.Array(), staticScope);
+ new JS.Thread(temp, staticScope).resume();
return staticScope;
}
t.apply(b, callback, xwt);
}
- PerInstantiationScope pis = new PerInstantiationScope(b, xwt, parentPis);
+ PerInstantiationScope pis = new PerInstantiationScope(b, xwt, parentPis, staticScope);
for (int i=0; children != null && i<children.size(); i++) {
Box kid = new Box();
((Template)children.elementAt(i)).apply(kid, callback, xwt, pis);
b.put(b.numChildren(), kid);
}
- if (script != null) script.call(new JS.Array(), pis);
+ if (script != null) new JS.Thread(script, pis).resume();
for(int i=0; keys != null && i<keys.length; i++)
if (vals[i] instanceof String && ((String)vals[i]).charAt(0) == '$') b.put(keys[i], pis.get(vals[i]));
- else if (keys[i].equals("image")) b.put("image", resolveStringToResource((String)vals[i], xwt, true));
- else b.put(keys[i], vals[i]);
+ else if ("image".equals(keys[i])) b.put("image", resolveStringToResource((String)vals[i], xwt, true));
+ else if (keys[i] != null) b.put(keys[i], vals[i]);
}
private static class PerInstantiationScope extends JS.Scope {
XWT xwt = null;
PerInstantiationScope parentBoxPis = null;
+ JS.Scope myStatic = null;
void putDollar(String key, Box target) {
if (parentBoxPis != null) parentBoxPis.putDollar(key, target);
declare("$" + key);
put("$" + key, target);
}
- public PerInstantiationScope(Scope parentScope, XWT xwt, PerInstantiationScope parentBoxPis) {
+ public PerInstantiationScope(Scope parentScope, XWT xwt, PerInstantiationScope parentBoxPis, JS.Scope myStatic) {
super(parentScope);
this.parentBoxPis = parentBoxPis;
this.xwt = xwt;
+ this.myStatic = myStatic;
}
public boolean isTransparent() { return true; }
- public boolean has(Object key) { return false; }
- public void declare(String s) { super.declare(s); }
public Object get(Object key) {
- if (key.equals("xwt")) return xwt;
- if (Box.SpecialBoxProperty.specialBoxProperties.get(key.toString()) != null) return getParentScope().get(key);
if (super.has(key)) return super.get(key);
- Object ret = xwt.rr.get(key);
- if (ret != null) return ret;
- throw new JS.Exn("must declare " + key + " before using it!");
+ if (key.equals("xwt")) return xwt;
+ if (key.equals("static")) return myStatic;
+ return super.get(key);
}
public void put(Object key, Object val) {
- if (Box.SpecialBoxProperty.specialBoxProperties.get(key.toString()) != null) getParentScope().put(key, val);
- else if (super.has(key)) super.put(key, val);
- else throw new JS.Exn("must declare " + key + " before using it!");
+ if (super.has(key)) super.put(key, val);
+ super.put(key, val);
}
}