public class ScreenSettingsFacetImpl extends AbstractFacet implements ScreenSettingsFacet, ScreenSettingsFacetResolver.AfterShowEventHandler
ScreenSettingsFacet.SettingsContext
Modifier and Type | Field and Description |
---|---|
protected io.jmix.core.common.event.Subscription |
afterDetachedSubscription |
protected io.jmix.core.common.event.Subscription |
afterShowSubscription |
protected java.util.function.Consumer<ScreenSettingsFacet.SettingsContext> |
applyDataLoadingSettingsDelegate |
protected java.util.function.Consumer<ScreenSettingsFacet.SettingsContext> |
applySettingsDelegate |
protected boolean |
auto |
protected org.springframework.beans.factory.BeanFactory |
beanFactory |
protected io.jmix.core.common.event.Subscription |
beforeShowSubscription |
protected java.util.Set<java.lang.String> |
componentIds |
protected boolean |
isAfterShowHandled |
protected java.util.function.Consumer<ScreenSettingsFacet.SettingsContext> |
saveSettingsDelegate |
protected ScreenSettings |
screenSettings |
protected ScreenSettingsFacetResolver |
settingsFacetResolver |
protected ScreenSettingsManager |
settingsManager |
id, owner
Constructor and Description |
---|
ScreenSettingsFacetImpl() |
Modifier and Type | Method and Description |
---|---|
void |
addComponentIds(java.lang.String... ids)
Adds component ids that should be handled when
ScreenSettingsFacet.isAuto() returns false. |
protected void |
applyDataLoadingScreenSettings(java.util.Collection<Component> components) |
void |
applyDataLoadingSettings()
Applies data loading settings.
|
void |
applyDataLoadingSettings(java.util.Collection<Component> components)
Applies data loading settings for the components collection.
|
protected void |
applyScreenSettings(java.util.Collection<Component> components) |
void |
applySettings()
Applies screen settings.
|
void |
applySettings(java.util.Collection<Component> components)
Applies screen settings for the components collection.
|
protected void |
checkAttachedFrame() |
protected java.util.Collection<Component> |
fillComponents(java.util.Collection<Component> components) |
protected java.util.Collection<Component> |
fillWithInnerComponents(java.util.Collection<Component> components,
HasInnerComponents hasInnerComponents) |
protected java.util.Collection<Component> |
filterByManagedComponents(java.util.Collection<Component> components) |
java.util.function.Consumer<ScreenSettingsFacet.SettingsContext> |
getApplyDataLoadingSettingsDelegate() |
java.util.function.Consumer<ScreenSettingsFacet.SettingsContext> |
getApplySettingsDelegate() |
java.util.Set<java.lang.String> |
getComponentIds() |
java.util.Collection<Component> |
getComponents()
Collection depends on
ScreenSettingsFacet.isAuto() property. |
java.util.function.Consumer<ScreenSettingsFacet.SettingsContext> |
getSaveSettingsDelegate() |
protected Screen |
getScreenOwner() |
ScreenSettings |
getSettings() |
boolean |
isAuto() |
protected boolean |
isSettingsEnabled() |
protected void |
onAfterDetachEvent(Screen.AfterDetachEvent event) |
void |
onAfterShowEvent(Screen.AfterShowEvent event) |
protected void |
onBeforeShowEvent(Screen.BeforeShowEvent event) |
protected void |
saveScreenSettings(java.util.Collection<Component> components) |
void |
saveSettings()
Saves and persist settings.
|
void |
saveSettings(java.util.Collection<Component> components)
Saves and persist settings for the components collection.
|
void |
setApplyDataLoadingSettingsDelegate(java.util.function.Consumer<ScreenSettingsFacet.SettingsContext> delegate)
Sets apply data loading settings delegate.
|
void |
setApplySettingsDelegate(java.util.function.Consumer<ScreenSettingsFacet.SettingsContext> delegate)
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 |
setOwner(Frame owner)
|
void |
setSaveSettingsDelegate(java.util.function.Consumer<ScreenSettingsFacet.SettingsContext> delegate)
Set save settings delegate.
|
protected void |
subscribe() |
protected void |
unsubscribe() |
getEventHub, getId, getOwner, hasSubscriptions, publish, setId, unsubscribe
protected java.util.Set<java.lang.String> componentIds
protected boolean auto
protected boolean isAfterShowHandled
protected ScreenSettings screenSettings
protected java.util.function.Consumer<ScreenSettingsFacet.SettingsContext> applySettingsDelegate
protected java.util.function.Consumer<ScreenSettingsFacet.SettingsContext> applyDataLoadingSettingsDelegate
protected java.util.function.Consumer<ScreenSettingsFacet.SettingsContext> saveSettingsDelegate
protected io.jmix.core.common.event.Subscription beforeShowSubscription
protected io.jmix.core.common.event.Subscription afterShowSubscription
protected io.jmix.core.common.event.Subscription afterDetachedSubscription
@Autowired(required=false) protected ScreenSettingsManager settingsManager
@Autowired protected ScreenSettingsFacetResolver settingsFacetResolver
@Autowired protected org.springframework.beans.factory.BeanFactory beanFactory
public ScreenSettings getSettings()
getSettings
in interface ScreenSettingsFacet
public void applySettings()
ScreenSettingsFacet
Screen.AfterShowEvent
.applySettings
in interface ScreenSettingsFacet
public void applySettings(java.util.Collection<Component> components)
ScreenSettingsFacet
applySettings
in interface ScreenSettingsFacet
components
- components to applypublic void applyDataLoadingSettings()
ScreenSettingsFacet
Screen.BeforeShowEvent
.applyDataLoadingSettings
in interface ScreenSettingsFacet
public void applyDataLoadingSettings(java.util.Collection<Component> components)
ScreenSettingsFacet
applyDataLoadingSettings
in interface ScreenSettingsFacet
components
- components to applypublic void saveSettings()
ScreenSettingsFacet
Screen.AfterDetachEvent
.saveSettings
in interface ScreenSettingsFacet
public void saveSettings(java.util.Collection<Component> components)
ScreenSettingsFacet
saveSettings
in interface ScreenSettingsFacet
components
- components to savepublic boolean isAuto()
isAuto
in interface ScreenSettingsFacet
public void setAuto(boolean auto)
ScreenSettingsFacet
setAuto
in interface ScreenSettingsFacet
auto
- whether facet should include all components for saving settingspublic void addComponentIds(java.lang.String... ids)
ScreenSettingsFacet
ScreenSettingsFacet.isAuto()
returns false.
Note, component must be attached to the Window, otherwise it will be ignored.
addComponentIds
in interface ScreenSettingsFacet
ids
- component idspublic java.util.Set<java.lang.String> getComponentIds()
getComponentIds
in interface ScreenSettingsFacet
ScreenSettingsFacet.isAuto()
returns false.public java.util.Collection<Component> getComponents()
ScreenSettingsFacet
ScreenSettingsFacet.isAuto()
property. If ScreenSettingsFacet.isAuto()
returns true collection will be
filled by Window
's components, otherwise collection will be filled by components were added by
ScreenSettingsFacet.addComponentIds(String...)
.getComponents
in interface ScreenSettingsFacet
public java.util.function.Consumer<ScreenSettingsFacet.SettingsContext> getApplySettingsDelegate()
getApplySettingsDelegate
in interface ScreenSettingsFacet
public void setApplySettingsDelegate(java.util.function.Consumer<ScreenSettingsFacet.SettingsContext> delegate)
ScreenSettingsFacet
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 onApplySetting(SettingsSet settings) { settingsFacet.applySettings(settings); }
setApplySettingsDelegate
in interface ScreenSettingsFacet
delegate
- apply settings delegatepublic java.util.function.Consumer<ScreenSettingsFacet.SettingsContext> getApplyDataLoadingSettingsDelegate()
getApplyDataLoadingSettingsDelegate
in interface ScreenSettingsFacet
public void setApplyDataLoadingSettingsDelegate(java.util.function.Consumer<ScreenSettingsFacet.SettingsContext> delegate)
ScreenSettingsFacet
Screen.BeforeShowEvent
.
For instance:
@Install(to = "settingsFacet", subject = "applyDataLoadingSettingsDelegate") private void onApplyDataLoadingSetting(SettingsSet settings) { settingsFacet.applyDataLoadingSettings(settings); }
setApplyDataLoadingSettingsDelegate
in interface ScreenSettingsFacet
delegate
- apply settings delegatepublic java.util.function.Consumer<ScreenSettingsFacet.SettingsContext> getSaveSettingsDelegate()
getSaveSettingsDelegate
in interface ScreenSettingsFacet
public void setSaveSettingsDelegate(java.util.function.Consumer<ScreenSettingsFacet.SettingsContext> delegate)
ScreenSettingsFacet
Screen.AfterDetachEvent
.
For instance:
@Install(to = "settingsFacet", subject = "saveSettingsDelegate") private void onSaveSetting(SettingsSet settings) { settingsFacet.saveSettings(settings); }
setSaveSettingsDelegate
in interface ScreenSettingsFacet
delegate
- save settings delegatepublic void setOwner(@Nullable Frame owner)
Facet
setOwner
in interface Facet
setOwner
in class AbstractFacet
owner
- owner frameprotected void subscribe()
protected void unsubscribe()
@Nullable protected Screen getScreenOwner()
protected void onBeforeShowEvent(Screen.BeforeShowEvent event)
public void onAfterShowEvent(Screen.AfterShowEvent event)
onAfterShowEvent
in interface ScreenSettingsFacetResolver.AfterShowEventHandler
protected void onAfterDetachEvent(Screen.AfterDetachEvent event)
protected void applyScreenSettings(java.util.Collection<Component> components)
protected void applyDataLoadingScreenSettings(java.util.Collection<Component> components)
protected void saveScreenSettings(java.util.Collection<Component> components)
protected boolean isSettingsEnabled()
protected java.util.Collection<Component> filterByManagedComponents(java.util.Collection<Component> components)
protected void checkAttachedFrame()
protected java.util.Collection<Component> fillComponents(java.util.Collection<Component> components)
protected java.util.Collection<Component> fillWithInnerComponents(java.util.Collection<Component> components, HasInnerComponents hasInnerComponents)