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 Alpers
  • 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 - displayed title of the widget
      description - short description of the widget
      embeddingPages - CMS pages that embed this widget
      generationType - the way the widget's data is generated and stored
      contentType - the specific xhtml component used for this widget
    • 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 - displayed title of the widget
      description - short description of the widget
      embeddingPages - CMS pages that embed this widget
      generationType - the way the widget's data is generated and stored
      contentType - the specific xhtml component used for this widget
      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
    • WidgetDisplayElement

      public WidgetDisplayElement(CustomSidebarWidget widget)
    • WidgetDisplayElement

      public WidgetDisplayElement(CustomSidebarWidget widget, List<CMSPage> embeddedPages)
  • Method Details

    • getTitle

      public TranslatedText getTitle()
      The displayed title of the element.
      Returns:
      the title of this widget display element as a TranslatedText
    • getDescription

      public TranslatedText getDescription()
      A description of the element.
      Returns:
      the description of this widget display element as a TranslatedText
    • getDescriptionOrTypeDescription

      public TranslatedText getDescriptionOrTypeDescription()
    • getEmbeddingPages

      public List<CMSPage> getEmbeddingPages()
      A list of CMS pages using this element. Only used to automatic and custom widgets
      Returns:
      the list of CMSPage instances that embed this widget
    • 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 WidgetContentType identifying the xhtml component for this widget
    • getId

      public Long getId()
      Identifier of the underlying data, if any.
      Returns:
      the database identifier of the underlying widget data, or null if no persistent data exists
    • isComplete

      public boolean isComplete(Locale locale)
      Both title and description are filled.
      Specified by:
      isComplete in interface IPolyglott
      Parameters:
      locale - the locale to check translation completeness for
      Returns:
      true if both title and description are non-empty for the given locale, false otherwise
    • isValid

      public boolean isValid(Locale locale)
      At least one of title and description is filled.
      Specified by:
      isValid in interface IPolyglott
      Parameters:
      locale - the locale to check validity for
      Returns:
      true if the title is non-empty for any locale, false otherwise
    • 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
      Parameters:
      locale - the locale to check for empty fields
      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
      Parameters:
      locale - the locale to set (ignored)
    • 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>
      Parameters:
      other - the widget display element to compare to
      Returns:
      a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object
    • getAdminBackendUrl

      public String getAdminBackendUrl()