Package io.jmix.ui.settings
Class ScreenSettingsJson
java.lang.Object
io.jmix.ui.settings.AbstractScreenSettings
io.jmix.ui.settings.ScreenSettingsJson
- All Implemented Interfaces:
ScreenSettings
@Component("ui_ScreenSettings")
@Scope("prototype")
public class ScreenSettingsJson
extends AbstractScreenSettings
Screen settings that use JSON structure for stored settings.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.google.gson.Gsonprotected com.google.gson.JsonArrayprotected UiSettingsCacheFields inherited from class io.jmix.ui.settings.AbstractScreenSettings
modified, screenId -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckNotNullGetConditions(String id, String property) protected voidcheckNotNullPutConditions(String id, String property) voidcommit()INTERNAL.getBoolean(String componentId, String property) protected com.google.gson.JsonObjectgetComponent(String componentId) protected com.google.gson.JsonObjectgetComponentOrCreate(String componentId) getInteger(String componentId, String property) Optional<com.google.gson.JsonObject>getJsonSettings(String componentId) <T extends ComponentSettings>
Optional<T>getSettings(String componentId, Class<T> settingsClass) <T extends ComponentSettings>
TgetSettingsOrCreate(String componentId, Class<T> settingsClass) protected voidinitGson()protected booleanisValueNull(com.google.gson.JsonObject json, String property) protected voidprotected voidput(com.google.gson.JsonObject json) put(ComponentSettings settings) Puts component's settings, e.gTableSettings.Puts a Boolean value.Puts a Double value.Puts an Integer value.Puts a Long value.Puts a String value.Removes component's settings if they exist.Removes property of component's settings if it exists.Methods inherited from class io.jmix.ui.settings.AbstractScreenSettings
isModified, setModified
-
Field Details
-
settingsCache
-
root
protected com.google.gson.JsonArray root -
gson
protected com.google.gson.Gson gson
-
-
Constructor Details
-
ScreenSettingsJson
-
-
Method Details
-
put
Description copied from interface:ScreenSettingsPuts a String value. Will replace value if property already exist.- Parameters:
componentId- component idproperty- component's propertyvalue- String value- Returns:
- current instance of screen settings
-
put
Description copied from interface:ScreenSettingsPuts an Integer value. Will replace value if property already exist.- Parameters:
componentId- component idproperty- component's propertyvalue- Integer value- Returns:
- current instance of screen settings
-
put
Description copied from interface:ScreenSettingsPuts a Long value. Will replace value if property already exist.- Parameters:
componentId- component idproperty- component's propertyvalue- Long value- Returns:
- current instance of screen settings
-
put
Description copied from interface:ScreenSettingsPuts a Double value. Will replace value if property already exist.- Parameters:
componentId- component idproperty- component's propertyvalue- Double value- Returns:
- current instance of screen settings
-
put
Description copied from interface:ScreenSettingsPuts a Boolean value. Will replace value if property already exist.- Parameters:
componentId- component idproperty- component's propertyvalue- Boolean value- Returns:
- current instance of screen settings
-
put
Description copied from interface:ScreenSettingsPuts component's settings, e.gTableSettings. If settings with provided id already exist they will be replaced.- Parameters:
settings- component settings- Returns:
- current instance of screen settings
-
put
- Parameters:
json- json object that represents component settings- Returns:
- current instance of
ScreenSettings
-
getString
- Parameters:
componentId- component idproperty- component's property- Returns:
- String value wrapped in
Optional
-
getInteger
- Parameters:
componentId- component idproperty- component's property- Returns:
- Integer value wrapped in
Optional
-
getLong
- Parameters:
componentId- component idproperty- component's property- Returns:
- Long value wrapped in
Optional
-
getDouble
- Parameters:
componentId- component idproperty- component's property- Returns:
- Double value wrapped in
Optional
-
getBoolean
- Parameters:
componentId- component idproperty- component's property- Returns:
- Boolean value wrapped in
Optional
-
getSettings
public <T extends ComponentSettings> Optional<T> getSettings(String componentId, Class<T> settingsClass) - Type Parameters:
T- type of component settings class- Parameters:
componentId- component idsettingsClass- settings class- Returns:
- component settings wrapped in
Optional
-
getSettingsOrCreate
public <T extends ComponentSettings> T getSettingsOrCreate(String componentId, Class<T> settingsClass) - Type Parameters:
T- type of component settings class- Parameters:
componentId- component idsettingsClass- settings class- Returns:
- component settings if exist otherwise return created settings with corresponding id
-
remove
Description copied from interface:ScreenSettingsRemoves component's settings if they exist.- Parameters:
componentId- component id to remove- Returns:
- current instance of screen settings
-
remove
Description copied from interface:ScreenSettingsRemoves property of component's settings if it exists.- Parameters:
componentId- component idproperty- component's property to remove- Returns:
- current instance of screen settings
-
getJsonSettings
- Parameters:
componentId- component id- Returns:
- json object that represents component settings
-
put
-
initGson
protected void initGson() -
loadSettings
protected void loadSettings() -
commit
public void commit()Description copied from class:AbstractScreenSettingsINTERNAL. Used by the framework.Commits screen settings to the store.
- Specified by:
commitin classAbstractScreenSettings
-
getComponentOrCreate
-
getComponent
-
checkNotNullPutConditions
-
checkNotNullGetConditions
-
isValueNull
-