projects
/
org.ibex.core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
2003/06/12 17:57:37
[org.ibex.core.git]
/
src
/
org
/
xwt
/
Template.java
diff --git
a/src/org/xwt/Template.java
b/src/org/xwt/Template.java
index
a9ea9b9
..
63a9daa
100644
(file)
--- a/
src/org/xwt/Template.java
+++ b/
src/org/xwt/Template.java
@@
-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 boolean changed = false;
/** the script on the static node of this template, null if it has already been executed */
- private JS.Script staticscript = null;
+ private CompiledFunction staticscript = null;
/** the script on this node */
/** the script on this node */
- private JS.Script script = null;
+ private CompiledFunction script = null;
/** during XML parsing, this holds the list of currently-parsed children; null otherwise */
private Vec childvect = new Vec();
/** 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
*/
* @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;
int original_numerator = numerator;
@@
-206,9
+206,9
@@
public class Template {
if (redirect != null && !"self".equals(redirect)) redir = (Box)b.get("$" + redirect);
if (script != null) try {
if (redirect != null && !"self".equals(redirect)) redir = (Box)b.get("$" + redirect);
if (script != null) try {
- JS.Array jsa = new JS.Array();
- jsa.addElement(b);
- script.call(jsa);
+ script.cloneWithNewParentScope(b).call(new Array());
+ } catch (IOException e) {
+ throw new Error("this should never happen");
} catch (JS.Exn e) {
if (Log.on) Log.log(this, "WARNING: uncaught ecmascript exception: " + e.getMessage());
}
} catch (JS.Exn e) {
if (Log.on) Log.log(this, "WARNING: uncaught ecmascript exception: " + e.getMessage());
}
@@
-240,7
+240,7
@@
public class Template {
if (callback != null)
try {
if (callback != null)
try {
- JS.Array args = new JS.Array();
+ Array args = new Array();
args.addElement(new Double(numerator));
args.addElement(new Double(denominator));
callback.call(args);
args.addElement(new Double(numerator));
args.addElement(new Double(denominator));
callback.call(args);
@@
-266,7
+266,7
@@
public class Template {
}
/** adds a theme mapping, retemplatizing as needed */
}
/** 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
XWF.flushXWFs();
// clear changed marker and relink
@@
-286,7
+286,7
@@
public class Template {
if (callback != null)
try {
if (callback != null)
try {
- JS.Array args = new JS.Array();
+ Array args = new Array();
args.addElement(new Double(1.0));
args.addElement(new Double(1.0));
callback.call(args);
args.addElement(new Double(1.0));
args.addElement(new Double(1.0));
callback.call(args);
@@
-298,7
+298,7
@@
public class Template {
/** template reapplication procedure */
private static void reapply(Box b) {
/** template reapplication procedure */
private static void reapply(Box b) {
- throw new Error("not implemented");
+ Log.log(Template.class, "Template.reapply() not implemented");
/*
// Ref 7.5.1: check if we need to retemplatize
boolean retemplatize = false;
/*
// Ref 7.5.1: check if we need to retemplatize
boolean retemplatize = false;
@@
-365,7
+365,7
@@
public class Template {
if (staticscript != null) try {
JS.Scope s = Static.createStatic(nodeName, false);
if (staticscript != null) {
if (staticscript != null) try {
JS.Scope s = Static.createStatic(nodeName, false);
if (staticscript != null) {
- JS.Script temp = staticscript;
+ CompiledFunction temp = staticscript;
staticscript = null;
// we layer a transparent scope over the Static so that we can catch requests for the xwt object
staticscript = null;
// we layer a transparent scope over the Static so that we can catch requests for the xwt object
@@
-376,10
+376,10
@@
public class Template {
if ("xwt".equals(key)) return XWT.singleton; else return super.get(key);
} };
if ("xwt".equals(key)) return XWT.singleton; else return super.get(key);
} };
- JS.Array args = new JS.Array();
- args.addElement(varScope);
- temp.call(args);
+ temp.cloneWithNewParentScope(varScope).call(null);
}
}
+ } catch (IOException e) {
+ throw new Error("this should never happen");
} catch (JS.Exn e) {
if (Log.on) Log.log(this, "WARNING: uncaught ecmascript exception: " + e.getMessage());
}
} catch (JS.Exn e) {
if (Log.on) Log.log(this, "WARNING: uncaught ecmascript exception: " + e.getMessage());
}
@@
-654,10
+654,10
@@
public class Template {
}
}
}
}
- private JS.Script genscript(boolean isstatic) {
- JS.Script thisscript = null;
+ private CompiledFunction genscript(boolean isstatic) {
+ CompiledFunction thisscript = null;
try {
try {
- thisscript = JS.Script.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()), null);
} catch (JS.Exn ee) {
if (Log.on) Log.log(this, " ERROR: " + ee.getMessage());
thisscript = null;
} catch (JS.Exn ee) {
if (Log.on) Log.log(this, " ERROR: " + ee.getMessage());
thisscript = null;