Interface EditorValue<T>

Type Parameters:
T - The type of the value object.
All Known Subinterfaces:
CatalogEditorValue, CheckboxEditorValue, ComboboxEditorValue, ContentAreaListValue, ContentListEditorValue, DatasetEditorValue, DateEditorValue, DomEditorValue, DomTableEditorValue, FileEditorValue, ImageMapEditorValue, IndexEditorValue, LinkEditorValue, LinkListEditorValue, ListEditorValue, MediumEditorValue<T>, NumberEditorValue, ObjectChooserEditorValue, PageRefEditorValue, PermissionEditorValue, PictureEditorValue, RadiobuttonEditorValue, ReferenceEditorValue, SiteStoreVariableValue, TabListEditorValue, TextareaEditorValue, TextEditorValue, TextualEditorValue, TNodesEditorValue, ToggleEditorValue

@NonExtendable public interface EditorValue<T>

Interface providing generic access to an editor value object.

Attention: This interface should no longer be used for accessing editor values. Instead, FormDatashould be used. Custom input components should implement ValueEngineer instead for the persistenceof gadget values.

Note: Components, which allow types of objects other than the defined value type to beassimilated, are urged to place an "Assimilation Note" in their type documentation.

Since:
2.3.17
  • Field Details

    • SOLE_LANGUAGE

      static final Language SOLE_LANGUAGE
      Language used for language independent editor values.
      Since:
      4.0.17
    • FALLBACK_LANGUAGE

      static final Language FALLBACK_LANGUAGE
      Language used for fallback values.
      Since:
      4.0.17
    • LANG_KEY

      static final String LANG_KEY
      Key used for identifying language nodes
      Since:
      4.0.17
      See Also:
    • UNSUPPORTED

      static final String UNSUPPORTED
      Marker for unsupported editors
      Since:
      4.0.17
      See Also:
    • DEFAULT

      static final String DEFAULT
      Marker for default values
      Since:
      4.0.52
      See Also:
    • COPY_PRESET

      static final String COPY_PRESET
      Marker for preset copy mode
      Since:
      4.0.126
      See Also:
    • DELETE

      static final String DELETE
      Marker for delete values
      Since:
      4.0.135
      See Also:
  • Method Details

    • initialize

      void initialize(UserService userService, DataValue parent, Element dataNode, GomFormElement formElement)
      Initialize this editor.
      Parameters:
      userService - The userService to be used.
      parent - The parent DataValue object.
      dataNode - <CMS_VALUE name=...>...</CMS_VALUE>
      formElement - The form element defining the elements GUI.
      Since:
      4.0.17
    • setValueNode

      void setValueNode(Element dataXml)
      Set values of editor by dataXml element. This method may be called more than once.
      Parameters:
      dataXml - DataXML object containing values
      Since:
      3.0.121
    • toXml

      String toXml()
      Get an XML string representation of the editor's values.
      Returns:
      The XML string
      Since:
      2.3.17
    • toXml

      String toXml(Language language)
      Get an XML string representation of the editor's value in the specified language. The returned string will be valid XML, where the root node is a LANG node having the language abbreviation as id.
      Parameters:
      language - The language to create a representation for.
      Returns:
      The produced XML.
      Since:
      4.0.17
    • getGuiXml

      @Deprecated Element getGuiXml()
      Deprecated.
      since 4.0.17 - use getForm() instead
      Get the XML describing the GUI elements for the underlying editor.
      Returns:
      The GUI's XML
      Since:
      2.3.17
    • getValueType

      @NotNull @NotNull Class<T> getValueType()
      Get the type of value the editor takes. The returned value must not be null and corresponds to the generic type T.
      Returns:
      The value's type.
      Since:
      4.0.17
    • getContentType

      Class<?> getContentType()
      Get the type of content handled by the editor. Returns the same as getValueType() for non-list-based value types and returnsthe element type for list-based value types.
      Returns:
      The value's content type.
      Since:
      4.0.17
    • setTagName

      void setTagName(String value)
      Set the tag name associated with this editor.
      Parameters:
      value - the tag name
      Since:
      4.0.17
    • getTagName

      String getTagName()
      Get the tag name associated with this editor.
      Returns:
      The editor's tag name.
      Since:
      4.0.17
    • getForm

      @Nullable @Nullable GomFormElement getForm()
      Get the form definition.
      Returns:
      The form definition.
      Since:
      4.0.17
    • isLanguageDependent

      boolean isLanguageDependent()
      States, if this editor is language dependent.
      Returns:
      true, if language dependent.
      Since:
      4.0.17
    • getEditorLanguages

      Map<String,Language> getEditorLanguages()
      Get the languages valid for the current editing operation, where the key is the language abbreviation and the value is the language object.
      Returns:
      A map of languages.
      Since:
      4.0.17
    • get

      @Nullable T get(Language language)
      Get the value object in the specified language. If the editor is not language dependent, the returned object always will be the same for any given language.
      Parameters:
      language - The language to look up.
      Returns:
      The language specific value object.
      Since:
      4.0.17
    • set

      void set(Language language, T object) throws InvalidValueException
      Set the value object for the specified language. If the editor is not language dependent, the language will be ignored.
      Parameters:
      language - The language to use.
      object - The object to store.
      Throws:
      InvalidValueException - If the given object is no valid value.
      Since:
      4.0.17
    • assimilate

      void assimilate(Language language, Object object) throws IllegalArgumentException, InvalidValueException
      Assimilate the value object for the specified language, if possible.
      Note: Passing null as argument will be evaluated as clear!
      Parameters:
      language - The language to assimilate for.
      object - The object to be assimilated.
      Throws:
      IllegalArgumentException - If the object cannot be assimilated.
      InvalidValueException - If the object's value is not valid.
      Since:
      4.0.17
    • isEmpty

      boolean isEmpty(T object)
      Test the given object for being empty.

      Default implementation checks for value being null.

      Parameters:
      object - The object to test.
      Returns:
      true, iff the value is treated as empty.
      Since:
      4.0.17
    • isSet

      boolean isSet()
      Indicates that a value is set for at least one language.
      Returns:
      true, if at least one language is set to a value.
      Since:
      4.0.120
    • isSet

      boolean isSet(Language language)
      Indicates that a value for the given language is set or is backed by a language independent value.
      Parameters:
      language - The language to look up.
      Returns:
      true, if a value is set or backed up.
      Since:
      4.0.17
    • beSet

      void beSet(Language language)
      Mark the current value for the given language to be set, i.e., isSet(Language) will evaluate to true and, if thecurrent value is null, isEmpty(Object) willevaluate to true, too.
      Parameters:
      language - The language to be marked as set.
      Since:
      4.0.17
    • clear

      void clear()
      Unset the value for all languages.
      Since:
      2.3.17
      See Also:
    • clear

      void clear(Language language)
      Unset the value for the specified language, i.e. isEmpty(Object)will evaluate to true on the current value and isSet(Language)will evaluate to false.
      Parameters:
      language - The language to reset values in.
      Since:
      3.0.78
    • getSearchableString

      String getSearchableString(Language language)
      This method returns a string representation for search and indexing usage.
      Parameters:
      language - The language to get a searchable string for.
      Returns:
      String representation of this editor.
      Since:
      3.1.158
    • findReferences

      @NotNull @NotNull List<Reference> findReferences() throws RuntimeException
      Finds references within this editor and returns them as a list.
      Important:
      • References of default values will be ignored!
      • RuntimeException could be thrown in case of problematic/invalid references!
      Returns:
      A list of references.
      Throws:
      RuntimeException - in case of any problems with referenced elements.
      Since:
      4.0.17
    • getDataValue

      DataValue getDataValue()
      Get DataValue object this editor belongs to.
      Since:
      4.0.17
    • isDefault

      boolean isDefault()
      Indicates the value representing default data.
      Returns:
      true, if the value represents default data.
      Since:
      4.0.17
    • addEditorValueListener

      void addEditorValueListener(EditorValueListener listener)
      Add the given listener to become notified about changes.
      Parameters:
      listener - The listener to add.
      Since:
      4.0.17
    • removeEditorValueListener

      void removeEditorValueListener(EditorValueListener listener)
      Remove the listener from being notified about changes.
      Parameters:
      listener - The listener to be removed.
      Since:
      4.0.17
    • isValid

      boolean isValid()
      Indicates, whether the editor has a valid setting wrt. its GOM.
      Returns:
      true, iff valid.
      Since:
      3.1.358
    • validate

      void validate(Language language, @Nullable T value) throws InvalidValueException
      Checks for the given value to be valid in the specified language wrt. the editor's GOM.
      Parameters:
      language - The language to check for.
      value - The value to be checked.
      Throws:
      InvalidValueException - If the value is invalid.
      Since:
      4.0.17
    • getMatches

      @NotNull @NotNull List<? extends Match> getMatches(Language language, Request request)
      Find matches for the given request.
      Parameters:
      language - The language to seach in.
      request - The request to find matches for.
      Returns:
      A list of editor specific match description objects.
      Since:
      4.0.17