import java.util.*;
import java.lang.*;
import org.xwt.js.*;
+import org.xwt.translators.*;
import org.xwt.util.*;
/**
* @param pboxes a vector of all box parents on which to put $-references
* @param ptemplates a vector of the fileNames to recieve private references on the pboxes
*/
- void apply(Box b, XWT xwt) throws JSExn { apply(b, xwt, null); }
- void apply(Box b, XWT xwt, PerInstantiationJSScope parentPis) throws JSExn {
+ void apply(Box b, XWT xwt) {
+ try {
+ apply(b, xwt, null);
+ } catch (JSExn e) {
+ b.clear(b.VISIBLE);
+ b.mark_for_repack();
+ Log.log(Template.class, "WARNING: exception (below) thrown during application of template;");
+ Log.log(Template.class, " setting visibility of target box to \"false\"");
+ Log.logJS(e);
+ }
+ }
+
+
+ private void apply(Box b, XWT xwt, PerInstantiationJSScope parentPis) throws JSExn {
getStatic();
if (rbox == null) Log.log(this, "unknown box id '"+vals[i]+"' referenced in XML attribute");
else b.putAndTriggerTraps(keys[i], rbox);
}
- else if ("image".equals(keys[i])) b.putAndTriggerTraps("image", resolveStringToResource((String)vals[i], xwt, true));
+ else if ("fill".equals(keys[i]) && ((String)vals[i]).indexOf('.') >= 0) {
+ b.putAndTriggerTraps("fill", resolveStringToResource((String)vals[i], xwt, true));
+ }
else if ("redirect".equals(keys[i])) {
if (vals[i] == null || "null".equals(vals[i])) b.putAndTriggerTraps("redirect", null);
Object rbox = pis.get("$"+vals[i]);
// WARNING: c.keys.length != c.len; USE c.len
for(int i=0; i<c.len; i++) {
if (c.keys[i] == null) throw new RuntimeException("XML parser returned a null key position="+i);
- if (c.keys[i].equals("font") && c.uris[i] != null) c.vals[i] = c.uris[i] + "." + c.vals[i];
- if (c.keys[i].equals("preapply")) {
+ else if (c.keys[i].equals("font") && c.uris[i] != null) c.vals[i] = c.uris[i] + "." + c.vals[i];
+ else if (c.keys[i].equals("fill") && c.uris[i] != null && !c.vals[i].startsWith("#")
+ && SVG.colors.get(c.vals[i]) == null) c.vals[i] = c.uris[i] + "." + c.vals[i];
+ else if (c.keys[i].equals("preapply")) {
// process preapply and 'remove' from array
String uri = c.uris[i] == null ? "" : c.uris[i] + '.';
StringTokenizer tok = new StringTokenizer(c.vals[i].toString(), " ");
public Object get(Object key) throws JSExn {
if (super.has(key)) return super.get(key);
if (key.equals("xwt")) return xwt;
- if (key.equals("_")) return xwt.rr;
+ if (key.equals("")) return xwt.rr;
if (key.equals("static")) return myStatic;
return super.get(key);
}