Search in sources :

Example 1 with ComponentSettings

use of io.jmix.ui.settings.component.ComponentSettings 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 ComponentSettings

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

the class LegacySettingsDelegate method saveSettings.

@Override
public boolean saveSettings(Element element) {
    if (!isSettingsEnabled()) {
        return false;
    }
    ComponentSettings settings = settingsConverter.convertToComponentSettings(element);
    boolean modified = settingsBinder.saveSettings(component, new SettingsWrapperImpl(settings));
    if (modified)
        settingsConverter.copyToElement(settings, element);
    return modified;
}
Also used : ComponentSettings(io.jmix.ui.settings.component.ComponentSettings) SettingsWrapperImpl(io.jmix.ui.settings.component.SettingsWrapperImpl)

Example 3 with ComponentSettings

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

the class AbstractTable method getSettingsFromPresentation.

protected ComponentSettings getSettingsFromPresentation(TablePresentation p) {
    Class<? extends ComponentSettings> settingsClass = getSettingsBinder().getSettingsClass();
    ComponentSettings settings = SettingsHelper.createSettings(settingsClass, getId());
    String settingsString = presentations.getSettingsString(p);
    if (settingsString != null) {
        ComponentSettings convertedSettings = SettingsHelper.toComponentSettings(settingsString, settingsClass);
        if (convertedSettings != null) {
            settings = convertedSettings;
        }
    }
    return settings;
}
Also used : ComponentSettings(io.jmix.ui.settings.component.ComponentSettings)

Example 4 with ComponentSettings

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

the class PresentationsManagerImpl method setupDefaultSettings.

@Override
public void setupDefaultSettings(Collection<Component> components) {
    for (Component component : components) {
        if (Strings.isNullOrEmpty(component.getId()) || !settingsRegistry.isSettingsRegisteredFor(component.getClass()) || !(component instanceof HasTablePresentations)) {
            continue;
        }
        ComponentSettingsBinder binder = settingsRegistry.getSettingsBinder(component.getClass());
        ComponentSettings defaultSettings = binder.getSettings(component);
        ((HasTablePresentations) component).setDefaultSettings(new SettingsWrapperImpl(defaultSettings));
    }
}
Also used : ComponentSettings(io.jmix.ui.settings.component.ComponentSettings) SettingsWrapperImpl(io.jmix.ui.settings.component.SettingsWrapperImpl) Component(io.jmix.ui.component.Component) HasTablePresentations(io.jmix.ui.component.HasTablePresentations) ComponentSettingsBinder(io.jmix.ui.settings.component.binder.ComponentSettingsBinder)

Example 5 with ComponentSettings

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

the class ScreenSettingsManagerImpl method applySettings.

@Override
public void applySettings(Collection<Component> components, ScreenSettings screenSettings) {
    Preconditions.checkNotNullArgument(components);
    Preconditions.checkNotNullArgument(screenSettings);
    for (Component component : components) {
        if (Strings.isNullOrEmpty(component.getId()) || !settingsRegistry.isSettingsRegisteredFor(component.getClass())) {
            continue;
        }
        log.trace("Applying settings for {} : {} ", getComponentPath(component), component);
        ComponentSettingsBinder binder = settingsRegistry.getSettingsBinder(component.getClass());
        Class<? extends ComponentSettings> settingsClass = settingsRegistry.getSettingsClass(component.getClass());
        ComponentSettings settings = screenSettings.getSettingsOrCreate(component.getId(), settingsClass);
        binder.applySettings(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) ComponentSettingsBinder(io.jmix.ui.settings.component.binder.ComponentSettingsBinder)

Aggregations

ComponentSettings (io.jmix.ui.settings.component.ComponentSettings)12 SettingsWrapperImpl (io.jmix.ui.settings.component.SettingsWrapperImpl)11 Component (io.jmix.ui.component.Component)4 ComponentSettingsBinder (io.jmix.ui.settings.component.binder.ComponentSettingsBinder)4 DataLoadingSettingsBinder (io.jmix.ui.settings.component.binder.DataLoadingSettingsBinder)3 HasTablePresentations (io.jmix.ui.component.HasTablePresentations)2 AbstractScreenSettings (io.jmix.ui.settings.AbstractScreenSettings)1