Interface LinkListEditorValue

All Superinterfaces:
EditorValue<List<Link>>

@Deprecated public interface LinkListEditorValue extends EditorValue<List<Link>>
Deprecated.
Since 5.0.107 - usages of CMS_INPUT_LINKLIST should be replaced with FS_CATALOG.
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 Details

  • Method Details

    • getForm

      GomLinkList getForm()
      Deprecated.
      Covariant return of concrete form container.
      Specified by:
      getForm in interface EditorValue<List<Link>>
      Returns:
      The form definition.
      Since:
      4.0.17
    • getAllowedLinkTemplates

      @NotNull @NotNull List<LinkTemplate> getAllowedLinkTemplates()
      Deprecated.
      Get a list of allowed link types.
      Returns:
      The list of allowed link types.
      Since:
      4.2.8