settings

The settings facet saves and restores settings of visual components for the current user. The following components are supported:

Basic Usage

When added to a view with the auto="true" attribute, the facet manages settings of all supported components of the view that have identifiers:

<facets>
    <settings auto="true"/>
</facets>

To manage settings of a particular component, use the nested component elements, for example:

<facets>
    <settings>
        <component id="citiesDataGrid"/>
    </settings>
</facets>

To exclude some component, use auto="true" for the facet and enabled="false" for the component:

<facets>
    <settings auto="true">
        <component id="hobbiesDataGrid" enabled="false"/>
    </settings>
</facets>

The settings are stored in the main data store in the FLOWUI_USER_SETTINGS table in JSON format. You can manage the saved settings by opening the flowui_UserSettingsItem entity in the Entity Inspector.

Handlers

To generate a handler stub in Jmix Studio, use the Handlers tab of the Jmix UI inspector panel or the Generate Handler action available in the top panel of the view class and through the CodeGenerate menu (Alt+Insert / Cmd+N).

applySettingsDelegate

applySettingsDelegate is invoked before the view ReadyEvent handler.

@ViewComponent
private JmixCheckbox checkbox;

@ViewComponent
private SettingsFacet settings;

@Install(to = "settings", subject = "applySettingsDelegate")
private void settingsApplySettingsDelegate(final SettingsFacet.SettingsContext settingsContext) {
    settings.applySettings();
    Optional<Boolean> value = settingsContext.getViewSettings().getBoolean("checkbox", "value");
    checkbox.setValue(value.orElse(Boolean.FALSE));
}

applyDataLoadingSettingsDelegate

applyDataLoadingSettingsDelegate is invoked before the view BeforeShowEvent handler and allows you to restore settings related to data loading.

saveSettingsDelegate

The saveSettingsDelegate handler is invoked before the view DetachEvent handler.

@ViewComponent
private JmixCheckbox checkbox;

@ViewComponent
private SettingsFacet settings;

@Install(to = "settings", subject = "saveSettingsDelegate")
private void settingsSaveSettingsDelegate(final SettingsFacet.SettingsContext settingsContext) {
    settingsContext.getViewSettings().put("testCheckbox", "value", checkbox.getValue());
    settings.saveSettings();
}