Search in sources :

Example 1 with MigLayoutDescriptor

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

the class BeanFormContentLayouter method layout.

@Override
public void layout(final IContainer container, final IBeanFormControlFactory controlFactory) {
    final Collection<ICustomWidgetCreator<? extends IControl>> buttons = controlFactory.createButtons();
    if (!buttons.isEmpty()) {
        container.setLayout(new MigLayoutDescriptor("0[grow, 0::]0", "0[0::]15[]0"));
        // add the form
        final IContainer formContainer = container.add(BPF.composite(), "growx, w 0::, wrap");
        layoutForm(formContainer, controlFactory);
        // add the button bar
        final IComposite buttonBar = container.add(BPF.composite(), "alignx r");
        buttonBar.setLayout(getButtonBarLayout(buttons));
        for (final ICustomWidgetCreator<? extends IControl> button : buttons) {
            buttonBar.add(button, "sg bg");
        }
    } else {
        layoutForm(container, controlFactory);
    }
}
Also used : IControl(org.jowidgets.api.widgets.IControl) ICustomWidgetCreator(org.jowidgets.common.widgets.factory.ICustomWidgetCreator) IComposite(org.jowidgets.api.widgets.IComposite) IContainer(org.jowidgets.api.widgets.IContainer) MigLayoutDescriptor(org.jowidgets.common.widgets.layout.MigLayoutDescriptor)

Example 2 with MigLayoutDescriptor

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

the class AttributeFilterDialogBluePrintFactory method createDialogBluePrint.

static IInputDialogBluePrint<IUiConfigurableFilter<? extends Object>> createDialogBluePrint(final IBeanTableModel<?> model, final int columnIndex, final IExecutionContext executionContext, final IFilterType filterType) {
    final IBluePrintFactory bpf = Toolkit.getBluePrintFactory();
    final ICapApiBluePrintFactory capBpf = CapUiToolkit.bluePrintFactory();
    final IInputContentCreator<IUiConfigurableFilter<? extends Object>> contentCreator = new IInputContentCreator<IUiConfigurableFilter<? extends Object>>() {

        private IAttributeFilterControl filterControl;

        @Override
        public void setValue(final IUiConfigurableFilter<? extends Object> value) {
            filterControl.setValue(value);
        }

        @Override
        public IUiConfigurableFilter<? extends Object> getValue() {
            return filterControl.getValue();
        }

        @Override
        public void createContent(final IInputContentContainer container) {
            container.setLayout(new MigLayoutDescriptor("[][grow, 0::]", "10[]0"));
            final IAttribute<?> attribute = model.getAttribute(columnIndex);
            container.add(Toolkit.getBluePrintFactory().textLabel(attribute.getCurrentLabel()).setMarkup(Markup.STRONG));
            filterControl = container.add(capBpf.attributeFilterControl(model.getAttributes()), "growx, w 0::");
            if (filterType != null) {
                filterControl.setAttribute(attribute, filterType);
            }
        }
    };
    final IInputDialogBluePrint<IUiConfigurableFilter<? extends Object>> dialogBp = bpf.inputDialog(contentCreator);
    dialogBp.setExecutionContext(executionContext);
    dialogBp.setMissingInputHint(Messages.getString("AttributeFilterDialogBluePrintFactory.please_edit_the_filter"));
    dialogBp.setMinPackSize(new Dimension(600, 170));
    dialogBp.setMaxPackSize(new Dimension(1024, 400));
    return dialogBp;
}
Also used : IInputContentCreator(org.jowidgets.api.widgets.content.IInputContentCreator) IInputContentContainer(org.jowidgets.api.widgets.content.IInputContentContainer) IUiConfigurableFilter(org.jowidgets.cap.ui.api.filter.IUiConfigurableFilter) IBluePrintFactory(org.jowidgets.api.widgets.blueprint.factory.IBluePrintFactory) ICapApiBluePrintFactory(org.jowidgets.cap.ui.api.widgets.ICapApiBluePrintFactory) IAttributeFilterControl(org.jowidgets.cap.ui.api.widgets.IAttributeFilterControl) Dimension(org.jowidgets.common.types.Dimension) MigLayoutDescriptor(org.jowidgets.common.widgets.layout.MigLayoutDescriptor)

Example 3 with MigLayoutDescriptor

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

the class BeanLinkPanelImpl method createForms.

