*/
public void put(int i, Object value) {
if (i < 0) return;
-
+ Trap t = value == null ? (Trap)get("childremoved", Trap.class) : (Trap)get("childadded", Trap.class);
+
if (value != null && !(value instanceof Box)) {
- if (Log.on) Log.logJS(this, "attempt to set a numerical property on a box to anything other than a box");
- } else if (redirect == null) {
- if (Log.on) Log.logJS(this, "attempt to add/remove children to/from a node with a null redirect");
- put("0", (Box)value);
+ if (Log.on) Log.logJS(this, "attempt to set a numerical property on a box to a non-box");
+ return;
+ }
+
+ if (redirect == null) {
+ if (t != null) t.perform(value);
+ else if (Log.on) Log.logJS(this, "attempt to add/remove children to/from a node with a null redirect");
} else if (redirect != this) {
Box b = value == null ? (Box)redirect.get(i) : (Box)value;
redirect.put(i, value);
- put("0", b);
+ if (t != null) t.perform(value);
} else if (value == null) {
if (i >= 0 && i < numChildren()) {
Box b = getChild(i);
b.remove();
- put("0", b);
+ if (t != null) t.perform(b);
}
} else {
Box newnode = (Box)value;
MARK_FOR_REFLOW_this;
newnode.dirty();
-
- // note that JavaScript box[0] will invoke put(int i), not put(String s)
- put("0", newnode);
+ if (t != null) t.perform(b);
}
}
}
}
- // don't want to really cascade down to the box on this one
- if (name.equals("0")) return;
-
SpecialBoxProperty gph = (SpecialBoxProperty)SpecialBoxProperty.specialBoxProperties.get(name);
if (gph != null) { gph.put(name, this, value); return; }
if (oldparent != null) { Box b = oldparent; MARK_FOR_REFLOW_b; }
// note that JavaScript box[0] will invoke put(int i), not put(String s)
- if (oldparent != null) oldparent.put("0", this);
+ if (oldparent != null) {
+ Trap t = (Trap)oldparent.get("childremoved", Trap.class);
+ if (t != null) t.perform(this);
+ }
}
/** returns our next sibling (parent[ourindex + 1]) */