Search in sources :

Example 1 with UiDataFilterConfigurationModelFragment

use of io.jmix.uidata.app.filter.configuration.UiDataFilterConfigurationModelFragment 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 UiDataFilterConfigurationModelFragment

use of io.jmix.uidata.app.filter.configuration.UiDataFilterConfigurationModelFragment in project jmix by jmix-framework.

the class UiDataFilterSupport method getFragmentFilterConfigurationModel.

protected FilterConfiguration getFragmentFilterConfigurationModel(Filter.Configuration configuration, ScreenFragment configurationFragment) {
    Filter filter = configuration.getOwner();
    FilterConfiguration configurationModel;
    if (configurationFragment instanceof UiDataFilterConfigurationModelFragment) {
        ScreenData screenData = UiControllerUtils.getScreenData(configurationFragment.getHostController());
        InstanceContainer<FilterConfiguration> configurationDc = screenData.getContainer(CONFIGURATION_CONTAINER_ID);
        configurationModel = configurationDc.getItem();
        if (filter.getId() != null && filter.getFrame() != null && ((UiDataFilterConfigurationModelFragment) configurationFragment).getDefaultForMeFieldVisible()) {
            ScreenSettingsFacet settingsFacet = UiControllerUtils.getFacet(filter.getFrame(), ScreenSettingsFacet.class);
            if (settingsFacet != null) {
                saveFilterSettings(settingsFacet, filter.getId(), configurationModel);
            }
        }
    } else {
        configurationModel = loadFilterConfigurationModel(filter, configuration.getId());
    }
    if (configurationModel == null) {
        configurationModel = createFilterConfigurationModel(configuration);
    }
    return configurationModel;
}
Also used : ScreenSettingsFacet(io.jmix.ui.settings.facet.ScreenSettingsFacet) Filter(io.jmix.ui.component.Filter) FilterConfiguration(io.jmix.uidata.entity.FilterConfiguration) UiDataFilterConfigurationModelFragment(io.jmix.uidata.app.filter.configuration.UiDataFilterConfigurationModelFragment) ScreenData(io.jmix.ui.model.ScreenData)

Aggregations

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