if (cc != null) {
cc.updateCaption(uidl, client);
}
+ if (!rendering) {
+ // ensure rel size details are updated
+ paintableToCell.get(component).updateRelSizeStatus(uidl);
+ }
}
public boolean requestLayout(final Set<Paintable> changedChildren) {
for (int i = 0; i < cells.length; i++) {
for (int j = 0; j < cells[i].length; j++) {
Cell cell = cells[i][j];
- if (cell.hasRelativeHeight() || cell.hasRelativeWidth()) {
+ if (cell != null
+ && (cell.hasRelativeHeight() || cell
+ .hasRelativeWidth())) {
client.handleComponentRelativeSize(cell.cc.getWidget());
}
}
* Private helper class.
*/
private class Cell {
+ private boolean relHeight = false;
+ private boolean relWidth = false;
+
public Cell(UIDL c) {
row = c.getIntAttribute("y");
col = c.getIntAttribute("x");
}
public boolean hasRelativeHeight() {
- if (childUidl != null && childUidl.hasAttribute("height")) {
- String w = childUidl.getStringAttribute("height");
- if (w.contains("%")) {
- return true;
- }
- }
- return false;
+ return relHeight;
}
public RenderSpace getAllocatedSpace() {
}
}
- private boolean hasRelativeWidth() {
- if (childUidl != null && childUidl.hasAttribute("width")) {
- String w = childUidl.getStringAttribute("width");
- if (w.contains("%")) {
- return true;
- }
- }
- return false;
+ protected boolean hasRelativeWidth() {
+ return relWidth;
}
protected void render() {
}
}
childUidl = c;
+ updateRelSizeStatus(c);
+ }
+
+ protected void updateRelSizeStatus(UIDL uidl) {
+ if (uidl != null && !uidl.getBooleanAttribute("cached")) {
+ if (uidl.hasAttribute("height")
+ && uidl.getStringAttribute("height").contains("%")) {
+ relHeight = true;
+ } else {
+ relHeight = false;
+ }
+ if (uidl.hasAttribute("width")
+ && uidl.getStringAttribute("width").contains("%")) {
+ relWidth = true;
+ } else {
+ relWidth = false;
+ }
+ }
}
}