Search in sources :

Example 1 with DocumentFieldDefaultFilterDescriptor

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());
}
Also used : Operator(de.metas.ui.web.document.filter.DocumentFilterParam.Operator) DocumentFieldDefaultFilterDescriptor(de.metas.ui.web.window.descriptor.DocumentFieldDefaultFilterDescriptor) DocumentFieldWidgetType(de.metas.ui.web.window.descriptor.DocumentFieldWidgetType) ITranslatableString(de.metas.i18n.ITranslatableString) ITranslatableString(de.metas.i18n.ITranslatableString) LookupDescriptor(de.metas.ui.web.window.descriptor.LookupDescriptor)

Aggregations

ITranslatableString (de.metas.i18n.ITranslatableString)1 Operator (de.metas.ui.web.document.filter.DocumentFilterParam.Operator)1 DocumentFieldDefaultFilterDescriptor (de.metas.ui.web.window.descriptor.DocumentFieldDefaultFilterDescriptor)1 DocumentFieldWidgetType (de.metas.ui.web.window.descriptor.DocumentFieldWidgetType)1 LookupDescriptor (de.metas.ui.web.window.descriptor.LookupDescriptor)1