private boolean validatingLayouts = false;
- private Set<ComponentConnector> zeroWidthComponents = null;
-
- private Set<ComponentConnector> zeroHeightComponents = null;
-
private final LayoutManager layoutManager;
private final RpcManager rpcManager;
getConnectorMap().clear();
if (meta.containsKey("invalidLayouts")) {
validatingLayouts = true;
- zeroWidthComponents = new HashSet<ComponentConnector>();
- zeroHeightComponents = new HashSet<ComponentConnector>();
}
}
if (meta.containsKey("timedRedirect")) {
applicationRunning = false;
}
if (validatingLayouts) {
+ Set<ComponentConnector> zeroHeightComponents = new HashSet<ComponentConnector>();
+ Set<ComponentConnector> zeroWidthComponents = new HashSet<ComponentConnector>();
+ findZeroSizeComponents(zeroHeightComponents,
+ zeroWidthComponents, getUIConnector());
VConsole.printLayoutProblems(meta,
ApplicationConnection.this,
zeroHeightComponents, zeroWidthComponents);
- zeroHeightComponents = null;
- zeroWidthComponents = null;
validatingLayouts = false;
}
ApplicationConfiguration.runWhenDependenciesLoaded(c);
}
+ private void findZeroSizeComponents(
+ Set<ComponentConnector> zeroHeightComponents,
+ Set<ComponentConnector> zeroWidthComponents,
+ ComponentConnector connector) {
+ Widget widget = connector.getWidget();
+ ComputedStyle computedStyle = new ComputedStyle(widget.getElement());
+ if (computedStyle.getIntProperty("height") == 0) {
+ zeroHeightComponents.add(connector);
+ }
+ if (computedStyle.getIntProperty("width") == 0) {
+ zeroWidthComponents.add(connector);
+ }
+ List<ServerConnector> children = connector.getChildren();
+ for (ServerConnector serverConnector : children) {
+ if (serverConnector instanceof ComponentConnector) {
+ findZeroSizeComponents(zeroHeightComponents,
+ zeroWidthComponents,
+ (ComponentConnector) serverConnector);
+ }
+ }
+ }
+
private void loadStyleDependencies(JsArrayString dependencies) {
// Assuming no reason to interpret in a defined order
ResourceLoadListener resourceLoadListener = new ResourceLoadListener() {