Interface ScreenSettingsFacet

All Superinterfaces:
Facet
All Known Implementing Classes:
ScreenSettingsFacetImpl

@StudioFacet(xmlElement="screenSettings", caption="ScreenSettings", category="Facets", description="Provides ability to save and apply component settings", defaultProperty="auto", icon="io/jmix/ui/icon/facet/screenSettings.svg", documentationURL="https://docs.jmix.io/jmix/%VERSION%/ui/facets/screen-settings-facet.html") public interface ScreenSettingsFacet extends Facet
Provides ability to save and apply component settings.
See Also:
  • Method Details

    • isAuto

      boolean isAuto()
      Returns:
      true if facet should apply and save settings for all supported component in the screen. False by default.
    • setAuto

      @StudioProperty(defaultValue="false", initialValue="true") void setAuto(boolean auto)
      Set to true if facet should apply and save settings for all supported component in the screen. False by default.
      Parameters:
      auto - whether facet should include all components for saving settings
    • addComponentIds

      void addComponentIds(String... ids)
      Adds component ids that should be handled when isAuto() returns false.

      Note, component must be attached to the Window, otherwise it will be ignored.

      Parameters:
      ids - component ids
    • getComponentIds

      Set<String> getComponentIds()
      Returns:
      set of component ids that should be handled when isAuto() returns false.
    • excludeComponentIds

      void excludeComponentIds(String... ids)
      Adds component ids that should be excluded from applying and saving settings. Excluding is applied despite isAuto() mode and has priority over explicitly added component ids addComponentIds(String...).
      Parameters:
      ids - component ids to exclude
    • getExcludedComponentIds

      Set<String> getExcludedComponentIds()
      Returns:
      set of component ids that should be excluded from applying and saving settings.
    • getComponents

      Collection<Component> getComponents()
      Collection depends on isAuto() property. If isAuto() returns true collection will be filled by Window's components, otherwise collection will be filled by components were added by addComponentIds(String...).
      Returns:
      components collection that is used for applying and saving settings.
    • getSettings

      @Nullable ScreenSettings getSettings()
      Returns:
      screen settings or null if facet is not attached to the screen
    • applySettings

      void applySettings()
      Applies screen settings. By default facet applies setting on Screen.AfterShowEvent.
    • applySettings

      void applySettings(Collection<Component> components)
      Applies screen settings for the components collection. Window must contains these components, otherwise they will be ignored.
      Parameters:
      components - components to apply
    • applyDataLoadingSettings

      void applyDataLoadingSettings()
      Applies data loading settings. By default facet applies data loading settings on Screen.BeforeShowEvent.
    • applyDataLoadingSettings

      void applyDataLoadingSettings(Collection<Component> components)
      Applies data loading settings for the components collection. Window must contains these components, otherwise they will be ignored.
      Parameters:
      components - components to apply
    • saveSettings

      void saveSettings()
      Saves and persist settings. By default facet saves settings on Screen.AfterDetachEvent.
    • saveSettings

      void saveSettings(Collection<Component> components)
      Saves and persist settings for the components collection. Window must contains these components, otherwise they will be ignored.
      Parameters:
      components - components to save
    • getApplySettingsDelegate

      @Nullable Consumer<ScreenSettingsFacet.SettingsContext> getApplySettingsDelegate()
      Returns:
      apply settings delegate or null if not set
    • setApplySettingsDelegate

      void setApplySettingsDelegate(Consumer<ScreenSettingsFacet.SettingsContext> delegate)
      Sets apply settings delegate. It will replace default behavior of facet and will be invoked on Screen.AfterShowEvent.

      Note, it also will be invoked when lazy tab from TabSheet or Accordion is opened.

      For instance:

       @Install(to = "settingsFacet", subject = "applySettingsDelegate")
       private void onApplySettings(ScreenSettingsFacet.SettingsContext settingsContext) {
           settingsFacet.applySettings();
       }
       
      Parameters:
      delegate - apply settings delegate
    • getApplyDataLoadingSettingsDelegate

      @Nullable Consumer<ScreenSettingsFacet.SettingsContext> getApplyDataLoadingSettingsDelegate()
      Returns:
      apply data loading settings delegate or null if not set
    • setApplyDataLoadingSettingsDelegate

      void setApplyDataLoadingSettingsDelegate(Consumer<ScreenSettingsFacet.SettingsContext> delegate)
      Sets apply data loading settings delegate. It will replace default behavior of facet and will be invoked on Screen.BeforeShowEvent.

      For instance:

       @Install(to = "settingsFacet", subject = "applyDataLoadingSettingsDelegate")
       private void onApplyDataLoadingSettings(ScreenSettingsFacet.SettingsContext settingsContext) {
           settingsFacet.applyDataLoadingSettings();
       }
       
      Parameters:
      delegate - apply settings delegate
    • getSaveSettingsDelegate

      @Nullable Consumer<ScreenSettingsFacet.SettingsContext> getSaveSettingsDelegate()
      Returns:
      save settings delegate or null if not set
    • setSaveSettingsDelegate

      void setSaveSettingsDelegate(Consumer<ScreenSettingsFacet.SettingsContext> delegate)
      Set save settings delegate. It will replace default behavior of facet and will be invoked on Screen.AfterDetachEvent.

      For instance:

       @Install(to = "settingsFacet", subject = "saveSettingsDelegate")
       private void onSaveSettings(ScreenSettingsFacet.SettingsContext settingsContext) {
           settingsFacet.saveSettings();
       }
       
      Parameters:
      delegate - save settings delegate