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, FormData
should 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 Summary
Modifier and TypeFieldDescriptionstatic final String
Marker for preset copy modestatic final String
Marker for default valuesstatic final String
Marker for delete valuesstatic final Language
Language used for fallback values.static final String
Key used for identifying language nodesstatic final Language
Language used for language independent editor values.static final String
Marker for unsupported editors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addEditorValueListener
(EditorValueListener listener) Add the given listener to become notified about changes.void
assimilate
(Language language, Object object) Assimilate the value object for the specified language, if possible.
Note: Passing null as argument will be evaluated as clear!void
Mark the current value for the given language to be set, i.e.,isSet(Language)
will evaluate totrue
and, if thecurrent value isnull
,isEmpty(Object)
willevaluate to true, too.void
clear()
Unset the value for all languages.void
Unset the value for the specified language, i.e.Finds references within this editor and returns them as a list.Get the value object in the specified language.Class<?>
Get the type of content handled by the editor.Get DataValue object this editor belongs to.Get the languages valid for the current editing operation, where the key is the language abbreviation and the value is the language object.@Nullable GomFormElement
getForm()
Get the form definition.Deprecated.getMatches
(Language language, Request request) Find matches for the given request.getSearchableString
(Language language) This method returns a string representation for search and indexing usage.Get the tag name associated with this editor.Get the type of value the editor takes.void
initialize
(UserService userService, DataValue parent, Element dataNode, GomFormElement formElement) Initialize this editor.boolean
Indicates the value representing default data.boolean
Test the given object for being empty.boolean
States, if this editor is language dependent.boolean
isSet()
Indicates that a value is set for at least one language.boolean
Indicates that a value for the given language is set or is backed by a language independent value.boolean
isValid()
Indicates, whether the editor has a valid setting wrt. its GOM.void
removeEditorValueListener
(EditorValueListener listener) Remove the listener from being notified about changes.void
Set the value object for the specified language.void
setTagName
(String value) Set the tag name associated with this editor.void
setValueNode
(Element dataXml) Set values of editor by dataXml element.toXml()
Get an XML string representation of the editor's values.Get an XML string representation of the editor's value in the specified language.void
Checks for the given value to be valid in the specified language wrt. the editor's GOM.
-
Field Details
-
SOLE_LANGUAGE
Language used for language independent editor values.- Since:
- 4.0.17
-
FALLBACK_LANGUAGE
Language used for fallback values.- Since:
- 4.0.17
-
LANG_KEY
Key used for identifying language nodes- Since:
- 4.0.17
- See Also:
-
UNSUPPORTED
Marker for unsupported editors- Since:
- 4.0.17
- See Also:
-
DEFAULT
Marker for default values- Since:
- 4.0.52
- See Also:
-
COPY_PRESET
Marker for preset copy mode- Since:
- 4.0.126
- See Also:
-
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 parentDataValue
object.dataNode
-<CMS_VALUE name=...>...</CMS_VALUE>
formElement
- The form element defining the elements GUI.- Since:
- 4.0.17
-
setValueNode
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
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.since 4.0.17 - usegetForm()
insteadGet the XML describing the GUI elements for the underlying editor.- Returns:
- The GUI's XML
- Since:
- 2.3.17
-
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 asgetValueType()
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
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
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
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
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
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
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
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
Mark the current value for the given language to be set, i.e.,isSet(Language)
will evaluate totrue
and, if thecurrent value isnull
,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
Unset the value for the specified language, i.e.isEmpty(Object)
will evaluate to true on the current value andisSet(Language)
will evaluate to false.- Parameters:
language
- The language to reset values in.- Since:
- 3.0.78
-
getSearchableString
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
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
Add the given listener to become notified about changes.- Parameters:
listener
- The listener to add.- Since:
- 4.0.17
-
removeEditorValueListener
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
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
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
-
getForm()
instead