ScreenSettingsFacet

ScreenSettingsFacet is a facet that saves the settings that the user has set for visual components.

Component’s XML-name: screenSettings.

Basics

ScreenSettingsFacet is defined in the facets element of the screen XML descriptor.

To enable screen settings saving for all components on the screen, you can set the auto attribute to true:

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

If you have specific components to enable screen settings saving, you can configure your facet like this:

<facets>
    <screenSettings id="settingsFacet">
        <components>
            <component id="carsTable"/>
        </components>
    </screenSettings>
</facets>
<layout expand="carsTable" spacing="true">
    <groupTable id="carsTable"
                width="100%"
                dataContainer="carsDc">
        <!-- ... -->
    </groupTable>
</layout>

Events and Handlers

To generate a handler stub in Jmix Studio, select the facet in the screen descriptor XML or in the Component Hierarchy panel and use the Handlers tab of the Component Inspector panel.

Alternatively, you can use the Generate Handler button in the top panel of the screen controller.

ScreenSettingsFacet has three delegates for the screen settings lifecycle.

ApplySettingsDelegate

This handler allows you to save the states of the components on AfterShowEvent.

@Autowired
private ScreenSettingsFacet settingsFacet;
@Autowired
private GroupTable<Car> carsTable;

@Install(to = "settingsFacet", subject = "applySettingsDelegate")
private void settingsFacetApplySettingsDelegate(ScreenSettingsFacet.SettingsContext settingsContext) {
    settingsContext.getScreenSettings()
            .getBoolean("carsTable", "visibility")
            .ifPresent(visibility -> carsTable.setVisible(visibility));

    settingsFacet.applySettings();
}

Programmatic usage: call the setApplySettingsDelegate() component method.

ApplyDataLoadingSettingsDelegate

This handler allows you to save the states of the components on BeforeShowEvent.

Programmatic usage: call the setApplyDataLoadingSettingsDelegate() component method.

SaveSettingsDelegate

This handler allows you to save the states of the components on AfterDetachEvent.

Programmatic usage: call the setSaveSettingsDelegate() component method.

All XML Attributes

You can view and edit attributes applicable to the facet using the Component Inspector panel of the Studio’s Screen Designer.

auto - id