Package io.jmix.flowui.facet.impl
Class SettingsFacetImpl
java.lang.Object
io.jmix.flowui.facet.impl.AbstractFacet
io.jmix.flowui.facet.impl.SettingsFacetImpl
- All Implemented Interfaces:
Facet
,SettingsFacet
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jmix.flowui.facet.SettingsFacet
SettingsFacet.SettingsContext
-
Field Summary
Modifier and TypeFieldDescriptionprotected Consumer<SettingsFacet.SettingsContext>
protected Consumer<SettingsFacet.SettingsContext>
protected boolean
protected SettingsFacetImpl.ViewEventListener
protected SettingsFacetImpl.ViewEventListener
protected SettingsFacetImpl.ViewEventListener
protected ReflectionCacheManager
protected Consumer<SettingsFacet.SettingsContext>
protected SettingsFacetUrlQueryParametersHelper
protected ViewSettingsComponentManager
protected UserSettingsCache
protected com.vaadin.flow.router.QueryParameters
protected ViewSettings
Fields inherited from class io.jmix.flowui.facet.impl.AbstractFacet
id, owner
-
Constructor Summary
ConstructorDescriptionSettingsFacetImpl
(SettingsFacetUrlQueryParametersHelper settingsHelper, ReflectionCacheManager reflectionCacheManager, UserSettingsCache userSettingsCache, ViewSettingsComponentManager settingsManager) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addComponentIds
(String... ids) Adds component ids that should be managed whenSettingsFacet.isAuto()
returnsfalse
.void
addExcludedComponentIds
(String... ids) Adds component ids that should be excluded from applying and saving settings.void
Restores settings that related with data loading.protected void
applyDataLoadingViewSettings
(Collection<com.vaadin.flow.component.Component> components) void
Restores settings for components.protected void
applyViewSettings
(Collection<com.vaadin.flow.component.Component> components) protected void
protected SettingsFacet.SettingsContext
protected ViewSettings
createViewSettings
(View<?> view) protected Collection<com.vaadin.flow.component.Component>
excludeUrlQueryParametersFacetComponents
(Collection<com.vaadin.flow.component.Component> components) Collection<com.vaadin.flow.component.Component>
Collection depends onSettingsFacet.isAuto()
property.protected Collection<com.vaadin.flow.component.Component>
getManagedComponentsFromCollection
(Collection<com.vaadin.flow.component.Component> viewComponents) protected View<?>
getView()
protected void
initViewSettings
(ViewSettings viewSettings) boolean
isAuto()
protected boolean
protected void
onQueryParametersChange
(com.vaadin.flow.component.ComponentEvent<?> event) protected void
onViewBeforeShow
(com.vaadin.flow.component.ComponentEvent<?> event) protected void
onViewDetach
(com.vaadin.flow.component.ComponentEvent<?> event) protected void
onViewReady
(com.vaadin.flow.component.ComponentEvent<?> event) void
Persists settings to store.protected void
saveViewSettings
(Collection<com.vaadin.flow.component.Component> components) void
Sets handler that should be invoked instead of default facet's logic for applying data loading settings.void
Sets handler that should be invoked instead of default facet's logic for applying settings.void
setAuto
(boolean auto) Defines in which mode facet will work.void
void
Sets handler that should be invoked instead of default facet's logic for saving settings.protected void
protected void
Methods inherited from class io.jmix.flowui.facet.impl.AbstractFacet
getId, getOwner, setId
-
Field Details
-
settingsHelper
-
reflectionCacheManager
-
settingsManager
-
userSettingsCache
-
componentIds
-
excludedComponentIds
-
viewSettings
-
auto
protected boolean auto -
beforeShowListener
-
readyListener
-
detachListener
-
applySettingsDelegate
-
applyDataLoadingSettingsDelegate
-
saveSettingsDelegate
-
viewQueryParameters
protected com.vaadin.flow.router.QueryParameters viewQueryParameters
-
-
Constructor Details
-
SettingsFacetImpl
public SettingsFacetImpl(SettingsFacetUrlQueryParametersHelper settingsHelper, ReflectionCacheManager reflectionCacheManager, @Autowired(required=false) UserSettingsCache userSettingsCache, @Autowired(required=false) ViewSettingsComponentManager settingsManager)
-
-
Method Details
-
isAuto
public boolean isAuto()- Specified by:
isAuto
in interfaceSettingsFacet
- Returns:
- the mode in which facet is worked.
true
if facet includes all components andfalse
if only specified components bySettingsFacet.addComponentIds(String...)
will be managed.
-
setAuto
public void setAuto(boolean auto) Description copied from interface:SettingsFacet
Defines in which mode facet will work. If 'auto' is set totrue
it means that all components that contain an id and haveComponentSettingsBinder
will be managed by facet.If 'auto' mode is disabled (set to
false
), only specified components bySettingsFacet.addComponentIds(String...)
will be managed.The default value is
false
.- Specified by:
setAuto
in interfaceSettingsFacet
- Parameters:
auto
- whether facet should include all components
-
getSettings
- Specified by:
getSettings
in interfaceSettingsFacet
- Returns:
View
settings ornull
if facet is not attached to theView
-
applySettings
public void applySettings()Description copied from interface:SettingsFacet
Restores settings for components. Facet applies settings onView
'sView.ReadyEvent
.- Specified by:
applySettings
in interfaceSettingsFacet
-
applyDataLoadingSettings
public void applyDataLoadingSettings()Description copied from interface:SettingsFacet
Restores settings that related with data loading. For instance, it applies sort columns and its direction inDataGrid
before data loading.Facet applies data loading settings on
View
'sView.BeforeShowEvent
.- Specified by:
applyDataLoadingSettings
in interfaceSettingsFacet
-
saveSettings
public void saveSettings()Description copied from interface:SettingsFacet
Persists settings to store. Facet saves settings onView
'sDetachEvent
.- Specified by:
saveSettings
in interfaceSettingsFacet
-
addComponentIds
Description copied from interface:SettingsFacet
Adds component ids that should be managed whenSettingsFacet.isAuto()
returnsfalse
.Note, component must be attached to the
View
, otherwise it will be ignored.- Specified by:
addComponentIds
in interfaceSettingsFacet
- Parameters:
ids
- component ids
-
getComponentIds
- Specified by:
getComponentIds
in interfaceSettingsFacet
- Returns:
- set of component ids that should be handled when
SettingsFacet.isAuto()
returnsfalse
-
addExcludedComponentIds
Description copied from interface:SettingsFacet
Adds component ids that should be excluded from applying and saving settings. Excluding is applied despiteSettingsFacet.isAuto()
mode and has priority over explicitly added component idsSettingsFacet.addComponentIds(String...)
.- Specified by:
addExcludedComponentIds
in interfaceSettingsFacet
- Parameters:
ids
- component ids to exclude
-
getExcludedComponentIds
- Specified by:
getExcludedComponentIds
in interfaceSettingsFacet
- Returns:
- set of component ids that should be excluded from applying and saving settings
-
getManagedComponents
Description copied from interface:SettingsFacet
Collection depends onSettingsFacet.isAuto()
property. IfSettingsFacet.isAuto()
returnstrue
, collection will be filled byView
's components, otherwise collection will be filled by components that explicitly added bySettingsFacet.addComponentIds(String...)
.- Specified by:
getManagedComponents
in interfaceSettingsFacet
- Returns:
- components collection that is used for applying and saving settings
-
getApplySettingsDelegate
- Specified by:
getApplySettingsDelegate
in interfaceSettingsFacet
- Returns:
- apply settings delegate or
null
if not set
-
setApplySettingsDelegate
Description copied from interface:SettingsFacet
Sets handler that should be invoked instead of default facet's logic for applying settings.For instance:
@Install(to = "settingsFacet", subject = "applySettingsDelegate") private void onApplySettings(SettingsFacet.SettingsContext settingsContext) { settingsFacet.applySettings(); }
- Specified by:
setApplySettingsDelegate
in interfaceSettingsFacet
- Parameters:
delegate
- handler to set
-
getApplyDataLoadingSettingsDelegate
- Specified by:
getApplyDataLoadingSettingsDelegate
in interfaceSettingsFacet
- Returns:
- apply data loading settings delegate or
null
if not set
-
setApplyDataLoadingSettingsDelegate
public void setApplyDataLoadingSettingsDelegate(@Nullable Consumer<SettingsFacet.SettingsContext> delegate) Description copied from interface:SettingsFacet
Sets handler that should be invoked instead of default facet's logic for applying data loading settings.For instance:
@Install(to = "settingsFacet", subject = "applyDataLoadingSettingsDelegate") private void onApplyDataLoadingSettings(SettingsFacet.SettingsContext settingsContext) { settingsFacet.applyDataLoadingSettings(); }
- Specified by:
setApplyDataLoadingSettingsDelegate
in interfaceSettingsFacet
- Parameters:
delegate
- handler to set
-
getSaveSettingsDelegate
- Specified by:
getSaveSettingsDelegate
in interfaceSettingsFacet
- Returns:
- save settings delegate or
null
if not set
-
setSaveSettingsDelegate
Description copied from interface:SettingsFacet
Sets handler that should be invoked instead of default facet's logic for saving settings.For instance:
@Install(to = "settingsFacet", subject = "saveSettingsDelegate") private void onSaveSettings(SettingsFacet.SettingsContext settingsContext) { settingsFacet.saveSettings(); }
- Specified by:
setSaveSettingsDelegate
in interfaceSettingsFacet
- Parameters:
delegate
- handler to set
-
setOwner
- Specified by:
setOwner
in interfaceFacet
- Overrides:
setOwner
in classAbstractFacet
-
getManagedComponentsFromCollection
protected Collection<com.vaadin.flow.component.Component> getManagedComponentsFromCollection(Collection<com.vaadin.flow.component.Component> viewComponents) -
createViewSettings
-
initViewSettings
-
unsubscribeViewLifecycle
protected void unsubscribeViewLifecycle() -
subscribeViewLifecycle
protected void subscribeViewLifecycle() -
onViewBeforeShow
protected void onViewBeforeShow(com.vaadin.flow.component.ComponentEvent<?> event) -
onViewReady
protected void onViewReady(com.vaadin.flow.component.ComponentEvent<?> event) -
onViewDetach
protected void onViewDetach(com.vaadin.flow.component.ComponentEvent<?> event) -
onQueryParametersChange
protected void onQueryParametersChange(com.vaadin.flow.component.ComponentEvent<?> event) -
applyViewSettings
-
applyDataLoadingViewSettings
protected void applyDataLoadingViewSettings(Collection<com.vaadin.flow.component.Component> components) -
saveViewSettings
-
checkAttachedToView
protected void checkAttachedToView() -
isSettingsEnabled
protected boolean isSettingsEnabled() -
excludeUrlQueryParametersFacetComponents
protected Collection<com.vaadin.flow.component.Component> excludeUrlQueryParametersFacetComponents(Collection<com.vaadin.flow.component.Component> components) -
getView
-
createSettingsContext
-