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 ClassesNested classes/interfaces inherited from interface io.jmix.flowui.facet.SettingsFacet
SettingsFacet.SettingsContext -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Consumer<SettingsFacet.SettingsContext>protected Consumer<SettingsFacet.SettingsContext>protected booleanprotected SettingsFacetImpl.ViewEventListenerprotected SettingsFacetImpl.ViewEventListenerprotected SettingsFacetImpl.ViewEventListenerprotected ReflectionCacheManagerprotected Consumer<SettingsFacet.SettingsContext>protected SettingsFacetUrlQueryParametersHelperprotected ViewSettingsComponentManagerprotected UserSettingsCacheprotected com.vaadin.flow.router.QueryParametersprotected ViewSettingsFields inherited from class io.jmix.flowui.facet.impl.AbstractFacet
id, owner -
Constructor Summary
ConstructorsConstructorDescriptionSettingsFacetImpl(SettingsFacetUrlQueryParametersHelper settingsHelper, ReflectionCacheManager reflectionCacheManager, UserSettingsCache userSettingsCache, ViewSettingsComponentManager settingsManager, UserSettingsService userSettingsService) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddComponentIds(String... ids) Adds component ids that should be managed whenSettingsFacet.isAuto()returnsfalse.voidaddExcludedComponentIds(String... ids) Adds component ids that should be excluded from applying and saving settings.voidRestores settings that related with data loading.protected voidapplyDataLoadingViewSettings(Collection<com.vaadin.flow.component.Component> components) voidRestores settings for components.protected voidapplyViewSettings(Collection<com.vaadin.flow.component.Component> components) protected voidprotected SettingsFacet.SettingsContextprotected ViewSettingscreateViewSettings(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 voidinitViewSettings(ViewSettings viewSettings) booleanisAuto()protected booleanprotected voidonQueryParametersChange(com.vaadin.flow.component.ComponentEvent<?> event) protected voidonViewBeforeShow(com.vaadin.flow.component.ComponentEvent<?> event) protected voidonViewDetach(com.vaadin.flow.component.ComponentEvent<?> event) protected voidonViewReady(com.vaadin.flow.component.ComponentEvent<?> event) voidPersists settings to store.protected voidsaveViewSettings(Collection<com.vaadin.flow.component.Component> components) voidSets handler that should be invoked instead of default facet's logic for applying data loading settings.voidSets handler that should be invoked instead of default facet's logic for applying settings.voidsetAuto(boolean auto) Defines in which mode facet will work.voidvoidSets handler that should be invoked instead of default facet's logic for saving settings.protected voidprotected voidMethods 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, UserSettingsCache userSettingsCache, ViewSettingsComponentManager settingsManager, @Nullable UserSettingsService userSettingsService)
-
-
Method Details
-
isAuto
public boolean isAuto()- Specified by:
isAutoin interfaceSettingsFacet- Returns:
- the mode in which facet is worked.
trueif facet includes all components andfalseif only specified components bySettingsFacet.addComponentIds(String...)will be managed.
-
setAuto
public void setAuto(boolean auto) Description copied from interface:SettingsFacetDefines in which mode facet will work. If 'auto' is set totrueit means that all components that contain an id and haveComponentSettingsBinderwill 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:
setAutoin interfaceSettingsFacet- Parameters:
auto- whether facet should include all components
-
getSettings
- Specified by:
getSettingsin interfaceSettingsFacet- Returns:
Viewsettings ornullif facet is not attached to theView
-
applySettings
public void applySettings()Description copied from interface:SettingsFacetRestores settings for components. Facet applies settings onView'sView.ReadyEvent.- Specified by:
applySettingsin interfaceSettingsFacet
-
applyDataLoadingSettings
public void applyDataLoadingSettings()Description copied from interface:SettingsFacetRestores settings that related with data loading. For instance, it applies sort columns and its direction inDataGridbefore data loading.Facet applies data loading settings on
View'sView.BeforeShowEvent.- Specified by:
applyDataLoadingSettingsin interfaceSettingsFacet
-
saveSettings
public void saveSettings()Description copied from interface:SettingsFacetPersists settings to store. Facet saves settings onView'sDetachEvent.- Specified by:
saveSettingsin interfaceSettingsFacet
-
addComponentIds
Description copied from interface:SettingsFacetAdds component ids that should be managed whenSettingsFacet.isAuto()returnsfalse.Note, component must be attached to the
View, otherwise it will be ignored.- Specified by:
addComponentIdsin interfaceSettingsFacet- Parameters:
ids- component ids
-
getComponentIds
- Specified by:
getComponentIdsin interfaceSettingsFacet- Returns:
- set of component ids that should be handled when
SettingsFacet.isAuto()returnsfalse
-
addExcludedComponentIds
Description copied from interface:SettingsFacetAdds 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:
addExcludedComponentIdsin interfaceSettingsFacet- Parameters:
ids- component ids to exclude
-
getExcludedComponentIds
- Specified by:
getExcludedComponentIdsin interfaceSettingsFacet- Returns:
- set of component ids that should be excluded from applying and saving settings
-
getManagedComponents
Description copied from interface:SettingsFacetCollection 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:
getManagedComponentsin interfaceSettingsFacet- Returns:
- components collection that is used for applying and saving settings
-
getApplySettingsDelegate
- Specified by:
getApplySettingsDelegatein interfaceSettingsFacet- Returns:
- apply settings delegate or
nullif not set
-
setApplySettingsDelegate
Description copied from interface:SettingsFacetSets 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:
setApplySettingsDelegatein interfaceSettingsFacet- Parameters:
delegate- handler to set
-
getApplyDataLoadingSettingsDelegate
- Specified by:
getApplyDataLoadingSettingsDelegatein interfaceSettingsFacet- Returns:
- apply data loading settings delegate or
nullif not set
-
setApplyDataLoadingSettingsDelegate
public void setApplyDataLoadingSettingsDelegate(@Nullable Consumer<SettingsFacet.SettingsContext> delegate) Description copied from interface:SettingsFacetSets 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:
setApplyDataLoadingSettingsDelegatein interfaceSettingsFacet- Parameters:
delegate- handler to set
-
getSaveSettingsDelegate
- Specified by:
getSaveSettingsDelegatein interfaceSettingsFacet- Returns:
- save settings delegate or
nullif not set
-
setSaveSettingsDelegate
Description copied from interface:SettingsFacetSets 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:
setSaveSettingsDelegatein interfaceSettingsFacet- Parameters:
delegate- handler to set
-
setOwner
- Specified by:
setOwnerin interfaceFacet- Overrides:
setOwnerin 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
-