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
Modifier and TypeFieldDescriptionprotected com.google.gson.Gson
protected com.google.gson.JsonArray
protected UiSettingsCache
Fields inherited from class io.jmix.ui.settings.AbstractScreenSettings
modified, screenId
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkNotNullGetConditions
(String id, String property) protected void
checkNotNullPutConditions
(String id, String property) void
commit()
INTERNAL.getBoolean
(String componentId, String property) protected com.google.gson.JsonObject
getComponent
(String componentId) protected com.google.gson.JsonObject
getComponentOrCreate
(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 void
initGson()
protected boolean
isValueNull
(com.google.gson.JsonObject json, String property) protected void
protected void
put
(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:ScreenSettings
Puts 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:ScreenSettings
Puts 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:ScreenSettings
Puts 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:ScreenSettings
Puts 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:ScreenSettings
Puts 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:ScreenSettings
Puts 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:ScreenSettings
Removes component's settings if they exist.- Parameters:
componentId
- component id to remove- Returns:
- current instance of screen settings
-
remove
Description copied from interface:ScreenSettings
Removes 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:AbstractScreenSettings
INTERNAL. Used by the framework.Commits screen settings to the store.
- Specified by:
commit
in classAbstractScreenSettings
-
getComponentOrCreate
-
getComponent
-
checkNotNullPutConditions
-
checkNotNullGetConditions
-
isValueNull
-