return redirect.callMethod(method, args, checkOnly);
}
return new Integer(b.getIndexInParent());
-
- } else if ("apply".equals(method)) {
- if (checkOnly) return Boolean.TRUE;
- if (args.elementAt(0) instanceof Res) {
- Res res = (Res)args.elementAt(0);
- // res = res.addExtension(".xwt");
- Template t = Template.getTemplate(res);
- if (ThreadMessage.suspendThread()) try {
- JS.Callable callback = args.length() < 2 ? null : (Callable)args.elementAt(1);
-
- // FIXME!!! needs to be xwt.apply(template, box)
- t.apply(this, callback, 0, t.numUnits(), null);
- } finally {
- ThreadMessage.resumeThread();
- }
- } else if (args.elementAt(0) instanceof String) {
- String templatename = (String)args.elementAt(0);
- // FIXME
- Template t = Template.getTemplate(null);
- if (t == null) {
- if (Log.on) Log.logJS(this, "template " + templatename + " not found");
- } else {
- if (ThreadMessage.suspendThread()) try {
- JS.Callable callback = args.length() < 2 ? null : (Callable)args.elementAt(1);
- // FIXME!!! needs to be xwt.apply(template, box)
- t.apply(this, callback, 0, t.numUnits(), null);
- } finally {
- ThreadMessage.resumeThread();
- }
- }
- } else if (args.elementAt(0) instanceof JS && !(args.elementAt(0) instanceof Box)) {
- JS s = (JS)args.elementAt(0);
- Object[] keys = s.keys();
- for(int j=0; j<keys.length; j++) put(keys[j].toString(), s.get(keys[j]));
- }
- return this;
}
return null;
}
} else {
// FIXME
}
- b.minwidth = b.image == null ? 0 : b.image.getWidth();
- b.minheight = b.image == null ? 0 : b.image.getHeight();
+ b.minwidth = Math.min(b.maxwidth, Math.max(b.minwidth, b.image == null ? 0 : b.image.getWidth()));
+ b.minheight = Math.min(b.maxheight, Math.max(b.minheight, b.image == null ? 0 : b.image.getHeight()));
MARK_FOR_REFLOW_b;
b.dirty();
}
//#end
specialBoxProperties.put("redirect", new SpecialBoxProperty() {
- public void put(Box b, Object value) { }
+ public void put(Box b, Object value) {
+ if (b.redirect != b) Log.log(this, "cannot change the redirect of a box once it is set");
+ else if (value == null) b.redirect = null;
+ else {
+ Box b2 = (Box)value;
+ while(b2 != b && b2 != null) b2 = b2.parent;
+ if (b2 == null) Log.log(this, "a box's redirect must be one of its descendants");
+ b.redirect = (Box)value;
+ }
+ }
public Object get(Box b) {
if (b.redirect == null) return null;
if (b.redirect == b) return Boolean.TRUE;