Search in sources :

Example 1 with IUiFilterFactory

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

the class BeanRelationNodeModelImpl method getFilter.

private IFilter getFilter() {
    final IFilter addedDataFilter = getAddedDataFilter();
    if (filters.size() > 0 || addedDataFilter != null) {
        final IBooleanFilterBuilder builder = CapCommonToolkit.filterFactory().booleanFilterBuilder();
        builder.setOperator(BooleanOperator.AND);
        final IUiFilterFactory filterFactory = CapUiToolkit.filterToolkit().filterFactory();
        for (final IUiFilter uiFilter : filters.values()) {
            builder.addFilter(filterFactory.convert(uiFilter));
        }
        if (addedDataFilter != null) {
            builder.addFilter(addedDataFilter);
        }
        return builder.build();
    } else {
        return addedDataFilter;
    }
}
Also used : IBooleanFilterBuilder(org.jowidgets.cap.common.api.filter.IBooleanFilterBuilder) IUiFilterFactory(org.jowidgets.cap.ui.api.filter.IUiFilterFactory) IFilter(org.jowidgets.cap.common.api.filter.IFilter) IUiFilter(org.jowidgets.cap.ui.api.filter.IUiFilter)

Example 2 with IUiFilterFactory

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

the class BeanTableModelImpl method getFilter.

private IFilter getFilter() {
    final IFilter addedDataFilter = getAddedDataFilter();
    if (filters.size() > 0 || addedDataFilter != null) {
        final IBooleanFilterBuilder builder = CapCommonToolkit.filterFactory().booleanFilterBuilder();
        builder.setOperator(BooleanOperator.AND);
        final IUiFilterFactory filterFactory = CapUiToolkit.filterToolkit().filterFactory();
        for (final IUiFilter uiFilter : filters.values()) {
            builder.addFilter(filterFactory.convert(uiFilter));
        }
        if (addedDataFilter != null) {
            builder.addFilter(addedDataFilter);
        }
        return builder.build();
    } else {
        return addedDataFilter;
    }
}
Also used : IBooleanFilterBuilder(org.jowidgets.cap.common.api.filter.IBooleanFilterBuilder) IUiFilterFactory(org.jowidgets.cap.ui.api.filter.IUiFilterFactory) IFilter(org.jowidgets.cap.common.api.filter.IFilter) IUiFilter(org.jowidgets.cap.ui.api.filter.IUiFilter)

Example 3 with IUiFilterFactory

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

the class ArithmeticPropertyFilterControl method getValue.

@Override
public IUiArithmeticPropertyFilter<Object> getValue() {
    final IUiFilterFactory filterFactory = CapUiToolkit.filterToolkit().filterFactory();
    final IUiArithmeticPropertyFilterBuilder<Object> filterBuilder = filterFactory.arithmeticPropertyFilterBuilder();
    filterBuilder.setOperator(operator);
    filterBuilder.setPropertyName(propertyName);
    if (ArithmeticOperator.BETWEEN == operator) {
        if (combo1.getValue() == null || combo2.getValue() == null) {
            return null;
        }
        filterBuilder.addRightHandPropertyName(combo1.getValue().getPropertyName());
        filterBuilder.addRightHandPropertyName(combo2.getValue().getPropertyName());
    } else if (ArithmeticOperator.EMPTY != operator) {
        if (combo1.getValue() == null) {
            return null;
        }
        filterBuilder.addRightHandPropertyName(combo1.getValue().getPropertyName());
    }
    return filterBuilder.build();
}
Also used : IUiFilterFactory(org.jowidgets.cap.ui.api.filter.IUiFilterFactory)

Example 4 with IUiFilterFactory

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

the class DefaultArithmeticFilterControl method getValue.

@Override
public IUiArithmeticFilter<Object> getValue() {
    final IUiFilterFactory filterFactory = CapUiToolkit.filterToolkit().filterFactory();
    final IUiArithmeticFilterBuilder<Object> filterBuilder = filterFactory.arithmeticFilterBuilder();
    filterBuilder.setOperator(operator);
    filterBuilder.setPropertyName(propertyName);
    filterBuilder.setParameters(getParameters());
    return filterBuilder.build();
}
Also used : IUiFilterFactory(org.jowidgets.cap.ui.api.filter.IUiFilterFactory)

Example 5 with IUiFilterFactory

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

