Search in sources :

Example 11 with MigLayoutDescriptor

use of org.jowidgets.common.widgets.layout.MigLayoutDescriptor 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);
}
Also used : IExpandListener(org.jowidgets.api.controller.IExpandListener) IExpandComposite(org.jowidgets.api.widgets.IExpandComposite) ITextLabelBluePrint(org.jowidgets.api.widgets.blueprint.ITextLabelBluePrint) IBeanFormInfo(org.jowidgets.cap.ui.api.form.IBeanFormInfo) IContainer(org.jowidgets.api.widgets.IContainer) MigLayoutDescriptor(org.jowidgets.common.widgets.layout.MigLayoutDescriptor) IExpandCompositeBluePrint(org.jowidgets.api.widgets.blueprint.IExpandCompositeBluePrint)

Example 12 with MigLayoutDescriptor

use of org.jowidgets.common.widgets.layout.MigLayoutDescriptor 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");
}
Also used : IExpandComposite(org.jowidgets.api.widgets.IExpandComposite) IContainer(org.jowidgets.api.widgets.IContainer) MigLayoutDescriptor(org.jowidgets.common.widgets.layout.MigLayoutDescriptor) IExpandCompositeBluePrint(org.jowidgets.api.widgets.blueprint.IExpandCompositeBluePrint)

Example 13 with MigLayoutDescriptor

use of org.jowidgets.common.widgets.layout.MigLayoutDescriptor in project jo-client-platform by jo-source.

the class BeanTableSettingsDialogImpl method createButtonBar.

private void createButtonBar(final IComposite buttonBar) {
    buttonBar.setLayout(new MigLayoutDescriptor("0[][]0", "0[]0"));
    final IButton ok = buttonBar.add(bpF.button(Messages.getString("BeanTableSettingsDialogImpl.ok")), "w 80::, aligny b, sg bg");
    ok.addActionListener(new IActionListener() {

        @Override
        public void actionPerformed() {
            okPressed = true;
            setVisible(false);
        }
    });
    frame.setDefaultButton(ok);
    final IButton cancel = buttonBar.add(bpF.button(Messages.getString("BeanTableSettingsDialogImpl.cancel")), "w 80::, aligny b, sg bg");
    cancel.addActionListener(new IActionListener() {

        @Override
        public void actionPerformed() {
            setVisible(false);
        }
    });
}
Also used : IActionListener(org.jowidgets.common.widgets.controller.IActionListener) IButton(org.jowidgets.api.widgets.IButton) MigLayoutDescriptor(org.jowidgets.common.widgets.layout.MigLayoutDescriptor)

Aggregations

MigLayoutDescriptor (org.jowidgets.common.widgets.layout.MigLayoutDescriptor)13 IContainer (org.jowidgets.api.widgets.IContainer)5 IComposite (org.jowidgets.api.widgets.IComposite)3 IExpandComposite (org.jowidgets.api.widgets.IExpandComposite)2 IExpandCompositeBluePrint (org.jowidgets.api.widgets.blueprint.IExpandCompositeBluePrint)2 ITextLabelBluePrint (org.jowidgets.api.widgets.blueprint.ITextLabelBluePrint)2 IBluePrintFactory (org.jowidgets.api.widgets.blueprint.factory.IBluePrintFactory)2 Dimension (org.jowidgets.common.types.Dimension)2 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 IBrowser (org.jowidgets.addons.widgets.browser.api.IBrowser)1 IExpandListener (org.jowidgets.api.controller.IExpandListener)1 IShowingStateListener (org.jowidgets.api.controller.IShowingStateListener)1 ITableLayoutBuilder (org.jowidgets.api.layout.tablelayout.ITableLayoutBuilder)1 IButton (org.jowidgets.api.widgets.IButton)1 IControl (org.jowidgets.api.widgets.IControl)1 IInputControl (org.jowidgets.api.widgets.IInputControl)1 IScrollCompositeBluePrint (org.jowidgets.api.widgets.blueprint.IScrollCompositeBluePrint)1 IInputContentContainer (org.jowidgets.api.widgets.content.IInputContentContainer)1