Search in sources :

Example 1 with DataLoadingSettingsBinder

use of io.jmix.ui.settings.component.binder.DataLoadingSettingsBinder in project jmix by jmix-framework.

the class LegacySettingsDelegate method applyDataLoadingSettings.

@Override
public void applyDataLoadingSettings(Element element) {
    if (!isSettingsEnabled()) {
        return;
    }
    ComponentSettings settings = settingsConverter.convertToComponentSettings(element);
    ((DataLoadingSettingsBinder) settingsBinder).applyDataLoadingSettings(component, new SettingsWrapperImpl(settings));
}
Also used : ComponentSettings(io.jmix.ui.settings.component.ComponentSettings) SettingsWrapperImpl(io.jmix.ui.settings.component.SettingsWrapperImpl) DataLoadingSettingsBinder(io.jmix.ui.settings.component.binder.DataLoadingSettingsBinder)

Example 2 with DataLoadingSettingsBinder

use of io.jmix.ui.settings.component.binder.DataLoadingSettingsBinder in project jmix by jmix-framework.

the class AbstractTable method resetPresentation.

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void resetPresentation() {
    if (defaultTableSettings != null) {
        DataLoadingSettingsBinder binder = (DataLoadingSettingsBinder) getSettingsBinder();
        binder.applySettings(this, new SettingsWrapperImpl(defaultTableSettings));
        binder.applyDataLoadingSettings(this, new SettingsWrapperImpl(defaultTableSettings));
        if (presentations != null) {
            presentations.setCurrent(null);
        }
    }
}
Also used : SettingsWrapperImpl(io.jmix.ui.settings.component.SettingsWrapperImpl) DataLoadingSettingsBinder(io.jmix.ui.settings.component.binder.DataLoadingSettingsBinder)

Example 3 with DataLoadingSettingsBinder

use of io.jmix.ui.settings.component.binder.DataLoadingSettingsBinder in project jmix by jmix-framework.

the class ScreenSettingsManagerImpl method applyDataLoadingSettings.

@Override
public void applyDataLoadingSettings(Collection<Component> components, ScreenSettings screenSettings) {
    Preconditions.checkNotNullArgument(components);
    Preconditions.checkNotNullArgument(screenSettings);
    for (Component component : components) {
        if (!settingsRegistry.isSettingsRegisteredFor(component.getClass()) || component.getId() == null) {
            continue;
        }
        log.trace("Applying settings for {} : {} ", getComponentPath(component), component);
        Class<? extends ComponentSettings> settingsClass = settingsRegistry.getSettingsClass(component.getClass());
        ComponentSettingsBinder binder = settingsRegistry.getSettingsBinder(component.getClass());
        if (binder instanceof DataLoadingSettingsBinder) {
            ComponentSettings settings = screenSettings.getSettingsOrCreate(component.getId(), settingsClass);
            ((DataLoadingSettingsBinder) binder).applyDataLoadingSettings(component, new SettingsWrapperImpl(settings));
        }
    }
}
Also used : ComponentSettings(io.jmix.ui.settings.component.ComponentSettings) SettingsWrapperImpl(io.jmix.ui.settings.component.SettingsWrapperImpl) Component(io.jmix.ui.component.Component) DataLoadingSettingsBinder(io.jmix.ui.settings.component.binder.DataLoadingSettingsBinder) ComponentSettingsBinder(io.jmix.ui.settings.component.binder.ComponentSettingsBinder)

Example 4 with DataLoadingSettingsBinder

use of io.jmix.ui.settings.component.binder.DataLoadingSettingsBinder in project jmix by jmix-framework.

the class AbstractTable method applyPresentationSettings.

@SuppressWarnings({ "rawtypes", "unchecked" })
protected void applyPresentationSettings(TablePresentation p) {
    ComponentSettings settings = getSettingsFromPresentation(p);
    DataLoadingSettingsBinder binder = (DataLoadingSettingsBinder) getSettingsBinder();
    binder.applySettings(this, new SettingsWrapperImpl(settings));
    binder.applyDataLoadingSettings(this, new SettingsWrapperImpl(settings));
}
Also used : ComponentSettings(io.jmix.ui.settings.component.ComponentSettings) SettingsWrapperImpl(io.jmix.ui.settings.component.SettingsWrapperImpl) DataLoadingSettingsBinder(io.jmix.ui.settings.component.binder.DataLoadingSettingsBinder)

Aggregations

SettingsWrapperImpl (io.jmix.ui.settings.component.SettingsWrapperImpl)4 DataLoadingSettingsBinder (io.jmix.ui.settings.component.binder.DataLoadingSettingsBinder)4 ComponentSettings (io.jmix.ui.settings.component.ComponentSettings)3 Component (io.jmix.ui.component.Component)1 ComponentSettingsBinder (io.jmix.ui.settings.component.binder.ComponentSettingsBinder)1