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