use of org.jowidgets.cap.ui.api.filter.IUiFilter in project jo-client-platform by jo-source.
the class UiFilterToolsImpl method isPropertyFiltered.
@Override
public boolean isPropertyFiltered(final IUiFilter sourceFilter, final String propertyName) {
Assert.paramNotNull(sourceFilter, "sourceFilter");
Assert.paramNotNull(propertyName, "propertyName");
if (sourceFilter instanceof IUiBooleanFilter) {
final IUiBooleanFilter booleanSourceFilter = (IUiBooleanFilter) sourceFilter;
for (final IUiFilter subSourceFilter : booleanSourceFilter.getFilters()) {
if (isPropertyFiltered(subSourceFilter, propertyName)) {
return true;
}
}
return false;
} else if (sourceFilter instanceof IUiArithmeticFilter<?>) {
return propertyName.equals(((IUiArithmeticFilter<?>) sourceFilter).getPropertyName());
} else if (sourceFilter instanceof IUiArithmeticPropertyFilter<?>) {
return propertyName.equals(((IUiArithmeticPropertyFilter<?>) sourceFilter).getPropertyName());
} else if (sourceFilter instanceof IUiCustomFilter<?>) {
return propertyName.equals(((IUiCustomFilter<?>) sourceFilter).getPropertyName());
} else {
throw new IllegalArgumentException("The source filter type '" + sourceFilter.getClass().getName() + "' is not supported");
}
}
use of org.jowidgets.cap.ui.api.filter.IUiFilter in project jo-client-platform by jo-source.
the class UiFilterToolsImpl method hasPropertyFilters.
@Override
public boolean hasPropertyFilters(final IUiFilter sourceFilter, final String... ignoredProperties) {
Assert.paramNotNull(sourceFilter, "sourceFilter");
final Set<String> ignored = new HashSet<String>();
if (ignoredProperties != null) {
ignored.addAll(Arrays.asList(ignoredProperties));
}
if (sourceFilter instanceof IUiBooleanFilter) {
final IUiBooleanFilter booleanSourceFilter = (IUiBooleanFilter) sourceFilter;
for (final IUiFilter subSourceFilter : booleanSourceFilter.getFilters()) {
if (hasPropertyFilters(subSourceFilter, ignoredProperties)) {
return true;
}
}
return false;
} else if (sourceFilter instanceof IUiArithmeticFilter<?>) {
final String propertyName = ((IUiArithmeticFilter<?>) sourceFilter).getPropertyName();
if (ignored.contains(propertyName)) {
return false;
} else {
return true;
}
} else if (sourceFilter instanceof IUiArithmeticPropertyFilter<?>) {
final String propertyName = ((IUiArithmeticPropertyFilter<?>) sourceFilter).getPropertyName();
if (ignored.contains(propertyName)) {
return false;
} else {
return true;
}
} else if (sourceFilter instanceof IUiCustomFilter<?>) {
final String propertyName = ((IUiCustomFilter<?>) sourceFilter).getPropertyName();
if (ignored.contains(propertyName)) {
return false;
} else {
return true;
}
} else {
throw new IllegalArgumentException("The source filter type '" + sourceFilter.getClass().getName() + "' is not supported");
}
}
Aggregations