Search in sources :

Example 1 with FilterConfiguration

use of io.jmix.uidata.entity.FilterConfiguration in project jmix by jmix-framework.

the class UiDataFilterSupport method createFilterConfigurationFragment.

@Override
public ScreenFragment createFilterConfigurationFragment(FrameOwner owner, boolean isNewConfiguration, Filter.Configuration currentConfiguration) {
    FilterConfiguration configurationModel = loadFilterConfigurationModel(isNewConfiguration, currentConfiguration);
    boolean defaultForMeFieldVisible = isDefaultForMeFieldVisible(currentConfiguration, configurationModel);
    registerConfigurationDc(configurationModel, owner);
    Fragments fragments = UiControllerUtils.getScreenContext(owner).getFragments();
    UiDataFilterConfigurationModelFragment fragment = fragments.create(owner, UiDataFilterConfigurationModelFragment.class);
    fragment.setDefaultForMeFieldVisible(defaultForMeFieldVisible);
    return fragment;
}
Also used : FilterConfiguration(io.jmix.uidata.entity.FilterConfiguration) Fragments(io.jmix.ui.Fragments) UiDataFilterConfigurationModelFragment(io.jmix.uidata.app.filter.configuration.UiDataFilterConfigurationModelFragment)

Example 2 with FilterConfiguration

use of io.jmix.uidata.entity.FilterConfiguration in project jmix by jmix-framework.

the class UiDataFilterSupport method getConfigurationsMap.

@Override
public Map<Filter.Configuration, Boolean> getConfigurationsMap(Filter filter) {
    Map<Filter.Configuration, Boolean> map = new TreeMap<>();
    List<FilterConfiguration> configurationModels = loadFilterConfigurationModels(filter);
    for (FilterConfiguration configurationModel : configurationModels) {
        Filter.Configuration configuration = filterConfigurationConverter.toConfiguration(configurationModel, filter);
        map.put(configuration, configurationModel.getDefaultForAll());
    }
    return map;
}
Also used : FilterConfiguration(io.jmix.uidata.entity.FilterConfiguration) Filter(io.jmix.ui.component.Filter) FilterConfiguration(io.jmix.uidata.entity.FilterConfiguration) TreeMap(java.util.TreeMap)

Example 3 with FilterConfiguration

use of io.jmix.uidata.entity.FilterConfiguration in project jmix by jmix-framework.

the class UiDataFilterSupport method saveCurrentFilterConfiguration.

@Override
public Filter.Configuration saveCurrentFilterConfiguration(Filter.Configuration configuration, boolean isNewConfiguration, LogicalFilterComponent rootFilterComponent, ScreenFragment configurationFragment) {
    FilterConfiguration configurationModel = getFragmentFilterConfigurationModel(configuration, configurationFragment);
    Filter.Configuration resultConfiguration = initFilterConfiguration(configurationModel.getConfigurationId(), configurationModel.getName(), configuration, isNewConfiguration, rootFilterComponent);
    saveConfigurationModel(resultConfiguration, configurationModel);
    return resultConfiguration;
}
Also used : Filter(io.jmix.ui.component.Filter) FilterConfiguration(io.jmix.uidata.entity.FilterConfiguration)

Example 4 with FilterConfiguration

use of io.jmix.uidata.entity.FilterConfiguration in project jmix by jmix-framework.

the class UiDataFilterSupport method createFilterConfigurationModel.

protected FilterConfiguration createFilterConfigurationModel(Filter.Configuration configuration) {
    FilterConfiguration configurationModel = metadata.create(FilterConfiguration.class);
    configurationModel.setConfigurationId(configuration.getId());
    configurationModel.setName(configuration.getName());
    configurationModel.setUsername(currentAuthentication.getUser().getUsername());
    return configurationModel;
}
Also used : FilterConfiguration(io.jmix.uidata.entity.FilterConfiguration)

Example 5 with FilterConfiguration

use of io.jmix.uidata.entity.FilterConfiguration in project jmix by jmix-framework.

the class UiDataFilterSupport method loadFilterConfigurationModel.

protected FilterConfiguration loadFilterConfigurationModel(boolean isNewConfiguration, Filter.Configuration currentConfiguration) {
    FilterConfiguration configurationModel = null;
    if (!isNewConfiguration) {
        configurationModel = loadFilterConfigurationModel(currentConfiguration.getOwner(), currentConfiguration.getId());
    }
    if (configurationModel == null) {
        configurationModel = metadata.create(FilterConfiguration.class);
        configurationModel.setUsername(currentAuthentication.getUser().getUsername());
    }
    return configurationModel;
}
Also used : FilterConfiguration(io.jmix.uidata.entity.FilterConfiguration)

Aggregations

FilterConfiguration (io.jmix.uidata.entity.FilterConfiguration)8 Filter (io.jmix.ui.component.Filter)3 ScreenData (io.jmix.ui.model.ScreenData)2 UiDataFilterConfigurationModelFragment (io.jmix.uidata.app.filter.configuration.UiDataFilterConfigurationModelFragment)2 Fragments (io.jmix.ui.Fragments)1 ScreenSettingsFacet (io.jmix.ui.settings.facet.ScreenSettingsFacet)1 TreeMap (java.util.TreeMap)1