for (Element element : panel.elements) {
if (!isVisible(element.getFirstChildElement())) {
i++;
continue;
}
HorizontalLayoutData data = panel.layoutDatas.get(i);
expandToFitParentVertically(element);
String width = data.getWidth();
if (!"*".equals(width)) {
setElementWidth(element, width);
int offsetWidth = LayoutUtils.getOffsetWidth(element);
usedWidth += offsetWidth;
} else {
dynamicElementCount++;
}
i++;
}
int dynamicWidth = containerWidth - usedWidth;
int width = (dynamicElementCount > 0) ? dynamicWidth / dynamicElementCount : 0;
if (width < 0) {
width = 0;
}
int left = 0;
i = 0;
for (Element element : panel.elements) {
if (!isVisible(element.getFirstChildElement())) {
i++;
continue;
}
setLeft(element, left + "px");
HorizontalLayoutData data = panel.layoutDatas.get(i);
if ("*".equals(data.getWidth())) {
setElementWidth(element, width + "px");
left += width;
} else {
int currentWidth = LayoutUtils.getOffsetWidth(element);
left += currentWidth;