Search in sources :

Example 1 with ICapApiBluePrintFactory

use of org.jowidgets.cap.ui.api.widgets.ICapApiBluePrintFactory 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 ICapApiBluePrintFactory

use of org.jowidgets.cap.ui.api.widgets.ICapApiBluePrintFactory in project jo-client-platform by jo-source.

the class BeanLinkPanelImpl method createModifiedFormBp.

private <BEAN_TYPE> IBeanFormBluePrint<BEAN_TYPE> createModifiedFormBp(final IBeanFormBluePrint<BEAN_TYPE> formBp) {
    final ICapApiBluePrintFactory cbpf = CapUiToolkit.bluePrintFactory();
    cbpf.beanForm();
    final IBeanFormBluePrint<BEAN_TYPE> result = CapUiToolkit.bluePrintFactory().beanForm();
    result.setSetup(formBp);
    result.setEditModeValidationLabel(null);
    result.setCreateModeValidationLabel(null);
    result.setSaveAction(null);
    result.setUndoAction(null);
    return result;
}
Also used : ICapApiBluePrintFactory(org.jowidgets.cap.ui.api.widgets.ICapApiBluePrintFactory)

Example 3 with ICapApiBluePrintFactory

use of org.jowidgets.cap.ui.api.widgets.ICapApiBluePrintFactory in project jo-client-platform by jo-source.

the class CsvExportExecutor method createExecutionTaskDialog.

private static IExecutionTaskDialog createExecutionTaskDialog(final IExecutionContext executionContext, final IExecutionTask executionTask) {
    final ICapApiBluePrintFactory cbpf = CapUiToolkit.bluePrintFactory();
    final IExecutionTaskDialogBluePrint executionTaskDialogBp = cbpf.executionTaskDialog(executionContext, executionTask);
    executionTaskDialogBp.setModal(false);
    final IWindow activeWindow = Toolkit.getActiveWindow();
    return activeWindow.createChildWindow(executionTaskDialogBp);
}
Also used : IExecutionTaskDialogBluePrint(org.jowidgets.cap.ui.api.widgets.IExecutionTaskDialogBluePrint) ICapApiBluePrintFactory(org.jowidgets.cap.ui.api.widgets.ICapApiBluePrintFactory) IWindow(org.jowidgets.api.widgets.IWindow)

Example 4 with ICapApiBluePrintFactory

use of org.jowidgets.cap.ui.api.widgets.ICapApiBluePrintFactory 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 5 with ICapApiBluePrintFactory

use of org.jowidgets.cap.ui.api.widgets.ICapApiBluePrintFactory in project jo-client-platform by jo-source.

the class EntityRelationTreeDetailView method initialize.

void initialize(final IBeanTable<?> rootTable, final IBeanRelationTree<?> relationTree, final Collection<IAction> linkCreatorActions) {
    if (!intialized) {
        final IContainer container = context.getContainer();
        container.setLayout(MigLayoutFactory.growingInnerCellLayout());
        final ICapApiBluePrintFactory cbpf = CapUiToolkit.bluePrintFactory();
        final IBeanRelationTreeDetailBluePrint<?> treeDetailBp = cbpf.beanRelationTreeDetail(relationTree.getModel());
        final IBeanRelationTreeDetail<?> relationTreeDetail = container.add(treeDetailBp, MigLayoutFactory.GROWING_CELL_CONSTRAINTS);
        final IBeanTableModel<?> rootTableModel = rootTable.getModel();
        final IPluginPropertiesBuilder propBuilder = PluginProperties.builder();
        propBuilder.add(IEntityComponentRelationTreeDetailViewPlugin.BEAN_TYPE_PROPERTY_KEY, rootTableModel.getBeanType());
        propBuilder.add(IEntityComponentRelationTreeDetailViewPlugin.ENTITIY_ID_PROPERTY_KEY, rootTableModel.getEntityId());
        final IPluginProperties pluginProperties = propBuilder.build();
        final List<IEntityComponentRelationTreeDetailViewPlugin> plugins = PluginProvider.getPlugins(IEntityComponentRelationTreeDetailViewPlugin.ID, pluginProperties);
        for (final IEntityComponentRelationTreeDetailViewPlugin plugin : plugins) {
            plugin.onInitialize(pluginProperties, context, rootTable, relationTree, relationTreeDetail, linkCreatorActions);
        }
        intialized = true;
    }
}
Also used : IEntityComponentRelationTreeDetailViewPlugin(org.jowidgets.cap.ui.api.plugin.IEntityComponentRelationTreeDetailViewPlugin) IPluginProperties(org.jowidgets.plugin.api.IPluginProperties) IPluginPropertiesBuilder(org.jowidgets.plugin.api.IPluginPropertiesBuilder) ICapApiBluePrintFactory(org.jowidgets.cap.ui.api.widgets.ICapApiBluePrintFactory) IContainer(org.jowidgets.api.widgets.IContainer)

Aggregations

ICapApiBluePrintFactory (org.jowidgets.cap.ui.api.widgets.ICapApiBluePrintFactory)6 Dimension (org.jowidgets.common.types.Dimension)2 LinkedList (java.util.LinkedList)1 List (java.util.List)1 IContainer (org.jowidgets.api.widgets.IContainer)1 IWindow (org.jowidgets.api.widgets.IWindow)1 IBluePrintFactory (org.jowidgets.api.widgets.blueprint.factory.IBluePrintFactory)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 IEntityComponentRelationTreeDetailViewPlugin (org.jowidgets.cap.ui.api.plugin.IEntityComponentRelationTreeDetailViewPlugin)1 IAttributeFilterControl (org.jowidgets.cap.ui.api.widgets.IAttributeFilterControl)1 IExecutionTaskDialogBluePrint (org.jowidgets.cap.ui.api.widgets.IExecutionTaskDialogBluePrint)1 MigLayoutDescriptor (org.jowidgets.common.widgets.layout.MigLayoutDescriptor)1 IPluginProperties (org.jowidgets.plugin.api.IPluginProperties)1 IPluginPropertiesBuilder (org.jowidgets.plugin.api.IPluginPropertiesBuilder)1