Search in sources :

Example 11 with IUiFilter

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

the class BeanTabFolderModelImpl method removeFiltersForProperty.

@Override
public void removeFiltersForProperty(final String id, final String propertyName) {
    final IUiFilterTools filterTools = CapUiToolkit.filterToolkit().filterTools();
    final IUiFilter currentFilter = getFilter(id);
    if (currentFilter != null) {
        setFilter(id, filterTools.removeProperty(currentFilter, propertyName));
    }
}
Also used : IUiFilter(org.jowidgets.cap.ui.api.filter.IUiFilter) IUiFilterTools(org.jowidgets.cap.ui.api.filter.IUiFilterTools)

Example 12 with IUiFilter

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

the class BeanTableAddInlineFilterCommandExecutor method doExecution.

@Override
void doExecution(final IExecutionContext executionContext) {
    IUiFilter includingFilter = getIncludingFilter(executionContext);
    if (invert) {
        includingFilter = CapUiToolkit.filterToolkit().filterTools().invert(includingFilter);
    }
    model.addFilter(IBeanTableModel.UI_FILTER_ID, includingFilter);
    model.load();
}
Also used : IUiFilter(org.jowidgets.cap.ui.api.filter.IUiFilter)

Example 13 with IUiFilter

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

the class BeanTableDeleteColumnFiltersActionBuilder method getEnabledState.

private IEnabledState getEnabledState(final IBeanTableModel<?> model) {
    final IUiFilterTools filterTools = CapUiToolkit.filterToolkit().filterTools();
    final IUiFilter uiFilter = model.getFilter(IBeanTableModel.UI_FILTER_ID);
    if (uiFilter != null && filterTools.isPropertyFiltered(uiFilter, attribute.getPropertyName())) {
        return EnabledState.ENABLED;
    } else {
        // $NON-NLS-1$
        return EnabledState.disabled(Messages.getString("BeanTableDeleteColumnFiltersActionBuilder.there_is_no_filter_defined_on_this_column"));
    }
}
Also used : IUiFilter(org.jowidgets.cap.ui.api.filter.IUiFilter) IUiFilterTools(org.jowidgets.cap.ui.api.filter.IUiFilterTools)

Example 14 with IUiFilter

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

the class BeanTableModelImpl method setConfig.

@Override
public void setConfig(final IBeanTableModelConfig config) {
    Assert.paramNotNull(config, "config");
    onSetConfig = true;
    final Map<String, IAttributeConfig> attributeConfigs = config.getAttributeConfigs();
    if (attributeConfigs != null) {
        for (final IAttribute<Object> attribute : attributeSet) {
            final IAttributeConfig attributeConfig = attributeConfigs.get(attribute.getPropertyName());
            if (attributeConfig != null) {
                attribute.setConfig(attributeConfig);
            }
        }
    }
    final Map<String, IUiFilter> filtersConfig = config.getFilters();
    if (filtersConfig != null) {
        for (final Entry<String, IUiFilter> entry : filtersConfig.entrySet()) {
            setFilter(entry.getKey(), entry.getValue());
        }
    }
    if (config.getSortModelConfig() != null) {
        this.sortModel.setConfig(config.getSortModelConfig());
    }
    if (config.isAutoSelection() != null) {
        this.autoSelection = config.isAutoSelection();
    }
    onSetConfig = false;
    dataModel.fireDataChanged();
}
Also used : IUiFilter(org.jowidgets.cap.ui.api.filter.IUiFilter) IAttributeConfig(org.jowidgets.cap.ui.api.attribute.IAttributeConfig)

Example 15 with IUiFilter

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

the class UiFilterFactoryImpl method convert.

