+ specialBoxProperties.put("align", new SpecialBoxProperty() {
+ public Object get(Box b) {
+ switch(b.flags & ALIGN_FLAGS) {
+ case (ALIGN_TOP_FLAG | ALIGN_LEFT_FLAG): return "topleft";
+ case (ALIGN_BOTTOM_FLAG | ALIGN_LEFT_FLAG): return "bottomleft";
+ case (ALIGN_TOP_FLAG | ALIGN_RIGHT_FLAG): return "topright";
+ case (ALIGN_BOTTOM_FLAG | ALIGN_RIGHT_FLAG): return "bottomright";
+ case ALIGN_TOP_FLAG: return "top";
+ case ALIGN_BOTTOM_FLAG: return "bottom";
+ case ALIGN_LEFT_FLAG: return "left";
+ case ALIGN_RIGHT_FLAG: return "right";
+ case 0: return "center";
+ default: throw new Error("invalid alignment flags: " + (b.flags & ALIGN_FLAGS));
+ }
+ }
+ public void put(Box b, Object value) {
+ b.flags &= ~ALIGN_FLAGS;
+ if (value == null || value.equals("center")) { b.flags &= ALIGN_FLAGS; }
+ else if (value.equals("topleft")) { b.flags |= ALIGN_TOP_FLAG | ALIGN_LEFT_FLAG; }
+ else if (value.equals("bottomleft")) { b.flags |= ALIGN_BOTTOM_FLAG | ALIGN_LEFT_FLAG; }
+ else if (value.equals("topright")) { b.flags |= ALIGN_TOP_FLAG | ALIGN_RIGHT_FLAG; }
+ else if (value.equals("bottomright")) { b.flags |= ALIGN_BOTTOM_FLAG | ALIGN_RIGHT_FLAG; }
+ else if (value.equals("top")) { b.flags |= ALIGN_TOP_FLAG; }
+ else if (value.equals("bottom")) { b.flags |= ALIGN_BOTTOM_FLAG; }
+ else if (value.equals("left")) { b.flags |= ALIGN_LEFT_FLAG; }
+ else if (value.equals("right")) { b.flags |= ALIGN_RIGHT_FLAG; }
+ else Log.logJS("invalid alignment specifier \"" + value + "\"");
+ MARK_FOR_REFLOW_b;
+ b.dirty();
+ } });
+