Interface ContentListEditorValue
- All Superinterfaces:
EditorValue<List<Entity>>
,TableTemplateProvider
@Deprecated
public interface ContentListEditorValue
extends EditorValue<List<Entity>>, TableTemplateProvider
Deprecated.
- Since:
- 3.1.186
- Example:
- Example how to get the value of a ContentListEditorValue and how to store a value into ContentListEditorValue.
import de.espirit.firstspirit.access.editor.*; import de.espirit.firstspirit.access.Language; import de.espirit.firstspirit.access.editor.value.InvalidValueException; import de.espirit.or.schema.Entity; import java.util.ArrayList; import java.util.List; /** * Example how to get the value of a ContentListEditorValue and how to store a value into ContentListEditorValue. * * @since 4.2.34 */ public class ContentListEditorValueExample { /** * Stores the value into the ContentListEditorValue for the given language. * * @since 4.2.34 */ public void setValueForLanguage(final ContentListEditorValue editor, final List<Entity> 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 ContentListEditorValue for the given language. * * @since 4.2.34 */ public List<Entity> getValueForLanguage(final ContentListEditorValue editor, final Language language) { // 1. get the stored instance in the editor value final List<Entity> value = editor.get(language); // 2. and return the value for further processing return value; } /** * Adds the value to the ContentListEditorValue for the given language. * * @since 4.2.34 */ public void addValueForLanguage(final ContentListEditorValue editor, final Entity 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<Entity> value = editor.get(language); // 3. ensure the value is not null if (value == null) { value = new ArrayList<Entity>(); } // 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 ContentListEditorValue for the given language. * * @since 4.2.34 */ public void removeValueForLanguage(final ContentListEditorValue editor, final Entity 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<Entity> 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
Fields inherited from interface de.espirit.firstspirit.access.editor.TableTemplateProvider
SELECTION_KEY, SELECTION_VALUE_KEY
-
Method Summary
Modifier and TypeMethodDescriptiongetForm()
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
Methods inherited from interface de.espirit.firstspirit.access.editor.TableTemplateProvider
getTableTemplate
-
Field Details
-
CONTENTLIST_KEY
Deprecated.Key for list entries.- Since:
- 4.0
- See Also:
-
-
Method Details
-
getForm
GomContentList getForm()Deprecated.Covariant return of concrete form container.- Specified by:
getForm
in interfaceEditorValue<List<Entity>>
- Returns:
- The form definition.
- Since:
- 4.0
-
FS_INDEX
.