Search in sources :

Example 6 with IUiBooleanFilter

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

the class UiFilterToolsImpl method addFilter.

@Override
public IUiFilter addFilter(final IUiFilter sourceFilter, final IUiFilter addedFilter) {
    Assert.paramNotNull(addedFilter, "addedFilter");
    final IUiFilterFactory filterFactory = CapUiToolkit.filterToolkit().filterFactory();
    if (sourceFilter == null) {
        return addedFilter;
    } else if (sourceFilter instanceof IUiBooleanFilter) {
        final IUiBooleanFilter booleanSourceFilter = (IUiBooleanFilter) sourceFilter;
        final IUiBooleanFilterBuilder builder = filterFactory.booleanFilterBuilder();
        builder.setOperator(booleanSourceFilter.getOperator());
        builder.setInverted(booleanSourceFilter.isInverted());
        builder.setFilters(booleanSourceFilter.getFilters());
        builder.addFilter(addedFilter);
        return builder.build();
    } else {
        final IUiBooleanFilterBuilder builder = filterFactory.booleanFilterBuilder();
        builder.setOperator(BooleanOperator.AND);
        builder.addFilter(sourceFilter);
        builder.addFilter(addedFilter);
        return builder.build();
    }
}
Also used : IUiFilterFactory(org.jowidgets.cap.ui.api.filter.IUiFilterFactory) IUiBooleanFilterBuilder(org.jowidgets.cap.ui.api.filter.IUiBooleanFilterBuilder) IUiBooleanFilter(org.jowidgets.cap.ui.api.filter.IUiBooleanFilter)

Aggregations

IUiBooleanFilter (org.jowidgets.cap.ui.api.filter.IUiBooleanFilter)6 IUiArithmeticPropertyFilter (org.jowidgets.cap.ui.api.filter.IUiArithmeticPropertyFilter)5 IUiArithmeticFilter (org.jowidgets.cap.ui.api.filter.IUiArithmeticFilter)4 IUiCustomFilter (org.jowidgets.cap.ui.api.filter.IUiCustomFilter)4 IUiFilter (org.jowidgets.cap.ui.api.filter.IUiFilter)4 IUiBooleanFilterBuilder (org.jowidgets.cap.ui.api.filter.IUiBooleanFilterBuilder)3 IUiFilterFactory (org.jowidgets.cap.ui.api.filter.IUiFilterFactory)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 IFilter (org.jowidgets.cap.common.api.filter.IFilter)1 IUiArithmeticFilterBuilder (org.jowidgets.cap.ui.api.filter.IUiArithmeticFilterBuilder)1 IUiCustomFilterBuilder (org.jowidgets.cap.ui.api.filter.IUiCustomFilterBuilder)1