2003/08/09 23:43:23
[org.ibex.core.git] / src / org / xwt / Box.java
index 30ec605..f04c3c2 100644 (file)
@@ -1163,6 +1163,7 @@ public final class Box extends JS.Scope {
     public Object get(Object name_, boolean ignoretraps) {
         if (name_ instanceof Number) return get(((Number)name_).intValue());
 
+        if (!(name_ instanceof String)) return null;
         String name = (String)name_;
         if (name.equals("")) return null;
 
@@ -1182,7 +1183,7 @@ public final class Box extends JS.Scope {
         SpecialBoxProperty gph = (SpecialBoxProperty)SpecialBoxProperty.specialBoxProperties.get(name);
         if (gph != null) return gph.get(this);
 
-        Object ret = super.get((Object)name);
+        Object ret = super.get(name);
         if (name.startsWith("$") && ret == null)
             if (Log.on) Log.logJS(this, "WARNING: attempt to access " + name + ", but no child with id=\"" + name.substring(1) + "\" found");
         return ret;
@@ -1203,7 +1204,8 @@ public final class Box extends JS.Scope {
     public void put(Object name, Object value, boolean ignoretraps) { put(name, value, ignoretraps, null); }
     public void put(Object name_, Object value, boolean ignoretraps, RootProxy rp) {
         if (name_ instanceof Number) { put(((Number)name_).intValue(), value); return; }
-        String name = (String)name_;
+        if (!(name_ instanceof String)) { super.put(name_,value); return; }
+        String name = name_.toString();
         if (name == null) return;  // FIXME, shouldn't be necessary
         if (name.startsWith("xwt_")) {
             if (Log.on) Log.logJS(this, "attempt to set reserved property " + name);
@@ -1249,7 +1251,7 @@ public final class Box extends JS.Scope {
             return;
         }
 
-        super.put((Object)name, value);
+        super.put(name, value);
 
         // a bit of a hack, since titlebar is the only 'special' property stored in JSObject
         if (getParent() == null && surface != null) {
@@ -1416,6 +1418,9 @@ public final class Box extends JS.Scope {
         public Object get(Object name) { return box.get(name); }
         public void put(Object name, Object value) { box.put(name, value, false, this); }
         public Object[] keys() { return box.keys(); }
+        public Object callMethod(Object method, JS.Array args, boolean justChecking) {
+            return box.callMethod(method,args,justChecking);
+        }
     }
 
 
@@ -1501,7 +1506,11 @@ public final class Box extends JS.Scope {
         return this;
     }
     
+    // This is the name returned by typeof() by JS
+    public String typeName() {
+        return "box";
+    }
+    
 }
 
 
-