Package io.jmix.ui.settings.facet
Class ScreenSettingsFacetImpl
java.lang.Object
io.jmix.ui.component.impl.AbstractFacet
io.jmix.ui.settings.facet.ScreenSettingsFacetImpl
- All Implemented Interfaces:
Facet
,ScreenSettingsFacet
,ScreenSettingsFacetResolver.AfterShowEventHandler
public class ScreenSettingsFacetImpl
extends AbstractFacet
implements ScreenSettingsFacet, ScreenSettingsFacetResolver.AfterShowEventHandler
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jmix.ui.settings.facet.ScreenSettingsFacet
ScreenSettingsFacet.SettingsContext
-
Field Summary
Modifier and TypeFieldDescriptionprotected Subscription
protected Subscription
protected Consumer<ScreenSettingsFacet.SettingsContext>
protected Consumer<ScreenSettingsFacet.SettingsContext>
protected boolean
protected org.springframework.beans.factory.BeanFactory
protected Subscription
protected boolean
protected Consumer<ScreenSettingsFacet.SettingsContext>
protected ScreenSettings
protected ScreenSettingsFacetResolver
protected ScreenSettingsManager
Fields inherited from class io.jmix.ui.component.impl.AbstractFacet
id, owner
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addComponentIds
(String... ids) Adds component ids that should be handled whenScreenSettingsFacet.isAuto()
returns false.protected void
applyDataLoadingScreenSettings
(Collection<Component> components) void
Applies data loading settings.void
applyDataLoadingSettings
(Collection<Component> components) Applies data loading settings for the components collection.protected void
applyScreenSettings
(Collection<Component> components) void
Applies screen settings.void
applySettings
(Collection<Component> components) Applies screen settings for the components collection.protected void
void
excludeComponentIds
(String... ids) Adds component ids that should be excluded from applying and saving settings.protected Collection<Component>
fillComponents
(Collection<Component> components) protected Collection<Component>
fillWithInnerComponents
(Collection<Component> components, HasInnerComponents hasInnerComponents) protected Collection<Component>
filterByManagedComponents
(Collection<Component> components) Collection depends onScreenSettingsFacet.isAuto()
property.protected Screen
boolean
isAuto()
protected boolean
protected void
void
protected void
protected void
saveScreenSettings
(Collection<Component> components) void
Saves and persist settings.void
saveSettings
(Collection<Component> components) Saves and persist settings for the components collection.void
Sets apply data loading settings delegate.void
Sets apply settings delegate.void
setAuto
(boolean auto) Set to true if facet should apply and save settings for all supported component in the screen.void
void
Set save settings delegate.protected void
protected void
Methods inherited from class io.jmix.ui.component.impl.AbstractFacet
getEventHub, getId, getOwner, hasSubscriptions, publish, setId, unsubscribe
-
Field Details
-
componentIds
-
excludedComponentIds
-
auto
protected boolean auto -
isAfterShowHandled
protected boolean isAfterShowHandled -
screenSettings
-
applySettingsDelegate
-
applyDataLoadingSettingsDelegate
-
saveSettingsDelegate
-
beforeShowSubscription
-
afterShowSubscription
-
afterDetachedSubscription
-
settingsManager
-
settingsFacetResolver
-
beanFactory
@Autowired protected org.springframework.beans.factory.BeanFactory beanFactory
-
-
Constructor Details
-
ScreenSettingsFacetImpl
public ScreenSettingsFacetImpl()
-
-
Method Details
-
getSettings
- Specified by:
getSettings
in interfaceScreenSettingsFacet
- Returns:
- screen settings or
null
if facet is not attached to the screen
-
applySettings
public void applySettings()Description copied from interface:ScreenSettingsFacet
Applies screen settings. By default facet applies setting onScreen.AfterShowEvent
.- Specified by:
applySettings
in interfaceScreenSettingsFacet
-
applySettings
Description copied from interface:ScreenSettingsFacet
Applies screen settings for the components collection. Window must contains these components, otherwise they will be ignored.- Specified by:
applySettings
in interfaceScreenSettingsFacet
- Parameters:
components
- components to apply
-
applyDataLoadingSettings
public void applyDataLoadingSettings()Description copied from interface:ScreenSettingsFacet
Applies data loading settings. By default facet applies data loading settings onScreen.BeforeShowEvent
.- Specified by:
applyDataLoadingSettings
in interfaceScreenSettingsFacet
-
applyDataLoadingSettings
Description copied from interface:ScreenSettingsFacet
Applies data loading settings for the components collection. Window must contains these components, otherwise they will be ignored.- Specified by:
applyDataLoadingSettings
in interfaceScreenSettingsFacet
- Parameters:
components
- components to apply
-
saveSettings
public void saveSettings()Description copied from interface:ScreenSettingsFacet
Saves and persist settings. By default facet saves settings onScreen.AfterDetachEvent
.- Specified by:
saveSettings
in interfaceScreenSettingsFacet
-
saveSettings
Description copied from interface:ScreenSettingsFacet
Saves and persist settings for the components collection. Window must contains these components, otherwise they will be ignored.- Specified by:
saveSettings
in interfaceScreenSettingsFacet
- Parameters:
components
- components to save
-
isAuto
public boolean isAuto()- Specified by:
isAuto
in interfaceScreenSettingsFacet
- Returns:
- true if facet should apply and save settings for all supported component in the screen. False by default.
-
setAuto
public void setAuto(boolean auto) Description copied from interface:ScreenSettingsFacet
Set to true if facet should apply and save settings for all supported component in the screen. False by default.- Specified by:
setAuto
in interfaceScreenSettingsFacet
- Parameters:
auto
- whether facet should include all components for saving settings
-
addComponentIds
Description copied from interface:ScreenSettingsFacet
Adds component ids that should be handled whenScreenSettingsFacet.isAuto()
returns false.Note, component must be attached to the Window, otherwise it will be ignored.
- Specified by:
addComponentIds
in interfaceScreenSettingsFacet
- Parameters:
ids
- component ids
-
getComponentIds
- Specified by:
getComponentIds
in interfaceScreenSettingsFacet
- Returns:
- set of component ids that should be handled when
ScreenSettingsFacet.isAuto()
returns false.
-
excludeComponentIds
Description copied from interface:ScreenSettingsFacet
Adds component ids that should be excluded from applying and saving settings. Excluding is applied despiteScreenSettingsFacet.isAuto()
mode and has priority over explicitly added component idsScreenSettingsFacet.addComponentIds(String...)
.- Specified by:
excludeComponentIds
in interfaceScreenSettingsFacet
- Parameters:
ids
- component ids to exclude
-
getExcludedComponentIds
- Specified by:
getExcludedComponentIds
in interfaceScreenSettingsFacet
- Returns:
- set of component ids that should be excluded from applying and saving settings.
-
getComponents
Description copied from interface:ScreenSettingsFacet
Collection depends onScreenSettingsFacet.isAuto()
property. IfScreenSettingsFacet.isAuto()
returns true collection will be filled byWindow
's components, otherwise collection will be filled by components were added byScreenSettingsFacet.addComponentIds(String...)
.- Specified by:
getComponents
in interfaceScreenSettingsFacet
- Returns:
- components collection that is used for applying and saving settings.
-
getApplySettingsDelegate
- Specified by:
getApplySettingsDelegate
in interfaceScreenSettingsFacet
- Returns:
- apply settings delegate or
null
if not set
-
setApplySettingsDelegate
Description copied from interface:ScreenSettingsFacet
Sets apply settings delegate. It will replace default behavior of facet and will be invoked onScreen.AfterShowEvent
.Note, it also will be invoked when lazy tab from
TabSheet
orAccordion
is opened.For instance:
@Install(to = "settingsFacet", subject = "applySettingsDelegate") private void onApplySettings(ScreenSettingsFacet.SettingsContext settingsContext) { settingsFacet.applySettings(); }
- Specified by:
setApplySettingsDelegate
in interfaceScreenSettingsFacet
- Parameters:
delegate
- apply settings delegate
-
getApplyDataLoadingSettingsDelegate
- Specified by:
getApplyDataLoadingSettingsDelegate
in interfaceScreenSettingsFacet
- Returns:
- apply data loading settings delegate or
null
if not set
-
setApplyDataLoadingSettingsDelegate
public void setApplyDataLoadingSettingsDelegate(Consumer<ScreenSettingsFacet.SettingsContext> delegate) Description copied from interface:ScreenSettingsFacet
Sets apply data loading settings delegate. It will replace default behavior of facet and will be invoked onScreen.BeforeShowEvent
.For instance:
@Install(to = "settingsFacet", subject = "applyDataLoadingSettingsDelegate") private void onApplyDataLoadingSettings(ScreenSettingsFacet.SettingsContext settingsContext) { settingsFacet.applyDataLoadingSettings(); }
- Specified by:
setApplyDataLoadingSettingsDelegate
in interfaceScreenSettingsFacet
- Parameters:
delegate
- apply settings delegate
-
getSaveSettingsDelegate
- Specified by:
getSaveSettingsDelegate
in interfaceScreenSettingsFacet
- Returns:
- save settings delegate or
null
if not set
-
setSaveSettingsDelegate
Description copied from interface:ScreenSettingsFacet
Set save settings delegate. It will replace default behavior of facet and will be invoked onScreen.AfterDetachEvent
.For instance:
@Install(to = "settingsFacet", subject = "saveSettingsDelegate") private void onSaveSettings(ScreenSettingsFacet.SettingsContext settingsContext) { settingsFacet.saveSettings(); }
- Specified by:
setSaveSettingsDelegate
in interfaceScreenSettingsFacet
- Parameters:
delegate
- save settings delegate
-
setOwner
Description copied from interface:Facet
- Specified by:
setOwner
in interfaceFacet
- Overrides:
setOwner
in classAbstractFacet
- Parameters:
owner
- owner frame
-
subscribe
protected void subscribe() -
unsubscribe
protected void unsubscribe() -
getScreenOwner
-
onBeforeShowEvent
-
onAfterShowEvent
- Specified by:
onAfterShowEvent
in interfaceScreenSettingsFacetResolver.AfterShowEventHandler
-
onAfterDetachEvent
-
applyScreenSettings
-
applyDataLoadingScreenSettings
-
saveScreenSettings
-
isSettingsEnabled
protected boolean isSettingsEnabled() -
filterByManagedComponents
-
checkAttachedFrame
protected void checkAttachedFrame() -
fillComponents
-
fillWithInnerComponents
protected Collection<Component> fillWithInnerComponents(Collection<Component> components, HasInnerComponents hasInnerComponents)
-