@Override
public IFilter convert(final IUiFilter uiFilter) {
    if (uiFilter instanceof IUiBooleanFilter) {
        final IUiBooleanFilter uiBooleanFilter = (IUiBooleanFilter) uiFilter;
        final List<IFilter> filters = new LinkedList<IFilter>();
        for (final IUiFilter uiF : uiBooleanFilter.getFilters()) {
            filters.add(convert(uiF));
        }
        return CapCommonToolkit.filterFactory().booleanFilter(uiBooleanFilter.getOperator(), filters);
    } else if (uiFilter instanceof IUiArithmeticFilter<?>) {
        final IUiArithmeticFilter<?> uiArithmeticFilter = (IUiArithmeticFilter<?>) uiFilter;
        final IArithmeticFilterBuilder arithmeticFilterBuilder = CapCommonToolkit.filterFactory().arithmeticFilterBuilder();
        arithmeticFilterBuilder.setInverted(uiArithmeticFilter.isInverted());
        arithmeticFilterBuilder.setOperator(uiArithmeticFilter.getOperator());
        arithmeticFilterBuilder.setParameters(uiArithmeticFilter.getParameters());
        arithmeticFilterBuilder.setPropertyName(uiArithmeticFilter.getPropertyName());
        return arithmeticFilterBuilder.build();
    } else if (uiFilter instanceof IUiArithmeticPropertyFilter<?>) {
        final IUiArithmeticPropertyFilter<?> uiArithmeticPropertyFilter = (IUiArithmeticPropertyFilter<?>) uiFilter;
        final IArithmeticPropertyFilterBuilder arithmeticPropertyFilterBuilder = CapCommonToolkit.filterFactory().arithmeticPropertyFilterBuilder();
        arithmeticPropertyFilterBuilder.setInverted(uiArithmeticPropertyFilter.isInverted());
        arithmeticPropertyFilterBuilder.setPropertyName(uiArithmeticPropertyFilter.getPropertyName());
        arithmeticPropertyFilterBuilder.setOperator(uiArithmeticPropertyFilter.getOperator());
        arithmeticPropertyFilterBuilder.setRightHandPropertyNames(uiArithmeticPropertyFilter.getRightHandPropertyNames());
        return arithmeticPropertyFilterBuilder.build();
    } else if (uiFilter instanceof IUiCustomFilter<?>) {
        final IUiCustomFilter<?> uiCustomFilter = (IUiCustomFilter<?>) uiFilter;
        final ICustomFilterBuilder customFilterBuilder = CapCommonToolkit.filterFactory().customFilterBuilder();
        customFilterBuilder.setFilterType(uiCustomFilter.getFilterType());
        customFilterBuilder.setInverted(uiCustomFilter.isInverted());
        customFilterBuilder.setOperator(uiCustomFilter.getOperator());
        customFilterBuilder.setPropertyName(uiCustomFilter.getPropertyName());
        customFilterBuilder.setValue(uiCustomFilter.getValue());
        return customFilterBuilder.build();
    } else {
        throw new IllegalStateException("Cannot convert unkown filter class '" + uiFilter.getClass().getName() + "'.");
    }
}
Also used : IArithmeticFilterBuilder(org.jowidgets.cap.common.api.filter.IArithmeticFilterBuilder) IUiArithmeticPropertyFilter(org.jowidgets.cap.ui.api.filter.IUiArithmeticPropertyFilter) IUiCustomFilter(org.jowidgets.cap.ui.api.filter.IUiCustomFilter) IUiBooleanFilter(org.jowidgets.cap.ui.api.filter.IUiBooleanFilter) LinkedList(java.util.LinkedList) ICustomFilterBuilder(org.jowidgets.cap.common.api.filter.ICustomFilterBuilder) IFilter(org.jowidgets.cap.common.api.filter.IFilter) IUiFilter(org.jowidgets.cap.ui.api.filter.IUiFilter) IArithmeticPropertyFilterBuilder(org.jowidgets.cap.common.api.filter.IArithmeticPropertyFilterBuilder) IUiArithmeticFilter(org.jowidgets.cap.ui.api.filter.IUiArithmeticFilter)

Aggregations

IUiFilter (org.jowidgets.cap.ui.api.filter.IUiFilter)17 IUiFilterTools (org.jowidgets.cap.ui.api.filter.IUiFilterTools)7 IUiArithmeticPropertyFilter (org.jowidgets.cap.ui.api.filter.IUiArithmeticPropertyFilter)4 IUiBooleanFilter (org.jowidgets.cap.ui.api.filter.IUiBooleanFilter)4 IUiFilterFactory (org.jowidgets.cap.ui.api.filter.IUiFilterFactory)4 IBooleanFilterBuilder (org.jowidgets.cap.common.api.filter.IBooleanFilterBuilder)3 IFilter (org.jowidgets.cap.common.api.filter.IFilter)3 IUiArithmeticFilter (org.jowidgets.cap.ui.api.filter.IUiArithmeticFilter)3 IUiCustomFilter (org.jowidgets.cap.ui.api.filter.IUiCustomFilter)3 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 IArithmeticFilterBuilder (org.jowidgets.cap.common.api.filter.IArithmeticFilterBuilder)1 IArithmeticPropertyFilterBuilder (org.jowidgets.cap.common.api.filter.IArithmeticPropertyFilterBuilder)1 ICustomFilterBuilder (org.jowidgets.cap.common.api.filter.ICustomFilterBuilder)1 IAttributeConfig (org.jowidgets.cap.ui.api.attribute.IAttributeConfig)1 IUiBooleanFilterBuilder (org.jowidgets.cap.ui.api.filter.IUiBooleanFilterBuilder)1