Interface LinkListEditorValue
- All Superinterfaces:
EditorValue<List<Link>>
Deprecated.
Tag for classes implementing editors working on a list of links (CMS_INPUT_LINKLIST).
Contains old, deprecated API for compatibility reasons.
- Since:
- 2.3.17
- Example:
- How to store and get a value
import de.espirit.firstspirit.access.editor.*; import de.espirit.firstspirit.access.Language; import de.espirit.firstspirit.access.editor.value.InvalidValueException; import de.espirit.firstspirit.access.link.Link; import java.util.ArrayList; import java.util.List; /** * Example how to get the value of a LinkListEditorValue and how to store a value into a LinkListEditorValue. * * @since 4.2.34 */ public class LinkListEditorValueExample { /** * Stores the value into the LinkListEditorValue for the given language. * * @since 4.2.34 */ public void setValueForLanguage(final LinkListEditorValue editor, final List<Link> value, final Language language) throws InvalidValueException { // 1. check if language is provided if editor is language dependent ("useLanguages='yes'" in gom syntax) if (editor.isLanguageDependent() && language == null) { throw new NullPointerException("Language is missing!"); } // 2. store value into the editor value editor.set(language, value); } /** * Returns the value of the LinkListEditorValue for the given language. * * @since 4.2.34 */ public List<Link> getValueForLanguage(final LinkListEditorValue editor, final Language language) { // 1. get the stored instance in the editor value final List<Link> value = editor.get(language); // 2. and return the value for further processing return value; } /** * Adds the value to the LinkListEditorValue for the given language. * * @since 4.2.34 */ public void addValueForLanguage(final LinkListEditorValue editor, final Link valueToAdd, final Language language) throws InvalidValueException { // 1. check if language is provided if editor is language dependent ("useLanguages='yes'" in gom syntax) if (editor.isLanguageDependent() && language == null) { throw new NullPointerException("Language is missing!"); } // 2. get the stored instance in the editor value List<Link> value = editor.get(language); // 3. ensure the value is not null if (value == null) { value = new ArrayList<Link>(); } // 4. add the new entry to list of values value.add(valueToAdd); // 5. store value into the editor value editor.set(language, value); } /** * Removes the value out of the LinkListEditorValue for the given language. * * @since 4.2.34 */ public void removeValueForLanguage(final LinkListEditorValue editor, final Link valueToRemove, final Language language) throws InvalidValueException { // 1. check if language is provided if editor is language dependent ("useLanguages='yes'" in gom syntax) if (editor.isLanguageDependent() && language == null) { throw new NullPointerException("Language is missing!"); } // 2. get the stored instance in the editor value final List<Link> value = editor.get(language); // 3. if the value is null there is no need to do anything if (value == null) { return; } // 4. remove the entry from list of values if (value.contains(valueToRemove)) { value.remove(valueToRemove); } // 5. store value into the editor value editor.set(language, value); } }
-
Field Summary
FieldsFields inherited from interface de.espirit.firstspirit.access.editor.EditorValue
COPY_PRESET, DEFAULT, DELETE, FALLBACK_LANGUAGE, LANG_KEY, SOLE_LANGUAGE, UNSUPPORTED
-
Method Summary
Modifier and TypeMethodDescription@NotNull List<LinkTemplate>
Deprecated.Get a list of allowed link types.getForm()
Deprecated.Covariant return of concrete form container.Methods inherited from interface de.espirit.firstspirit.access.editor.EditorValue
addEditorValueListener, assimilate, beSet, clear, clear, findReferences, get, getContentType, getDataValue, getEditorLanguages, getGuiXml, getMatches, getSearchableString, getTagName, getValueType, initialize, isDefault, isEmpty, isLanguageDependent, isSet, isSet, isValid, removeEditorValueListener, set, setTagName, setValueNode, toXml, toXml, validate
-
Field Details
-
LINKLIST_KEY
Deprecated.Key for the link container.- Since:
- 4.0.17
- See Also:
-
-
Method Details
-
getForm
GomLinkList getForm()Deprecated.Covariant return of concrete form container.- Specified by:
getForm
in interfaceEditorValue<List<Link>>
- Returns:
- The form definition.
- Since:
- 4.0.17
-
getAllowedLinkTemplates
Deprecated.Get a list of allowed link types.- Returns:
- The list of allowed link types.
- Since:
- 4.2.8
-
FS_CATALOG
.