Form.Field fieldWidget = (Form.Field) section
.getWidget(fieldIndex);
// Widget field = fieldWidget.getWidget(0);
if (fieldWidget.isVisible()) {
InlineLabel label = fieldWidget.labelWidget;
maximumLabelWidth = Math.max(maximumLabelWidth,
WidgetHelper.getPreferredWidth(label));
// TODO if (showFlagMessagesInline) {}
}
}
}
// Determine the field width
int width = getElement().getClientWidth();
int fieldWidth = Math.max(0, width
- (maximumLabelWidth + horizontalSpacing));
// TODO if (showFlagIcons) {}
// TODO if (showFlagMessagesInline) {}
fieldWidth = Math.max(0,
fieldWidth - boxModel.getPaddingWidthContribution());
// Lay out the components
int rowY = boxModel.getPadding().top;
for (int sectionIndex = 0, sectionCount = getWidgetCount(); sectionIndex < sectionCount; sectionIndex++) {
Form.Section section = (Form.Section) getWidget(sectionIndex);
WidgetHelper.setSize(section, width, 1);
WidgetHelper.setLocation(section, 0, 0);
Separator separator = section.separator;
if (sectionIndex > 0 || section.getHeading() != null) {
int separatorWidth = Math.max(
width - boxModel.getPaddingWidthContribution(), 0);
separator.setVisible(true);
int separatorHeight = WidgetHelper.getPreferredHeight(
separator, separatorWidth);
WidgetHelper
.setSize(separator, separatorWidth, separatorHeight);
WidgetHelper.setLocation(separator, boxModel.getPadding().left,
rowY);
rowY += separatorHeight;
} else {
separator.setVisible(false);
}
for (int fieldIndex = 0, fieldCount = section.getWidgetCount(); fieldIndex < fieldCount; fieldIndex++) {
Form.Field fieldWidget = (Form.Field) section
.getWidget(fieldIndex);
Widget field = fieldWidget.getWidget(0);
InlineLabel label = fieldWidget.labelWidget;
WidgetHelper.setSize(fieldWidget, width, 1);
WidgetHelper.setLocation(fieldWidget, 0, 0);
if (fieldWidget.isVisible()) {
// Show the label
label.setVisible(true);
// Determine the label size and baseline
Dimensions labelSize = WidgetHelper.getPreferredSize(label);
WidgetHelper.setSize(label, labelSize.width,