Enum CacheSyncMode

java.lang.Object
java.lang.Enum<CacheSyncMode>
com.smartgwt.client.types.CacheSyncMode
All Implemented Interfaces:
ValueEnum, Serializable, Comparable<CacheSyncMode>, Constable

public enum CacheSyncMode extends Enum<CacheSyncMode> implements ValueEnum
Controls when a databound component that has no ResultSet to keep it current — a DynamicForm, ValuesManager or DetailViewer — picks up changes to the record it is showing.

Two distinct cases are covered. First, a save may be altered by the server: sequence values, defaults, computed fields and server-side business logic can all mean the stored record differs from what was submitted, and the component should show what was actually stored. Second, the same record may be edited somewhere else — another form, a grid on a different screen, or a real-time update applied via DataSource.updateCaches() — leaving the component showing superseded values that a user has no reason to think are stale, and may go on to commit.

  • Enum Constant Details

    • ALWAYS

      public static final CacheSyncMode ALWAYS
      Pick up changes from any successful "update" against the DataSource, whichever component or DataSource.updateCaches() call made them, as well as changes the server made to this component's own save. This is the default, and is the only setting that covers both cases described above.

      If this enumerated value is used in a Component XML file or server-side DataSource descriptor (.ds.xml file), use the value "always".

    • WHENSAVING

      public static final CacheSyncMode WHENSAVING
      Pick up only the changes the server made to this component's own save. Updates originating elsewhere are ignored, so the component goes on showing what it last saved or was last given.

      If this enumerated value is used in a Component XML file or server-side DataSource descriptor (.ds.xml file), use the value "whenSaving".

    • NEVER

      public static final CacheSyncMode NEVER
      Never update from a save response at all. The component shows only the values the application puts into it.

      An update never discards an edit the user has made and not yet saved. A field the user has changed keeps the value they typed, and goes on reporting as changed via DynamicForm.valuesHaveChanged(), so the oldValues sent with their eventual save still describe the record they started from. The exception is a field where the update happens to carry the same value the user typed: that edit has already been stored by whoever made the update, so it stops counting as an unsaved change.

      If this enumerated value is used in a Component XML file or server-side DataSource descriptor (.ds.xml file), use the value "never".

  • Method Details

    • values

      public static CacheSyncMode[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static CacheSyncMode valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • getValue

      public String getValue()
      Specified by:
      getValue in interface ValueEnum