use of com.haulmont.cuba.settings.component.CubaFilterSettings in project jmix by jmix-framework.
the class CubaFilterSettingsBinder method getSettings.
@Override
public CubaFilterSettings getSettings(Filter component) {
CubaFilterSettings settings = createSettings();
settings.setId(component.getId());
settings.setGroupBoxExpanded(component.isExpanded());
FilterDelegate delegate = getFilterDelegate(component);
if (isMaxResultsLayoutVisible(delegate)) {
settings.setMaxResults(getMaxResultsValue(delegate));
}
FilterEntity defaultFilter = getDefaultFilter(delegate);
if (defaultFilter != null) {
settings.setDefaultFilterId(defaultFilter.getId().toString());
settings.setApplyDefault(defaultFilter.getApplyDefault());
}
return settings;
}
use of com.haulmont.cuba.settings.component.CubaFilterSettings in project jmix by jmix-framework.
the class CubaFilterSettingsBinder method applyDataLoadingSettings.
@Override
public void applyDataLoadingSettings(Filter component, SettingsWrapper wrapper) {
CubaFilterSettings settings = wrapper.getSettings();
FilterDelegate delegate = getFilterDelegate(component);
if (applyMaxResultsSettingsBeforeLoad(delegate) && settings.getMaxResults() != null) {
applyMaxResultsSettings(delegate, settings.getMaxResults());
}
}
use of com.haulmont.cuba.settings.component.CubaFilterSettings in project jmix by jmix-framework.
the class CubaFilterSettingsBinder method applySettings.
@Override
public void applySettings(Filter component, SettingsWrapper wrapper) {
CubaFilterSettings settings = wrapper.getSettings();
if (settings.getGroupBoxExpanded() != null) {
component.setExpanded(settings.getGroupBoxExpanded());
}
FilterDelegate delegate = getFilterDelegate(component);
if (!applyMaxResultsSettingsBeforeLoad(delegate) && settings.getMaxResults() != null) {
applyMaxResultsSettings(delegate, settings.getMaxResults());
}
}
use of com.haulmont.cuba.settings.component.CubaFilterSettings in project jmix by jmix-framework.
the class FilterDelegateImpl method getDefaultFilterFromScreenSettings.
@Nullable
protected FilterEntity getDefaultFilterFromScreenSettings(List<FilterEntity> filters) {
if (filter.getFrame() == null || StringUtils.isBlank(filter.getId())) {
return null;
}
ScreenSettingsFacet settingsFacet = UiControllerUtils.getFacet(filter.getFrame(), ScreenSettingsFacet.class);
if (settingsFacet == null || settingsFacet.getSettings() == null) {
return null;
}
CubaFilterSettings cubaFilterSettings = settingsFacet.getSettings().getSettings(filter.getId(), CubaFilterSettings.class).orElse(null);
if (cubaFilterSettings == null) {
return null;
}
String settingsDefaultId = cubaFilterSettings.getDefaultFilterId();
if (StringUtils.isBlank(settingsDefaultId)) {
return null;
}
UUID defaultId = null;
try {
defaultId = UUID.fromString(settingsDefaultId);
} catch (IllegalArgumentException ex) {
// do nothing
}
if (defaultId != null) {
for (FilterEntity filter : filters) {
if (defaultId.equals(filter.getId())) {
filter.setIsDefault(true);
filter.setApplyDefault(cubaFilterSettings.getApplyDefault());
return filter;
}
}
}
return null;
}
use of com.haulmont.cuba.settings.component.CubaFilterSettings in project jmix by jmix-framework.
the class CubaFilterSettingsBinder method saveSettings.
@Override
public boolean saveSettings(Filter component, SettingsWrapper wrapper) {
CubaFilterSettings settings = wrapper.getSettings();
if (!isSettingsChanged(component, settings)) {
return false;
}
FilterDelegate delegate = getFilterDelegate(component);
if (isMaxResultsLayoutVisible(delegate)) {
settings.setMaxResults(getMaxResultsValue(delegate));
}
settings.setGroupBoxExpanded(component.isExpanded());
FilterEntity defaultFilter = getDefaultFilter(delegate);
if (defaultFilter == null) {
settings.setDefaultFilterId(null);
settings.setApplyDefault(null);
} else {
settings.setDefaultFilterId(defaultFilter.getId().toString());
settings.setApplyDefault(defaultFilter.getApplyDefault());
}
return true;
}
Aggregations