Search in sources :

Example 1 with Dimension

use of org.jowidgets.common.types.Dimension 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 2 with Dimension

use of org.jowidgets.common.types.Dimension 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)

Example 3 with Dimension

use of org.jowidgets.common.types.Dimension in project jo-client-platform by jo-source.

the class BeanLinkCreatorCommand method getBeanLink.

private IBeanLink<LINK_BEAN_TYPE, LINKABLE_BEAN_TYPE> getBeanLink(final IExecutionContext executionContext) {
    final ICapApiBluePrintFactory cbpf = CapUiToolkit.bluePrintFactory();
    final IBeanLinkPanelBluePrint<LINK_BEAN_TYPE, LINKABLE_BEAN_TYPE> linkPanelBp = cbpf.beanLinkPanel();
    linkPanelBp.setLinkBeanForm(linkBeanForm);
    linkPanelBp.setLinkableBeanForm(linkableBeanForm);
    linkPanelBp.setLinkableTable(linkableTable);
    final IBeanLinkDialogBluePrint<LINK_BEAN_TYPE, LINKABLE_BEAN_TYPE> dialogBp = cbpf.beanLinkDialog(linkPanelBp);
    dialogBp.setMinPackSize(new Dimension(800, 600));
    dialogBp.setMaxPackSize(new Dimension(1600, 1000));
    dialogBp.setExecutionContext(executionContext);
    dialogBp.setMissingInputHint(null);
    dialogBp.setContentScrolled(false);
    if (dialogBounds != null) {
        dialogBp.setPosition(dialogBounds.getPosition()).setSize(dialogBounds.getSize());
        dialogBp.autoPackOff().autoCenterOff();
    }
    final IBeanLinkDialog<LINK_BEAN_TYPE, LINKABLE_BEAN_TYPE> linkDialog;
    linkDialog = Toolkit.getActiveWindow().createChildWindow(dialogBp);
    final IBeanProxy<LINK_BEAN_TYPE> defaultLinkBean;
    if (linkDefaultFactory != null) {
        defaultLinkBean = linkDefaultFactory.create();
    } else {
        defaultLinkBean = createDefaultBean(linkBeanForm, linkBeanTypeId, linkBeanType, linkBeanPropertyValidators);
    }
    final List<IBeanProxy<LINKABLE_BEAN_TYPE>> defaultLinkedBeans;
    if (linkableBeanForm != null) {
        defaultLinkedBeans = Collections.singletonList(createDefaultBean(linkableBeanForm, linkableBeanTypeId, linkableBeanType, linkableBeanPropertyValidators));
    } else {
        defaultLinkedBeans = Collections.emptyList();
    }
    linkDialog.setValue(new IBeanLink<LINK_BEAN_TYPE, LINKABLE_BEAN_TYPE>() {

        @Override
        public IBeanProxy<LINK_BEAN_TYPE> getLinkBean() {
            return defaultLinkBean;
        }

        @Override
        public List<IBeanProxy<LINKABLE_BEAN_TYPE>> getLinkableBeans() {
            return defaultLinkedBeans;
        }
    });
    linkDialog.setVisible(true);
    final IBeanLink<LINK_BEAN_TYPE, LINKABLE_BEAN_TYPE> result;
    if (linkDialog.isOkPressed()) {
        final IBeanLink<LINK_BEAN_TYPE, LINKABLE_BEAN_TYPE> dialogValue = linkDialog.getValue();
        result = new IBeanLink<LINK_BEAN_TYPE, LINKABLE_BEAN_TYPE>() {

            @Override
            public IBeanProxy<LINK_BEAN_TYPE> getLinkBean() {
                final IBeanProxy<LINK_BEAN_TYPE> original = dialogValue.getLinkBean();
                return original != null ? original : defaultLinkBean;
            }

            @Override
            public List<IBeanProxy<LINKABLE_BEAN_TYPE>> getLinkableBeans() {
                return dialogValue.getLinkableBeans();
            }
        };
    } else {
        result = null;
    }
    dialogBounds = linkDialog.getBounds();
    linkDialog.dispose();
    return result;
}
Also used : Dimension(org.jowidgets.common.types.Dimension) IBeanProxy(org.jowidgets.cap.ui.api.bean.IBeanProxy) ICapApiBluePrintFactory(org.jowidgets.cap.ui.api.widgets.ICapApiBluePrintFactory) List(java.util.List) LinkedList(java.util.LinkedList)

