Class WidgetDisplayElement

java.lang.Object
io.goobi.viewer.model.cms.widgets.WidgetDisplayElement
All Implemented Interfaces:
IPolyglott, Comparable<WidgetDisplayElement>

public class WidgetDisplayElement extends Object implements IPolyglott, Comparable<WidgetDisplayElement>
Class for displaying information about available sidebar widgets in /admin/cms/widgets and the sidebar edit tab of /admin/cms/pages/edit. Widgets are distinguished by getGenerationType() into default widgets with static GUI, automatic widgets provided by other custom content and custom widgets explicitly created by users They are further distinguished by getContentType() corresponding to the individual widget xhtml component
Author:
florian
  • Constructor Details

    • WidgetDisplayElement

      public WidgetDisplayElement(de.intranda.metadata.multilanguage.IMetadataValue title, de.intranda.metadata.multilanguage.IMetadataValue description, List<CMSPage> embeddingPages, WidgetGenerationType generationType, WidgetContentType contentType)
      Default constructor for widgets without underlying data (i.e. default widgets)
      Parameters:
      title -
      description -
      embeddingPages -
      generationType -
      contentType -
    • WidgetDisplayElement

      public WidgetDisplayElement(de.intranda.metadata.multilanguage.IMetadataValue title, de.intranda.metadata.multilanguage.IMetadataValue description, List<CMSPage> embeddingPages, WidgetGenerationType generationType, WidgetContentType contentType, Long id, IPolyglott translations)
      Default constructor for widgets with underlying data identified by the given id
      Parameters:
      title -
      description -
      embeddingPages -
      generationType -
      contentType -
      id - the database id of the underlying content. The type of content depends on generationType and contentType
      translations - used to display translation status of the widget. Usually the underlying custom widget
  • Method Details

    • getTitle

      public TranslatedText getTitle()
      The displayed title of the element
      Returns:
      the title
    • getDescription

      public TranslatedText getDescription()
      A description of the element
      Returns:
      the description
    • getEmbeddingPages

      public List<CMSPage> getEmbeddingPages()
      A list of CMS pages using this element. Only used to automatic and custom widgets
      Returns:
      the embeddingPages
    • getGenerationType

      public WidgetGenerationType getGenerationType()
      Describes they way in which way data for this widget is created and stored
      Returns:
      the generation type
    • getContentType

      public WidgetContentType getContentType()
      Describes the specific xhtml component used for this widget
      Returns:
      the contentType
    • getId

      public Long getId()
      Identifier of the underlying data, if any
      Returns:
      the id
    • isComplete

      public boolean isComplete(Locale locale)
      Both title and description are filled
      Specified by:
      isComplete in interface IPolyglott
      Returns:
      true if IPolyglott.isValid(Locale) returns true for the given locale and all fields contain a value which have a value in the default locale. For the default locale, IPolyglott.isComplete(Locale) and IPolyglott.isValid(Locale) are identical. For implementations with only one field, both methods are also always identical
    • isValid

      public boolean isValid(Locale locale)
      At least one of title and description is filled
      Specified by:
      isValid in interface IPolyglott
      Returns:
      true if all required fields contain a value in the given locale
    • isEmpty

      public boolean isEmpty(Locale locale)
      Description copied from interface: IPolyglott
      If this returns true, an associated language tab should have neither the 'already-translated' nor the '-partly-translated' class
      Specified by:
      isEmpty in interface IPolyglott
      Returns:
      true if no fields are filled for the given locale
    • getSelectedLocale

      public Locale getSelectedLocale()
      Specified by:
      getSelectedLocale in interface IPolyglott
      Returns:
      the locale currently set by IPolyglott.setSelectedLocale(Locale)
    • setSelectedLocale

      public void setSelectedLocale(Locale locale)
      Not used, since this element isn't editable
      Specified by:
      setSelectedLocale in interface IPolyglott
    • hasTranslations

      public boolean hasTranslations()
      Returns:
      true if an object exists providing the translation status of the widget
    • getTranslations

      public IPolyglott getTranslations()
      Returns:
      the object providing the translation status of the widget
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
      the text of the title in the current faces context language
    • compareTo

      public int compareTo(WidgetDisplayElement other)
      Two elements are equal if their titles are equal
      Specified by:
      compareTo in interface Comparable<WidgetDisplayElement>