Box redirect = this;
int flags = VISIBLE | PACKED | REPACK | RECONSTRAIN | REPLACE | FIXED | STOP_UPWARD_PROPAGATION | CLIP | MOVED;
+ private BalancedTree bt;
+
private String text = null;
private Font font = DEFAULT_FONT;
private Picture texture = null;
public JS callMethod(JS method, JS a0, JS a1, JS a2, JS[] rest, int nargs) throws JSExn {
switch (nargs) {
case 1: {
- //#switch(JS.toString(method))
+ //#jswitch(method)
case "indexof":
Box b = (Box)a0;
if (b.parent != this)
if (JS.isInt(name))
return redirect == null ? null : redirect == this ? getChild(JS.toInt(name)) : redirect.get(name);
- //#switch(JS.toString(name))
+ //#jswitch(name)
case "surface": return parent == null ? null : parent.getAndTriggerTraps(name);
case "indexof": return METHOD;
case "distanceto": return METHOD;
private class Mouse extends JS implements JS.Cloneable {
public JS get(JS key) throws JSExn {
- //#switch(JS.toString(key))
+ //#jswitch(key)
case "x": return N(globalToLocalX(getSurface()._mousex));
case "y": return N(globalToLocalY(getSurface()._mousey));
public void put(JS name, JS value) throws JSExn {
if (JS.isInt(name)) { put(JS.toInt(name), value); return; }
- //#switch(JS.toString(name))
+ //#jswitch(name)
case "thisbox": if (value == null) removeSelf();
case "text": { String s = value == null ? "" : JS.toString(value); CHECKSET_STRING(text); RECONSTRAIN(); dirty(); }
case "strokecolor": value = N(Color.stringToColor(JS.toString(value))); CHECKSET_INT(strokecolor); dirty();
case "rowspan": if (toInt(value) > 0) { CHECKSET_SHORT(rowspan); if (parent != null) parent.REPACK(); }
case "visible": CHECKSET_FLAG(VISIBLE); RECONSTRAIN(); dirty();
case "packed": CHECKSET_FLAG(PACKED); if (parent != null) { parent.REPACK(); } else { REPACK(); }
- case "align": clear(ALIGNS); setAlign(value == null ? "center" : JS.toString(value)); REPLACE();
+ case "align": clear(ALIGNS); setAlign(value); REPLACE();
case "cursor": setCursor(JS.toString(value));
case "fill": setFill(value);
case "clip": CHECKSET_FLAG(CLIP); if (parent == null) dirty(); else parent.dirty();
}
}
- private void setAlign(String value) {
+ private void setAlign(JS value) throws JSExn {
clear(ALIGNS);
- //#switch(value)
+ //#jswitch(value)
case "topleft": set(ALIGN_TOP | ALIGN_LEFT);
case "bottomleft": set(ALIGN_BOTTOM | ALIGN_LEFT);
case "topright": set(ALIGN_TOP | ALIGN_RIGHT);
case "bottom": set(ALIGN_BOTTOM);
case "left": set(ALIGN_LEFT);
case "right": set(ALIGN_RIGHT);
- default: JS.log("invalid alignment \"" + value + "\"");
+ default: JS.log("invalid alignment \"" + JS.debugToString(value) + "\"");
//#end
}
JS.log(e);
}
}
+
+ // BalancedTree functions
+ private void insertNode(int p, Box b) {
+ if(bt == null) bt = new BalancedTree();
+ bt.insertNode(p,b);
+ }
+
+ private int treeSize() { return bt == null ? 0 : bt.treeSize(); }
+ private int indexNode(Box b) { return bt == null ? -1 : bt.indexNode(b); }
+ private void deleteNode(int p) { bt.deleteNode(p); }
+ private Box getNode(int p) { return (Box)bt.getNode(p); }
}