2003/09/07 03:04:31
[org.ibex.core.git] / src / org / xwt / Template.java
index c1a2532..1bf8b2b 100644 (file)
@@ -197,7 +197,9 @@ public class Template {
             }
 
         for (int i=0; children != null && i<children.length; i++) {
-            b.put(Integer.MAX_VALUE, new Box(children[i], pboxes, ptemplates, callback, numerator, denominator));
+            Box newkid = new Box();
+            children[i].apply(newkid, pboxes, ptemplates, callback, numerator, denominator);
+            b.put(Integer.MAX_VALUE, newkid);
             numerator += children[i].numUnits();
         }
 
@@ -212,15 +214,19 @@ public class Template {
         }
 
         for(int i=0; keys != null && i<keys.length; i++) {
-            // FIXME: make sure that if exceptions are thrown in here, the line number of the offending XML is logged
-            if (keys[i] == null) { }
-            else if (keys[i].equals("border") || keys[i].equals("image") &&
-                     !vals[i].toString().startsWith("http://") && !vals[i].toString().startsWith("https://")) {
-                String s = Resources.resolve(vals[i].toString() + ".png", importlist);
-                if (s != null) b.put(keys[i], s.substring(0, s.length() - 4));
-                else if (Log.on) Log.log(this, "unable to resolve image " + vals[i].toString() + " referenced in attributes of " + nodeName); 
+            try {
+                if (keys[i] == null) { }
+                else if (keys[i].equals("border") || keys[i].equals("image") &&
+                        !vals[i].toString().startsWith("http://") && !vals[i].toString().startsWith("https://")) {
+                    String s = Resources.resolve(vals[i].toString() + ".png", importlist);
+                    if (s != null) b.put(keys[i], s.substring(0, s.length() - 4));
+                    else if (Log.on) Log.log(this, "unable to resolve image " + vals[i].toString() + " referenced in attributes of " + nodeName); 
+                }
+                else b.put(keys[i], vals[i]);
+            } catch(JS.Exn e) {
+                if(Log.on) Log.log(this,"WARNING: uncaught ecmascript exception while putting attr \"" + keys[i] + 
+                    "\" of " + nodeName + " : " + e.getMessage());
             }
-            else b.put(keys[i], vals[i]);
         }
 
         if (redirect != null && !"self".equals(redirect)) b.redirect = redir;
@@ -265,6 +271,7 @@ public class Template {
 
     /** adds a theme mapping, retemplatizing as needed */
     public static void retheme(JS.Callable callback) {
+        /*
         XWF.flushXWFs();
 
         // clear changed marker and relink
@@ -291,6 +298,7 @@ public class Template {
             } catch (JS.Exn ex) {
                 if (Log.on) Log.log(Template.class, "WARNING: uncaught ecmascript exception: " + ex.getMessage());
             }
+        */
     }
 
     /** template reapplication procedure */
@@ -488,6 +496,7 @@ public class Template {
                     if (t.redirect != null)
                         throw new XML.SchemaException("the <redirect> header element may not appear more than once");
                     t.redirect = c.vals[0].toString();
+                    if(t.redirect.equals("null")) t.redirect = null;
                     return;
 
                 } else if (c.localName.equals("preapply")) {