private void createForms(final IContainer container, final IBeanFormBluePrint<LINK_BEAN_TYPE> linkFormBp, final IBeanFormBluePrint<LINKABLE_BEAN_TYPE> linkableFormBp) {
    if (linkFormBp != null && linkableFormBp != null) {
        final boolean scrolledContent = linkFormBp.getScrollbarsAllowed() && linkableFormBp.getScrollbarsAllowed();
        final IContainer content;
        if (scrolledContent) {
            container.setLayout(MigLayoutFactory.growingInnerCellLayout());
            content = container.add(BPF.scrollComposite(), MigLayoutFactory.GROWING_CELL_CONSTRAINTS);
        } else {
            content = container;
        }
        content.setLayout(new MigLayoutDescriptor("0[grow, 0::]0", "0[]0[]0[]0"));
        final IBeanFormBluePrint<LINK_BEAN_TYPE> modifiedLinkFormBp = createModifiedFormBp(linkFormBp);
        if (scrolledContent) {
            modifiedLinkFormBp.setScrollbarsAllowed(false);
        }
        this.linkForm = content.add(modifiedLinkFormBp, "growx, w 0::, wrap");
        content.add(BPF.separator(), "growx, w 0::, wrap");
        final IBeanFormBluePrint<LINKABLE_BEAN_TYPE> modifiedLinkableFormBp = createModifiedFormBp(linkableFormBp);
        if (scrolledContent) {
            modifiedLinkableFormBp.setScrollbarsAllowed(false);
        }
        this.linkableForm = content.add(modifiedLinkableFormBp, "growx, w 0::");
    } else {
        container.setLayout(new MigLayoutDescriptor("0[grow, 0::]0", "0[grow, 0::]0"));
        if (linkFormBp != null) {
            this.linkForm = container.add(createModifiedFormBp(linkFormBp), "growx, w 0::, growy, h 0::");
        }
        if (linkableFormBp != null) {
            this.linkableForm = container.add(createModifiedFormBp(linkableFormBp), "growx, w 0::, growy, h 0::");
        }
    }
}
Also used : IContainer(org.jowidgets.api.widgets.IContainer) MigLayoutDescriptor(org.jowidgets.common.widgets.layout.MigLayoutDescriptor)

Example 4 with MigLayoutDescriptor

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

the class DocumentBeanFormPluginImpl method addBrowserAttribute.

private void addBrowserAttribute(final IContainer container, final IAttribute<?> attribute, final IBeanFormControlFactory controlFactory) {
    container.setLayout(new MigLayoutDescriptor("wrap", "0[grow, 0::]0", "0[]0[grow, 0::]0"));
    final String propertyName = attribute.getPropertyName();
    @SuppressWarnings("unchecked") final IInputControl<IDocument> inputField = (IInputControl<IDocument>) container.add(controlFactory.createControl(propertyName), "growx, w 0::");
    final IBrowser browser = container.add(BrowserBPF.browser(), MigLayoutFactory.GROWING_CELL_CONSTRAINTS);
    container.addShowingStateListener(new IShowingStateListener() {

        @Override
        public void showingStateChanged(final boolean isShowing) {
            if (isShowing) {
                setUrl(container, browser, inputField);
            }
        }
    });
    inputField.addInputListener(new IInputListener() {

        @Override
        public void inputChanged() {
            setUrl(container, browser, inputField);
        }
    });
}
Also used : IBrowser(org.jowidgets.addons.widgets.browser.api.IBrowser) IShowingStateListener(org.jowidgets.api.controller.IShowingStateListener) IInputControl(org.jowidgets.api.widgets.IInputControl) IInputListener(org.jowidgets.common.widgets.controller.IInputListener) MigLayoutDescriptor(org.jowidgets.common.widgets.layout.MigLayoutDescriptor) IDocument(org.jowidgets.cap.common.api.dto.IDocument)

Example 5 with MigLayoutDescriptor

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

the class BeanGraphAttributeListImpl method buildAttributeList.

public void buildAttributeList(final Map<String, Boolean> filterMap, final FilterType type) {
    final ITableLayoutBuilder builder = Toolkit.getLayoutFactoryProvider().tableLayoutBuilder();
    builder.columnCount(2);
    builder.gap(15);
    builder.verticalGap(4);
    builder.alignment(1, Alignment.CENTER);
    builder.fixedColumnWidth(0, 200);
    builder.fixedColumnWidth(1, 50);
    this.attributeLayoutManager = builder.build();
    attributeLayoutManager.beginLayout();
    this.setLayout(new MigLayoutDescriptor("hidemode 2", "[grow, 0::]", "[grow,0::]0[grow,0::]"));
    final IBluePrintFactory bpf = Toolkit.getBluePrintFactory();
    new AttributeHeaderComposite(add(bpf.composite(), "grow, wrap"));
    initializeGroups(this, filterMap, bpf, type);
    attributeLayoutManager.endLayout();
    attributeLayoutManager.validate();
    final Dimension prefSize = super.getPreferredSize();
    setPreferredSize(new Dimension(prefSize.getWidth(), prefSize.getHeight()));
}
Also used : ITableLayoutBuilder(org.jowidgets.api.layout.tablelayout.ITableLayoutBuilder) IBluePrintFactory(org.jowidgets.api.widgets.blueprint.factory.IBluePrintFactory) Dimension(org.jowidgets.common.types.Dimension) 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