Search in sources :

Example 6 with HeaderFilterCondition

use of io.jmix.ui.entity.HeaderFilterCondition in project jmix by jmix-framework.

the class PropertyConditionBuilder method createFilterConditionsByPaths.

protected List<FilterCondition> createFilterConditionsByPaths(List<MetaPropertyPath> paths) {
    List<FilterCondition> conditions = new ArrayList<>();
    HeaderFilterCondition propertiesHeaderCondition = createHeaderFilterCondition(messages.getMessage(PropertyConditionBuilder.class, "propertyConditionBuilder.headerCaption"));
    conditions.add(propertiesHeaderCondition);
    for (MetaPropertyPath path : paths) {
        FilterCondition condition = createFilterConditionByPath(path);
        FilterCondition parent = path.isDirectProperty() ? propertiesHeaderCondition : getParentCondition(path, conditions);
        condition.setParent(parent);
        conditions.add(condition);
    }
    conditions.sort((condition1, condition2) -> ObjectUtils.compare(condition1.getLocalizedCaption(), condition2.getLocalizedCaption()));
    return conditions;
}
Also used : FilterCondition(io.jmix.ui.entity.FilterCondition) HeaderFilterCondition(io.jmix.ui.entity.HeaderFilterCondition) PropertyFilterCondition(io.jmix.ui.entity.PropertyFilterCondition) ArrayList(java.util.ArrayList) MetaPropertyPath(io.jmix.core.metamodel.model.MetaPropertyPath) HeaderFilterCondition(io.jmix.ui.entity.HeaderFilterCondition)

Aggregations

HeaderFilterCondition (io.jmix.ui.entity.HeaderFilterCondition)6 FilterCondition (io.jmix.ui.entity.FilterCondition)5 ArrayList (java.util.ArrayList)3 Filter (io.jmix.ui.component.Filter)2 FilterComponent (io.jmix.ui.component.FilterComponent)2 FilterConverter (io.jmix.ui.component.filter.converter.FilterConverter)2 LogicalFilterCondition (io.jmix.ui.entity.LogicalFilterCondition)2 MetaPropertyPath (io.jmix.core.metamodel.model.MetaPropertyPath)1 LogicalFilterComponent (io.jmix.ui.component.LogicalFilterComponent)1 SingleFilterComponent (io.jmix.ui.component.SingleFilterComponent)1 PropertyFilterCondition (io.jmix.ui.entity.PropertyFilterCondition)1