use of org.jowidgets.api.widgets.blueprint.IExpandCompositeBluePrint in project jo-client-platform by jo-source.
the class BeanFormLayouterImpl method expandCompositeBp.
private IExpandCompositeBluePrint expandCompositeBp() {
final IExpandCompositeBluePrint result = BPF.expandComposite();
result.setTextColor(headerTextColor);
result.setTextMarkup(headerTextMarkup);
result.setHeaderBackgroundColor(headerBackgroundColor);
result.setBackgroundColor(contentBackgroundColor);
result.setBorder(border);
result.setHeaderBorder(headerBorder);
result.setContentBorder(contentBorder);
return result;
}
use of org.jowidgets.api.widgets.blueprint.IExpandCompositeBluePrint 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);
}
use of org.jowidgets.api.widgets.blueprint.IExpandCompositeBluePrint in project jo-client-platform by jo-source.
the class BeanFormLayouterImpl method createAndAddContentContainer.
private IContainer createAndAddContentContainer(final IContainer parent, final IBeanFormControlFactory controlFactory, final boolean scrollComposite) {
final ICustomWidgetCreator<? extends IControl> mainValidationLabel = controlFactory.createMainValidationLabel();
final IContainer outerContainer;
if (mainValidationLabel != null) {
final IExpandCompositeBluePrint expandCompositeBp = expandCompositeBp();
expandCompositeBp.setExpanded(true);
expandCompositeBp.setCustomHeader(mainValidationLabel);
final IExpandComposite expandComposite = parent.add(expandCompositeBp, MigLayoutFactory.GROWING_CELL_CONSTRAINTS);
expandComposite.setLayout(MigLayoutFactory.growingInnerCellLayout());
expandComposite.setEnabled(false);
outerContainer = expandComposite;
} else {
outerContainer = parent;
}
final IContainer innerContainer;
if (scrollComposite) {
outerContainer.setLayout(MigLayoutFactory.growingInnerCellLayout());
innerContainer = outerContainer.add(BPF.scrollComposite(), MigLayoutFactory.GROWING_CELL_CONSTRAINTS);
} else {
innerContainer = outerContainer.add(BPF.composite(), MigLayoutFactory.GROWING_CELL_CONSTRAINTS);
}
final String cc = contentInsets.getLeft() + "[grow, 0::]" + contentInsets.getRight();
final String rc = contentInsets.getTop() + "[]" + contentInsets.getBottom();
innerContainer.setLayout(new MigLayoutDescriptor(cc, rc));
final String widthCC = getMainWidthConstraints(controlFactory);
return innerContainer.add(BPF.composite(), "growx, " + widthCC + ", h 0::, aligny top");
}
Aggregations