use of de.metas.ui.web.window.descriptor.DocumentFieldDefaultFilterDescriptor in project metasfresh-webui-api by metasfresh.
the class DocumentFilterDescriptorsProviderFactory method createFilterParam.
private final DocumentFilterParamDescriptor.Builder createFilterParam(final DocumentFieldDescriptor field) {
final ITranslatableString displayName = field.getCaption();
final String fieldName = field.getFieldName();
final DocumentFieldWidgetType widgetType = extractFilterWidgetType(field);
final DocumentFieldDefaultFilterDescriptor filteringInfo = field.getDefaultFilterInfo();
final LookupDescriptor lookupDescriptor = field.getLookupDescriptor(LookupDescriptorProvider.LookupScope.DocumentFilter);
final Operator operator;
if (widgetType.isText()) {
operator = Operator.LIKE_I;
} else if (filteringInfo.isRangeFilter()) {
operator = Operator.BETWEEN;
} else {
operator = Operator.EQUAL;
}
return DocumentFilterParamDescriptor.builder().setDisplayName(displayName).setFieldName(fieldName).setWidgetType(widgetType).setOperator(operator).setLookupDescriptor(lookupDescriptor).setMandatory(false).setShowIncrementDecrementButtons(filteringInfo.isShowFilterIncrementButtons()).setAutoFilterInitialValue(filteringInfo.getAutoFilterInitialValue());
}
Aggregations