Interface ViewSettings

All Known Implementing Classes:
AbstractViewSettings, ViewSettingsJson

public interface ViewSettings
Base interface for classes that collect component settings from View. It provides API for putting, getting, removing settings.
See Also:
  • Method Details

    • getViewId

      String getViewId()
      Returns:
      a View id to which settings are corresponded
    • setModified

      void setModified(boolean modified)
      Set to true if screen settings changed manually. It guarantees that settings will be persisted.
      Parameters:
      modified - whether settings were modified
    • isModified

      boolean isModified()
      Returns:
      true if settings were modified
    • put

      ViewSettings put(String id, String key, @Nullable String value)
      Puts a value with String type. Will replace value if the same key already exist.
      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 ViewSettings
    • put

      ViewSettings put(String id, String key, @Nullable Integer value)
      Puts a value with Integer type. Will replace value if the same key already exist.
      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 ViewSettings
    • put

      ViewSettings put(String id, String key, @Nullable Long value)
      Puts a value with Long type. Will replace value if the same key already exist.
      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 ViewSettings
    • put

      ViewSettings put(String id, String key, @Nullable Double value)
      Puts a value with Double type. Will replace value if the same key already exist.
      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 ViewSettings
    • put

      ViewSettings put(String id, String key, @Nullable Boolean value)
      Puts a value with Boolean. Will replace value if the same key already exist.
      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 ViewSettings
    • put

      ViewSettings put(Settings settings)
      Puts component's settings, e.g JmixDetailsSettings. If setting with provided id already exist it will be replaced.
      Parameters:
      settings - object of settings
      Returns:
      current instance of ViewSettings
    • delete

      ViewSettings delete(String id)
      Deletes component's settings by identifier if they exist.
      Parameters:
      id - id to remove, e.g. component id
      Returns:
      current instance of ViewSettings
    • delete

      ViewSettings delete(String id, String key)
      Deletes a key of object with provided identifier if it exists.
      Parameters:
      id - e.g. component id
      key - object's key to remove
      Returns:
      current instance of ViewSettings
    • getString

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

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

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

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

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

      <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

      <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

      void initialize(@Nullable String rawSettings)
      Initializes current instance from serialized settings.
      Parameters:
      rawSettings - serialized settings
    • serialize

      String serialize()
      Returns:
      serialized settings