Example 4 with Dimension

use of org.jowidgets.common.types.Dimension in project jo-client-platform by jo-source.

the class BeanTableBatchEditCommand method getNewValue.

@SuppressWarnings("unchecked")
private IMaybe<Object> getNewValue(final IExecutionContext executionContext, final Object currentValue, final IAttribute<Object> attribute) {
    final ICustomWidgetCreator<IInputControl<Object>> widgetCreator = getWidgetCreator(attribute);
    if (widgetCreator == null) {
        // TODO this should not occur, show an error to the user
        return Nothing.getInstance();
    }
    final IInputDialogBluePrint<Object> dialogBp = BPF.inputDialog(new CurrentValueContentCreator(widgetCreator, attribute));
    dialogBp.setExecutionContext(executionContext);
    dialogBp.setAutoDispose(true);
    dialogBp.setMinPackSize(new Dimension(400, 200));
    dialogBp.setMaxPackSize(new Dimension(800, 600));
    final IInputDialog<Object> dialog = Toolkit.getActiveWindow().createChildWindow(dialogBp);
    dialog.setValue(currentValue);
    dialog.setVisible(true);
    if (dialog.isOkPressed()) {
        return new Some<Object>(dialog.getValue());
    } else {
        return Nothing.getInstance();
    }
}
Also used : Some(org.jowidgets.util.maybe.Some) IInputControl(org.jowidgets.api.widgets.IInputControl) Dimension(org.jowidgets.common.types.Dimension)

Example 5 with Dimension

use of org.jowidgets.common.types.Dimension in project jo-client-platform by jo-source.

the class BeanRelationGraphImpl method openUpdateEdgeVisibilityDialog.

public void openUpdateEdgeVisibilityDialog(final int filterTabIndex) {
    if (settingsDialog != null) {
        settingsDialog.setVisible(false);
        settingsDialog.removeAll();
        settingsDialog.dispose();
        settingsDialog = null;
    }
    updateVisibilityMaps();
    settingsDialog = new BeanGraphSettingsDialog(vis, groupVisibilityMap, edgeVisibilityMap, settingsDialogPosition, filterTabIndex, groupColorMap);
    settingsDialog.addComponentListener(new ComponentAdapter() {

        @Override
        public void positionChanged() {
            settingsDialogPosition = settingsDialog.getPosition();
        }
    });
    settingsDialog.setMinPackSize(new Dimension(400, 100));
    settingsDialog.setMaxPackSize(new Dimension(400, 300));
    settingsDialog.setVisible(true);
}
Also used : Dimension(org.jowidgets.common.types.Dimension) ComponentAdapter(org.jowidgets.tools.controller.ComponentAdapter)

Aggregations

Dimension (org.jowidgets.common.types.Dimension)7 IBluePrintFactory (org.jowidgets.api.widgets.blueprint.factory.IBluePrintFactory)2 ICapApiBluePrintFactory (org.jowidgets.cap.ui.api.widgets.ICapApiBluePrintFactory)2 MigLayoutDescriptor (org.jowidgets.common.widgets.layout.MigLayoutDescriptor)2 LinkedList (java.util.LinkedList)1 List (java.util.List)1 ITableLayoutBuilder (org.jowidgets.api.layout.tablelayout.ITableLayoutBuilder)1 IInputControl (org.jowidgets.api.widgets.IInputControl)1 IInputContentContainer (org.jowidgets.api.widgets.content.IInputContentContainer)1 IInputContentCreator (org.jowidgets.api.widgets.content.IInputContentCreator)1 IBeanProxy (org.jowidgets.cap.ui.api.bean.IBeanProxy)1 IUiConfigurableFilter (org.jowidgets.cap.ui.api.filter.IUiConfigurableFilter)1 IAttributeFilterControl (org.jowidgets.cap.ui.api.widgets.IAttributeFilterControl)1 ComponentAdapter (org.jowidgets.tools.controller.ComponentAdapter)1 Some (org.jowidgets.util.maybe.Some)1