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 Details

    • settingsCache

      @Autowired(required=false) protected UiSettingsCache settingsCache
    • root

      protected com.google.gson.JsonArray root
    • gson

      protected com.google.gson.Gson gson
  • Constructor Details

    • ScreenSettingsJson

      public ScreenSettingsJson(String screenId)
  • Method Details

    • put

      public ScreenSettingsJson put(String componentId, String property, @Nullable String value)
      Description copied from interface: ScreenSettings
      Puts a String value. Will replace value if property already exist.
      Parameters:
      componentId - component id
      property - component's property
      value - String value
      Returns:
      current instance of screen settings
    • put

      public ScreenSettings put(String componentId, String property, @Nullable Integer value)
      Description copied from interface: ScreenSettings
      Puts an Integer value. Will replace value if property already exist.
      Parameters:
      componentId - component id
      property - component's property
      value - Integer value
      Returns:
      current instance of screen settings
    • put

      public ScreenSettings put(String componentId, String property, @Nullable Long value)
      Description copied from interface: ScreenSettings
      Puts a Long value. Will replace value if property already exist.
      Parameters:
      componentId - component id
      property - component's property
      value - Long value
      Returns:
      current instance of screen settings
    • put

      public ScreenSettings put(String componentId, String property, @Nullable Double value)
      Description copied from interface: ScreenSettings
      Puts a Double value. Will replace value if property already exist.
      Parameters:
      componentId - component id
      property - component's property
      value - Double value
      Returns:
      current instance of screen settings
    • put

      public ScreenSettings put(String componentId, String property, @Nullable Boolean value)
      Description copied from interface: ScreenSettings
      Puts a Boolean value. Will replace value if property already exist.
      Parameters:
      componentId - component id
      property - component's property
      value - Boolean value
      Returns:
      current instance of screen settings
    • put

      public ScreenSettingsJson put(ComponentSettings settings)
      Description copied from interface: ScreenSettings
      Puts component's settings, e.g TableSettings. If settings with provided id already exist they will be replaced.
      Parameters:
      settings - component settings
      Returns:
      current instance of screen settings
    • put

      public ScreenSettingsJson put(com.google.gson.JsonObject json)
      Parameters:
      json - json object that represents component settings
      Returns:
      current instance of ScreenSettings
    • getString

      public Optional<String> getString(String componentId, String property)
      Parameters:
      componentId - component id
      property - component's property
      Returns:
      String value wrapped in Optional
    • getInteger

      public Optional<Integer> getInteger(String componentId, String property)
      Parameters:
      componentId - component id
      property - component's property
      Returns:
      Integer value wrapped in Optional
    • getLong

      public Optional<Long> getLong(String componentId, String property)
      Parameters:
      componentId - component id
      property - component's property
      Returns:
      Long value wrapped in Optional
    • getDouble

      public Optional<Double> getDouble(String componentId, String property)
      Parameters:
      componentId - component id
      property - component's property
      Returns:
      Double value wrapped in Optional
    • getBoolean

      public Optional<Boolean> getBoolean(String componentId, String property)
      Parameters:
      componentId - component id
      property - 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 id
      settingsClass - 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 id
      settingsClass - settings class
      Returns:
      component settings if exist otherwise return created settings with corresponding id
    • remove

      public ScreenSettings remove(String componentId)
      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

      public ScreenSettings remove(String componentId, String property)
      Description copied from interface: ScreenSettings
      Removes property of component's settings if it exists.
      Parameters:
      componentId - component id
      property - component's property to remove
      Returns:
      current instance of screen settings
    • getJsonSettings

      public Optional<com.google.gson.JsonObject> getJsonSettings(String componentId)
      Parameters:
      componentId - component id
      Returns:
      json object that represents component settings
    • put

      protected void put(com.google.gson.JsonElement json, String componentId)
    • 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 class AbstractScreenSettings
    • getComponentOrCreate

      protected com.google.gson.JsonObject getComponentOrCreate(String componentId)
    • getComponent

      @Nullable protected com.google.gson.JsonObject getComponent(String componentId)
    • checkNotNullPutConditions

      protected void checkNotNullPutConditions(String id, String property)
    • checkNotNullGetConditions

      protected void checkNotNullGetConditions(String id, String property)
    • isValueNull

      protected boolean isValueNull(com.google.gson.JsonObject json, String property)