Search in sources :

Example 1 with IInputContentCreator

use of org.jowidgets.api.widgets.content.IInputContentCreator 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)

Aggregations

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 IUiConfigurableFilter (org.jowidgets.cap.ui.api.filter.IUiConfigurableFilter)1 IAttributeFilterControl (org.jowidgets.cap.ui.api.widgets.IAttributeFilterControl)1 ICapApiBluePrintFactory (org.jowidgets.cap.ui.api.widgets.ICapApiBluePrintFactory)1 Dimension (org.jowidgets.common.types.Dimension)1 MigLayoutDescriptor (org.jowidgets.common.widgets.layout.MigLayoutDescriptor)1