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();
}
}
Aggregations