Class CustomSidebarWidget

java.lang.Object
io.goobi.viewer.model.cms.widgets.CustomSidebarWidget
All Implemented Interfaces:
IPolyglott, Serializable
Direct Known Subclasses:
FacetFieldSidebarWidget, HtmlSidebarWidget, PageListSidebarWidget, RssFeedSidebarWidget

@Entity public class CustomSidebarWidget extends Object implements IPolyglott, Serializable
Class to persist user generated CMS-Sidebar widgets in the database. Different types of widgets containing different data are encoded in subclasses. This main class should be considered effectively abstract, even though it cannot be marked as abstract due to dao persistence restrictions. The exact type of custom widget can be gathered from #{CustomSidebarWidgetgetType()

Each inheriting class must implement a cloning constructor, i.e. a constructor taking an argument of the same class and copying all its data

Author:
Florian Alpers
See Also:
  • Field Details

    • id

      protected Long id
      Unique database ID.
  • Constructor Details

    • CustomSidebarWidget

      public CustomSidebarWidget()
    • CustomSidebarWidget

      public CustomSidebarWidget(CustomSidebarWidget source)
      Cloning constructor.
      Parameters:
      source - widget to copy fields from
  • Method Details

    • isComplete

      public boolean isComplete(Locale locale)
      Description copied from interface: IPolyglott
      If this returns true, an associated language tab should have the 'already-translated' class, otherwise the '-partly-translated' class unless IPolyglott.isEmpty(Locale) also returns true.
      Specified by:
      isComplete in interface IPolyglott
      Parameters:
      locale - the locale to check translation completeness for
      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)
      Description copied from interface: IPolyglott
      Only meaningful for the default language for which all required fields must be filled.
      Specified by:
      isValid in interface IPolyglott
      Parameters:
      locale - the locale to validate required fields for
      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
      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)
      Description copied from interface: IPolyglott
      Sets the locale to use for display and editing.
      Specified by:
      setSelectedLocale in interface IPolyglott
      Parameters:
      locale - the locale to select
    • getId

      public Long getId()
    • setId

      public void setId(Long id)
    • getTitle

      public TranslatedText getTitle()
    • setTitle

      public void setTitle(TranslatedText title)
    • getDescription

      public TranslatedText getDescription()
    • getType

      public CustomWidgetType getType()
      Return the type of this custom sidebar widget. Must be implemented by subclasses of CustomSidebarWidget
      Returns:
      CustomWidgetType
    • getStyleClass

      public String getStyleClass()
      Returns:
      the css style class to use for this widget, if any
    • setStyleClass

      public void setStyleClass(String styleClass)
      Sets the css style class to use for this widget.
      Parameters:
      styleClass - CSS class name to apply to this widget
    • isCollapsed

      public boolean isCollapsed()
      Returns:
      true if the widget should initially be displayed in a collapsed state with a button to expand it
    • setCollapsed

      public void setCollapsed(boolean collapsed)
      Sets this widget to be displayed as a collapseable.
      Parameters:
      collapsed - true if the widget should be rendered in collapsed state by default
    • clone

      public static CustomSidebarWidget clone(CustomSidebarWidget o)
      Creates a copy of the given custom widget o. Depends on cloning constructors if sublass
      Parameters:
      o - widget instance to clone
      Returns:
      CustomSidebarWidget
    • isHasShortDescription

      public boolean isHasShortDescription()
    • getShortDescription

      public de.intranda.metadata.multilanguage.IMetadataValue getShortDescription(int maxLength)
    • getAdminBackendUrl

      public String getAdminBackendUrl()