Search in sources :

Example 1 with GroupFilterCondition

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

the class GroupFilterConverter method convertToModel.

@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public GroupFilterCondition convertToModel(GroupFilter groupFilter) {
    GroupFilterCondition groupFilterCondition = super.convertToModel(groupFilter);
    groupFilterCondition.setOperation(groupFilter.getOperation());
    groupFilterCondition.setCaption(groupFilter.getCaption());
    groupFilterCondition.setLocalizedCaption(getLocalizedModelCaption(groupFilter));
    groupFilterCondition.setOperationCaptionVisible(groupFilter.isOperationCaptionVisible());
    List<FilterCondition> ownFilterConditions = new ArrayList<>();
    for (FilterComponent ownFilterComponent : groupFilter.getOwnFilterComponents()) {
        FilterConverter ownFilterConverter = filterComponents.getConverterByComponentClass(ownFilterComponent.getClass(), filter);
        FilterCondition ownFilterCondition = ownFilterConverter.convertToModel(ownFilterComponent);
        ownFilterCondition.setParent(groupFilterCondition);
        ownFilterConditions.add(ownFilterCondition);
    }
    if (!ownFilterConditions.isEmpty()) {
        groupFilterCondition.setOwnFilterConditions(ownFilterConditions);
    }
    return groupFilterCondition;
}
Also used : FilterCondition(io.jmix.ui.entity.FilterCondition) GroupFilterCondition(io.jmix.ui.entity.GroupFilterCondition) ArrayList(java.util.ArrayList) GroupFilterCondition(io.jmix.ui.entity.GroupFilterCondition) FilterComponent(io.jmix.ui.component.FilterComponent) FilterConverter(io.jmix.ui.component.filter.converter.FilterConverter)

Example 2 with GroupFilterCondition

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

the class GroupFilterConverter method convertToComponent.

@Override
public GroupFilter convertToComponent(GroupFilterCondition model) {
    GroupFilter groupFilter = super.convertToComponent(model);
    groupFilter.setOperation(model.getOperation());
    groupFilter.setCaption(model.getCaption());
    groupFilter.setOperationCaptionVisible(model.getOperationCaptionVisible());
    if (model.getOwnFilterConditions() != null) {
        for (FilterCondition ownFilterCondition : model.getOwnFilterConditions()) {
            FilterConverter ownFilterConverter = filterComponents.getConverterByModelClass(ownFilterCondition.getClass(), filter);
            groupFilter.add(ownFilterConverter.convertToComponent(ownFilterCondition));
        }
    }
    return groupFilter;
}
Also used : FilterCondition(io.jmix.ui.entity.FilterCondition) GroupFilterCondition(io.jmix.ui.entity.GroupFilterCondition) GroupFilter(io.jmix.ui.component.GroupFilter) FilterConverter(io.jmix.ui.component.filter.converter.FilterConverter)

Aggregations

FilterConverter (io.jmix.ui.component.filter.converter.FilterConverter)2 FilterCondition (io.jmix.ui.entity.FilterCondition)2 GroupFilterCondition (io.jmix.ui.entity.GroupFilterCondition)2 FilterComponent (io.jmix.ui.component.FilterComponent)1 GroupFilter (io.jmix.ui.component.GroupFilter)1 ArrayList (java.util.ArrayList)1