Class AbstractUiComponentSettingsJson<S extends UiComponentSettings<S>,J extends AbstractUiComponentSettingsJson<S,J>>

java.lang.Object
io.jmix.flowui.facet.settings.AbstractUiComponentSettings<S>
io.jmix.flowui.facet.settings.AbstractUiComponentSettingsJson<S,J>
Type Parameters:
S - type of settings
J - type of settings JSON
All Implemented Interfaces:
UiComponentSettings<S>
Direct Known Subclasses:
FragmentSettingsJson, ViewSettingsJson

public abstract class AbstractUiComponentSettingsJson<S extends UiComponentSettings<S>,J extends AbstractUiComponentSettingsJson<S,J>> extends AbstractUiComponentSettings<S>
Abstract base class for UiComponentSettings implementations that use JSON structure.
  • Field Details

    • root

      protected com.google.gson.JsonArray root
    • gson

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

    • AbstractUiComponentSettingsJson

      protected AbstractUiComponentSettingsJson(String ownerId)
  • Method Details

    • initGson

      protected void initGson()
    • put

      public S put(String id, String key, @Nullable String value)
      Description copied from interface: UiComponentSettings
      Puts a value with String type. Will replace value if the same key already exists.
      Parameters:
      id - e.g. component id
      key - key with which associated provided value, e.g., component's width or some state
      value - String value
      Returns:
      current instance of UiComponentSettings
    • put

      public S put(String id, String key, @Nullable Integer value)
      Description copied from interface: UiComponentSettings
      Puts a value with Integer type. Will replace value if the same key already exists.
      Parameters:
      id - e.g. component id
      key - key with which associated provided value, e.g., component's property or some state
      value - Integer value
      Returns:
      current instance of UiComponentSettings
    • put

      public S put(String id, String key, @Nullable Long value)
      Description copied from interface: UiComponentSettings
      Puts a value with Long type. Will replace value if the same key already exists.
      Parameters:
      id - e.g. component id
      key - key with which associated provided value, e.g., component's property or some state
      value - Long value
      Returns:
      current instance of UiComponentSettings
    • put

      public S put(String id, String key, @Nullable Double value)
      Description copied from interface: UiComponentSettings
      Puts a value with Double type. Will replace value if the same key already exists.
      Parameters:
      id - e.g. component id
      key - key with which associated provided value, e.g., component's property or some state
      value - Double value
      Returns:
      current instance of UiComponentSettings
    • put

      public S put(String id, String key, @Nullable Boolean value)
      Description copied from interface: UiComponentSettings
      Puts a value with Boolean. Will replace value if the same key already exists.
      Parameters:
      id - e.g. component id
      key - key with which associated provided value, e.g., component's property or some state
      value - Boolean value
      Returns:
      current instance of UiComponentSettings
    • put

      public S put(Settings settings)
      Description copied from interface: UiComponentSettings
      Puts component's settings, e.g JmixDetailsSettings. If setting with provided id already exists it will be replaced.
      Parameters:
      settings - object of settings
      Returns:
      current instance of UiComponentSettings
    • put

      public J put(com.google.gson.JsonObject json)
      Parameters:
      json - JSON object that represents settings
      Returns:
      current instance of AbstractUiComponentSettingsJson
    • delete

      public S delete(String id)
      Description copied from interface: UiComponentSettings
      Deletes component's settings by identifier if they exist.
      Parameters:
      id - id to remove, e.g. component id
      Returns:
      current instance of UiComponentSettings
    • delete

      public S delete(String id, String key)
      Description copied from interface: UiComponentSettings
      Deletes a key of an object with a provided identifier if it exists.
      Parameters:
      id - e.g. component id
      key - object's key to remove
      Returns:
      current instance of UiComponentSettings
    • getJsonSettings

      public Optional<com.google.gson.JsonObject> getJsonSettings(String id)
      Parameters:
      id - e.g. component id
      Returns:
      JSON object that represents settings
    • getString

      public Optional<String> getString(String id, String key)
      Parameters:
      id - e.g. component id
      key - object's key
      Returns:
      String value wrapped in Optional
    • getInteger

      public Optional<Integer> getInteger(String id, String key)
      Parameters:
      id - e.g. component id
      key - object's key
      Returns:
      Integer value wrapped in Optional
    • getLong

      public Optional<Long> getLong(String id, String key)
      Parameters:
      id - e.g. component id
      key - object's key
      Returns:
      Long value wrapped in Optional
    • getDouble

      public Optional<Double> getDouble(String id, String key)
      Parameters:
      id - e.g. component id
      key - object's key
      Returns:
      Double value wrapped in Optional
    • getBoolean

      public Optional<Boolean> getBoolean(String id, String key)
      Parameters:
      id - e.g. component id
      key - object's key
      Returns:
      Boolean value wrapped in Optional
    • getSettings

      public <T extends Settings> Optional<T> getSettings(String id, Class<T> settingsClass)
      Type Parameters:
      T - type of settings class
      Parameters:
      id - e.g. component id
      settingsClass - settings class
      Returns:
      component settings wrapped in Optional
    • getSettingsOrCreate

      public <T extends Settings> T getSettingsOrCreate(String id, Class<T> settingsClass)
      Type Parameters:
      T - type of settings class
      Parameters:
      id - e.g. component id
      settingsClass - settings class
      Returns:
      object of settings if exists otherwise return created settings with corresponding id
    • initialize

      public void initialize(@Nullable String raw)
      Description copied from interface: UiComponentSettings
      Initializes the current instance from serialized settings.
      Parameters:
      raw - serialized settings
    • serialize

      public String serialize()
      Returns:
      serialized settings
    • put

      protected void put(com.google.gson.JsonElement json, String id)
    • getObjectOrCreate

      protected com.google.gson.JsonObject getObjectOrCreate(String id)
    • getObject

      @Nullable protected com.google.gson.JsonObject getObject(String objectId)
    • checkNotNullPutConditions

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

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

      protected void initRoot()
    • isValueNull

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