Package io.jmix.flowui.facet.impl
Class AbstractSettingsFacet<S extends UiComponentSettings<S>>
java.lang.Object
io.jmix.flowui.facet.impl.AbstractFacet
io.jmix.flowui.facet.impl.AbstractSettingsFacet<S>
- All Implemented Interfaces:
Facet,SettingsFacet<S>
- Direct Known Subclasses:
FragmentSettingsFacetImpl,ViewSettingsFacetImpl
public abstract class AbstractSettingsFacet<S extends UiComponentSettings<S>>
extends AbstractFacet
implements SettingsFacet<S>
An abstract implementation of the
SettingsFacet interface that provides functionality
for managing and applying settings related to FacetOwner and their components.-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface io.jmix.flowui.facet.SettingsFacet
SettingsFacet.SettingsContext<S extends UiComponentSettings<S>> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Consumer<SettingsFacet.SettingsContext<S>>protected Consumer<SettingsFacet.SettingsContext<S>>protected booleanprotected Sprotected ReflectionCacheManagerprotected Consumer<SettingsFacet.SettingsContext<S>>protected SettingsFacetUrlQueryParametersHelperprotected ComponentSettingsManagerprotected UserSettingsCacheprotected com.vaadin.flow.router.QueryParametersFields inherited from class io.jmix.flowui.facet.impl.AbstractFacet
id, owner -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractSettingsFacet(SettingsFacetUrlQueryParametersHelper settingsHelper, ReflectionCacheManager reflectionCacheManager, UserSettingsCache userSettingsCache, ComponentSettingsManager 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.protected voidapplyComponentSettings(Collection<com.vaadin.flow.component.Component> components) protected voidapplyDataLoadingComponentSettings(Collection<com.vaadin.flow.component.Component> components) voidRestores settings that related with data loading.voidRestores settings for components.protected voidprotected abstract ScreateSettings(FacetOwner owner) protected SettingsFacet.SettingsContext<S>protected Collection<com.vaadin.flow.component.Component>excludeUrlQueryParametersFacetComponents(Collection<com.vaadin.flow.component.Component> components) protected abstract HasFacetsCollection<com.vaadin.flow.component.Component>Collection depends onSettingsFacet.isAuto()property.protected Collection<com.vaadin.flow.component.Component>getManagedComponentsFromCollection(Collection<com.vaadin.flow.component.Component> ownerComponents) protected com.vaadin.flow.component.Composite<?>protected voidinitSettings(S settings) booleanisAuto()protected booleanprotected voidsaveComponentSettings(Collection<com.vaadin.flow.component.Component> components) voidPersists settings to store.voidSets handler that should be invoked instead of the default facet's logic for applying data loading settings.voidSets handler that should be invoked instead of the default facet's logic for applying settings.voidsetAuto(boolean auto) Defines in which mode facet will work.<T extends com.vaadin.flow.component.Composite<?> & FacetOwner>
voidsetOwner(T owner) Sets an owner containing this facet.voidSets handler that should be invoked instead of the default facet's logic for saving settings.protected abstract voidprotected abstract voidMethods inherited from class io.jmix.flowui.facet.impl.AbstractFacet
getId, getOwner, setId
-
Field Details
-
settingsHelper
-
reflectionCacheManager
-
settingsManager
-
userSettingsCache
-
componentIds
-
excludedComponentIds
-
componentSettings
-
auto
protected boolean auto -
applySettingsDelegate
protected Consumer<SettingsFacet.SettingsContext<S extends UiComponentSettings<S>>> applySettingsDelegate -
applyDataLoadingSettingsDelegate
protected Consumer<SettingsFacet.SettingsContext<S extends UiComponentSettings<S>>> applyDataLoadingSettingsDelegate -
saveSettingsDelegate
protected Consumer<SettingsFacet.SettingsContext<S extends UiComponentSettings<S>>> saveSettingsDelegate -
viewQueryParameters
protected com.vaadin.flow.router.QueryParameters viewQueryParameters
-
-
Constructor Details
-
AbstractSettingsFacet
protected AbstractSettingsFacet(SettingsFacetUrlQueryParametersHelper settingsHelper, ReflectionCacheManager reflectionCacheManager, UserSettingsCache userSettingsCache, ComponentSettingsManager settingsManager, @Nullable UserSettingsService userSettingsService)
-
-
Method Details
-
isAuto
public boolean isAuto()- Specified by:
isAutoin interfaceSettingsFacet<S extends UiComponentSettings<S>>- 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<S extends UiComponentSettings<S>>- Parameters:
auto- whether facet should include all components
-
getSettings
- Specified by:
getSettingsin interfaceSettingsFacet<S extends UiComponentSettings<S>>- Returns:
UiComponentSettingsornullif facet is not attached to theFacetOwner
-
applySettings
public void applySettings()Description copied from interface:SettingsFacetRestores settings for components. Facet applies settings onOwner'sView.ReadyEvent.- Specified by:
applySettingsin interfaceSettingsFacet<S extends UiComponentSettings<S>>
-
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
Owner'sView.BeforeShowEvent.- Specified by:
applyDataLoadingSettingsin interfaceSettingsFacet<S extends UiComponentSettings<S>>
-
saveSettings
public void saveSettings()Description copied from interface:SettingsFacetPersists settings to store. Facet saves settings onOwner'sDetachEvent.- Specified by:
saveSettingsin interfaceSettingsFacet<S extends UiComponentSettings<S>>
-
addComponentIds
Description copied from interface:SettingsFacetAdds component ids that should be managed whenSettingsFacet.isAuto()returnsfalse.Note, component must be attached to the
Owner's, otherwise it will be ignored.- Specified by:
addComponentIdsin interfaceSettingsFacet<S extends UiComponentSettings<S>>- Parameters:
ids- component ids
-
getComponentIds
- Specified by:
getComponentIdsin interfaceSettingsFacet<S extends UiComponentSettings<S>>- 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<S extends UiComponentSettings<S>>- Parameters:
ids- component ids to exclude
-
getExcludedComponentIds
- Specified by:
getExcludedComponentIdsin interfaceSettingsFacet<S extends UiComponentSettings<S>>- 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, a collection will be filled byOwner'scomponents, otherwise a collection will be filled by components that explicitly added bySettingsFacet.addComponentIds(String...).- Specified by:
getManagedComponentsin interfaceSettingsFacet<S extends UiComponentSettings<S>>- Returns:
- components collection that is used for applying and saving settings
-
getApplySettingsDelegate
- Specified by:
getApplySettingsDelegatein interfaceSettingsFacet<S extends UiComponentSettings<S>>- Returns:
- apply settings delegate or
nullif not set
-
setApplySettingsDelegate
Description copied from interface:SettingsFacetSets handler that should be invoked instead of the 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<S extends UiComponentSettings<S>>- Parameters:
delegate- handler to set
-
getApplyDataLoadingSettingsDelegate
- Specified by:
getApplyDataLoadingSettingsDelegatein interfaceSettingsFacet<S extends UiComponentSettings<S>>- Returns:
- apply data loading settings delegate or
nullif not set
-
setApplyDataLoadingSettingsDelegate
public void setApplyDataLoadingSettingsDelegate(@Nullable Consumer<SettingsFacet.SettingsContext<S>> delegate) Description copied from interface:SettingsFacetSets handler that should be invoked instead of the 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<S extends UiComponentSettings<S>>- Parameters:
delegate- handler to set
-
getSaveSettingsDelegate
- Specified by:
getSaveSettingsDelegatein interfaceSettingsFacet<S extends UiComponentSettings<S>>- Returns:
- save settings delegate or
nullif not set
-
setSaveSettingsDelegate
Description copied from interface:SettingsFacetSets handler that should be invoked instead of the 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<S extends UiComponentSettings<S>>- Parameters:
delegate- handler to set
-
setOwner
public <T extends com.vaadin.flow.component.Composite<?> & FacetOwner> void setOwner(@Nullable T owner) Description copied from interface:FacetSets an owner containing this facet.- Specified by:
setOwnerin interfaceFacet- Overrides:
setOwnerin classAbstractFacet- Type Parameters:
T- the type of the owner- Parameters:
owner- an owner containing this facet
-
getManagedComponentsFromCollection
protected Collection<com.vaadin.flow.component.Component> getManagedComponentsFromCollection(Collection<com.vaadin.flow.component.Component> ownerComponents) -
createSettings
-
initSettings
-
unsubscribeOwnerLifecycle
protected abstract void unsubscribeOwnerLifecycle() -
subscribeOwnerLifecycle
protected abstract void subscribeOwnerLifecycle() -
applyComponentSettings
-
applyDataLoadingComponentSettings
protected void applyDataLoadingComponentSettings(Collection<com.vaadin.flow.component.Component> components) -
saveComponentSettings
-
checkAttachedToOwner
protected void checkAttachedToOwner() -
isSettingsEnabled
protected boolean isSettingsEnabled() -
excludeUrlQueryParametersFacetComponents
protected Collection<com.vaadin.flow.component.Component> excludeUrlQueryParametersFacetComponents(Collection<com.vaadin.flow.component.Component> components) -
getFacets
-
getOwnerComponent
protected com.vaadin.flow.component.Composite<?> getOwnerComponent() -
createSettingsContext
-