the class UiFilterToolsImpl method removeProperty.

@SuppressWarnings("unchecked")
@Override
public IUiFilter removeProperty(final IUiFilter sourceFilter, final String propertyName) {
    Assert.paramNotNull(sourceFilter, "sourceFilter");
    Assert.paramNotNull(propertyName, "propertyName");
    final IUiFilterFactory filterFactory = CapUiToolkit.filterToolkit().filterFactory();
    if (sourceFilter instanceof IUiBooleanFilter) {
        boolean empty = true;
        final IUiBooleanFilter source = (IUiBooleanFilter) sourceFilter;
        final IUiBooleanFilterBuilder builder = filterFactory.booleanFilterBuilder();
        builder.setOperator(source.getOperator());
        builder.setInverted(source.isInverted());
        for (final IUiFilter childFilter : source.getFilters()) {
            final IUiFilter childResultFilter = removeProperty(childFilter, propertyName);
            if (childResultFilter != null) {
                builder.addFilter(childResultFilter);
                empty = false;
            }
        }
        if (empty) {
            return null;
        } else {
            return builder.build();
        }
    } else if (sourceFilter instanceof IUiArithmeticFilter<?>) {
        final IUiArithmeticFilter<Object> source = (IUiArithmeticFilter<Object>) sourceFilter;
        if (propertyName.equals(source.getPropertyName())) {
            return null;
        } else {
            return source;
        }
    } else if (sourceFilter instanceof IUiArithmeticPropertyFilter<?>) {
        final IUiArithmeticPropertyFilter<Object> source = (IUiArithmeticPropertyFilter<Object>) sourceFilter;
        if (propertyName.equals(source.getPropertyName())) {
            return null;
        } else {
            return source;
        }
    } else if (sourceFilter instanceof IUiCustomFilter<?>) {
        final IUiCustomFilter<Object> source = (IUiCustomFilter<Object>) sourceFilter;
        if (propertyName.equals(source.getPropertyName())) {
            return null;
        } else {
            return source;
        }
    } else {
        throw new IllegalArgumentException("The source filter type '" + sourceFilter.getClass().getName() + "' is not supported");
    }
}
Also used : IUiArithmeticPropertyFilter(org.jowidgets.cap.ui.api.filter.IUiArithmeticPropertyFilter) IUiBooleanFilterBuilder(org.jowidgets.cap.ui.api.filter.IUiBooleanFilterBuilder) IUiCustomFilter(org.jowidgets.cap.ui.api.filter.IUiCustomFilter) IUiBooleanFilter(org.jowidgets.cap.ui.api.filter.IUiBooleanFilter) IUiFilterFactory(org.jowidgets.cap.ui.api.filter.IUiFilterFactory) IUiFilter(org.jowidgets.cap.ui.api.filter.IUiFilter) IUiArithmeticFilter(org.jowidgets.cap.ui.api.filter.IUiArithmeticFilter)

Aggregations

IUiFilterFactory (org.jowidgets.cap.ui.api.filter.IUiFilterFactory)9 IUiBooleanFilterBuilder (org.jowidgets.cap.ui.api.filter.IUiBooleanFilterBuilder)4 IUiFilter (org.jowidgets.cap.ui.api.filter.IUiFilter)4 IBooleanFilterBuilder (org.jowidgets.cap.common.api.filter.IBooleanFilterBuilder)3 IUiBooleanFilter (org.jowidgets.cap.ui.api.filter.IUiBooleanFilter)3 IFilter (org.jowidgets.cap.common.api.filter.IFilter)2 IUiArithmeticFilter (org.jowidgets.cap.ui.api.filter.IUiArithmeticFilter)2 IUiArithmeticPropertyFilter (org.jowidgets.cap.ui.api.filter.IUiArithmeticPropertyFilter)2 IUiCustomFilter (org.jowidgets.cap.ui.api.filter.IUiCustomFilter)2 IBeanModification (org.jowidgets.cap.common.api.bean.IBeanModification)1 IFilterToolkit (org.jowidgets.cap.ui.api.filter.IFilterToolkit)1 IUiArithmeticFilterBuilder (org.jowidgets.cap.ui.api.filter.IUiArithmeticFilterBuilder)1 IUiCustomFilterBuilder (org.jowidgets.cap.ui.api.filter.IUiCustomFilterBuilder)1