use of io.jmix.ui.settings.component.FilterSettings in project jmix by jmix-framework.
the class FilterSettingsBinder method getSettings.
@Override
public FilterSettings getSettings(Filter component) {
FilterSettings settings = createSettings();
settings.setId(component.getId());
return settings;
}
use of io.jmix.ui.settings.component.FilterSettings in project jmix by jmix-framework.
the class UiDataFilterSupport method saveFilterSettings.
protected void saveFilterSettings(ScreenSettingsFacet screenSettingsFacet, String filterId, FilterConfiguration configurationModel) {
ScreenSettings settings = screenSettingsFacet.getSettings();
if (settings == null) {
throw new IllegalStateException("ScreenSettingsFacet is not attached to the frame");
}
FilterSettings filterSettings = settings.getSettingsOrCreate(filterId, FilterSettings.class);
if (Objects.equals(filterSettings.getDefaultConfigurationId(), configurationModel.getConfigurationId()) && !configurationModel.getDefaultForMe()) {
filterSettings.setDefaultConfigurationId(null);
}
if (configurationModel.getDefaultForMe()) {
filterSettings.setDefaultConfigurationId(configurationModel.getConfigurationId());
}
settings.put(filterSettings);
}
use of io.jmix.ui.settings.component.FilterSettings in project jmix by jmix-framework.
the class FilterMakeDefaultAction method execute.
@Override
public void execute() {
if (filter.getFrame() == null) {
throw new IllegalStateException("Filter component is not attached to the Frame");
}
ScreenSettingsFacet screenSettingsFacet = UiControllerUtils.getFacet(filter.getFrame(), ScreenSettingsFacet.class);
if (screenSettingsFacet == null) {
throw new IllegalStateException("The Frame does no contain ScreenSettingsFacet");
}
ScreenSettings settings = screenSettingsFacet.getSettings();
if (settings == null) {
throw new IllegalStateException("ScreenSettingsFacet is not attached to the frame");
}
FilterSettings filterSettings = new FilterSettings();
filterSettings.setId(filter.getId());
filterSettings.setDefaultConfigurationId(filter.getCurrentConfiguration().getId());
settings.put(filterSettings);
}
use of io.jmix.ui.settings.component.FilterSettings in project jmix by jmix-framework.
the class UiDataFilterSupport method isDefaultForMeFieldVisible.
protected boolean isDefaultForMeFieldVisible(Filter.Configuration currentConfiguration, FilterConfiguration configurationModel) {
Frame filterFrame = currentConfiguration.getOwner().getFrame();
if (currentConfiguration.getOwner().getId() != null && filterFrame != null) {
ScreenSettingsFacet settingsFacet = UiControllerUtils.getFacet(filterFrame, ScreenSettingsFacet.class);
if (settingsFacet != null) {
ScreenSettings settings = settingsFacet.getSettings();
if (settings != null) {
settings.getSettings(currentConfiguration.getOwner().getId(), FilterSettings.class).ifPresent(filterSettings -> {
String defaultConfigurationId = filterSettings.getDefaultConfigurationId();
if (defaultConfigurationId != null) {
boolean defaultForMe = defaultConfigurationId.equals(configurationModel.getConfigurationId());
configurationModel.setDefaultForMe(defaultForMe);
}
});
}
return true;
}
}
return false;
}
Aggregations