for (Element element : panel.elements) {
if (!isVisible(element.getFirstChildElement())) {
i++;
continue;
}
VerticalLayoutData data = panel.layoutDatas.get(i);
expandToFitParentHorizontally(element);
String height = data.getHeight();
if (!"*".equals(height)) {
setElementHeight(element, height);
int offsetHeight = LayoutUtils.getOffsetHeight(element);
usedHeight += offsetHeight;
} else {
dynamicElementCount++;
}
i++;
}
int dynamicHeight = containerHeight - usedHeight;
int height = (dynamicElementCount > 0) ? dynamicHeight / dynamicElementCount : 0;
if (height < 0) {
height = 0;
}
int top = 0;
i = 0;
for (Element element : panel.elements) {
if (!isVisible(element.getFirstChildElement())) {
i++;
continue;
}
setTop(element, top + "px");
VerticalLayoutData data = panel.layoutDatas.get(i);
if ("*".equals(data.getHeight())) {
setElementHeight(element, height + "px");
top += height;
} else {
int currentHeight = LayoutUtils.getOffsetHeight(element);
top += currentHeight;