use of org.jowidgets.cap.ui.api.form.IBeanFormInfo in project jo-client-platform by jo-source.
the class BeanFormLayouterImpl method layout.
@Override
public void layout(final IContainer parent, final IBeanFormControlFactory controlFactory) {
final IBeanFormInfo beanFormInfo = controlFactory.getBeanFormInfo();
final IContainer container;
if (controlFactory.getScrollbarsAllowed() && beanFormInfo != null) {
parent.setLayout(MigLayoutFactory.growingInnerCellLayout());
container = parent.add(BPF.scrollComposite(), MigLayoutFactory.GROWING_CELL_CONSTRAINTS);
} else {
container = parent;
}
final String colConstraints = insets.getLeft() + "[grow, 0::]" + insets.getRight();
final String rowConstraints;
if (beanFormInfo != null) {
rowConstraints = insets.getTop() + "[][grow, 0::]" + insets.getBottom();
} else {
rowConstraints = insets.getTop() + "[grow, 0::]" + insets.getBottom();
}
container.setLayout(new MigLayoutDescriptor(colConstraints, rowConstraints));
if (beanFormInfo != null) {
final IExpandCompositeBluePrint expandCompositeBp = expandCompositeBp();
expandCompositeBp.setExpanded(beanFormInfo.isExpanded());
expandCompositeBp.setText(beanFormInfo.getHeader().get());
expandCompositeBp.setIcon(beanFormInfo.getHeaderIcon());
final IExpandComposite expandComposite = container.add(expandCompositeBp, "growx, w 0::, wrap");
final String cc = contentInsets.getLeft() + "[grow, 0::]" + contentInsets.getRight();
final String rc = contentInsets.getTop() + "[]" + contentInsets.getBottom();
expandComposite.setLayout(new MigLayoutDescriptor(cc, rc));
final ITextLabelBluePrint labelBp = BPF.textLabel(beanFormInfo.getText().get());
labelBp.setForegroundColor(contentTextColor).setMarkup(contentTextMarkup);
expandComposite.add(labelBp, "growx, w 0::");
expandComposite.addExpandListener(new IExpandListener() {
@Override
public void expandedChanged(final boolean expanded) {
getRootContainer(parent).layout();
}
});
}
final boolean contentScrollbar = beanFormInfo == null && controlFactory.getScrollbarsAllowed();
final IContainer contentContainer = createAndAddContentContainer(container, controlFactory, contentScrollbar);
contentLayouter.layout(contentContainer, controlFactory);
}
Aggregations