*/
package com.vaadin.client;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
}
private boolean needsMeasure(Element e) {
- if (connection.getConnectorMap().getConnectorId(e) != null) {
+ ComponentConnector connector = connection.getConnectorMap()
+ .getConnector(e);
+ if (connector != null && needsMeasureForManagedLayout(connector)) {
return true;
} else if (elementResizeListeners.containsKey(e)) {
return true;
}
}
+ private boolean needsMeasureForManagedLayout(ComponentConnector connector) {
+ if (connector instanceof ManagedLayout) {
+ return true;
+ } else if (connector.getParent() instanceof ManagedLayout) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
/**
* Assigns a measured size to an element. Method defined as protected to
* allow separate implementation for IE8.
int measureCount = 0;
if (measureAll) {
- ComponentConnector[] connectors = ConnectorMap.get(connection)
+ ComponentConnector[] allConnectors = ConnectorMap.get(connection)
.getComponentConnectors();
+
+ // Find connectors that should actually be measured
+ ArrayList<ComponentConnector> connectors = new ArrayList<ComponentConnector>();
+ for (ComponentConnector candidate : allConnectors) {
+ if (needsMeasure(candidate.getWidget().getElement())) {
+ connectors.add(candidate);
+ }
+ }
+
for (ComponentConnector connector : connectors) {
measureConnector(connector);
}
for (ComponentConnector connector : connectors) {
layoutDependencyTree.setNeedsMeasure(connector, false);
}
- measureCount += connectors.length;
+ measureCount += connectors.size();
}
while (layoutDependencyTree.hasConnectorsToMeasure()) {
* borders) of the element in pixels.
*/
public final int getOuterHeight(Element element) {
+ assert needsMeasure(element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getOuterHeight();
}
* borders) of the element in pixels.
*/
public final int getOuterWidth(Element element) {
+ assert needsMeasure(element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getOuterWidth();
}
* borders) of the element in pixels.
*/
public final int getInnerHeight(Element element) {
+ assert needsMeasure(element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getInnerHeight();
}
* borders) of the element in pixels.
*/
public final int getInnerWidth(Element element) {
+ assert needsMeasure(element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getInnerWidth();
}
* element in pixels.
*/
public final int getBorderHeight(Element element) {
+ assert needsMeasure(element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getBorderHeight();
}
* element in pixels.
*/
public int getPaddingHeight(Element element) {
+ assert needsMeasure(element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getPaddingHeight();
}
* element in pixels.
*/
public int getBorderWidth(Element element) {
+ assert needsMeasure(element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getBorderWidth();
}
* element in pixels.
*/
public int getPaddingWidth(Element element) {
+ assert needsMeasure(element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getPaddingWidth();
}
* @return the measured top padding of the element in pixels.
*/
public int getPaddingTop(Element element) {
+ assert needsMeasure(element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getPaddingTop();
}
* @return the measured left padding of the element in pixels.
*/
public int getPaddingLeft(Element element) {
+ assert needsMeasure(element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getPaddingLeft();
}
* @return the measured bottom padding of the element in pixels.
*/
public int getPaddingBottom(Element element) {
+ assert needsMeasure(element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getPaddingBottom();
}
* @return the measured right padding of the element in pixels.
*/
public int getPaddingRight(Element element) {
+ assert needsMeasure(element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getPaddingRight();
}
* @return the measured top margin of the element in pixels.
*/
public int getMarginTop(Element element) {
+ assert needsMeasure(element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getMarginTop();
}
* @return the measured right margin of the element in pixels.
*/
public int getMarginRight(Element element) {
+ assert needsMeasure(element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getMarginRight();
}
* @return the measured bottom margin of the element in pixels.
*/
public int getMarginBottom(Element element) {
+ assert needsMeasure(element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getMarginBottom();
}
* @return the measured left margin of the element in pixels.
*/
public int getMarginLeft(Element element) {
+ assert needsMeasure(element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getMarginLeft();
}