Class CmsJspTagContainer

java.lang.Object
javax.servlet.jsp.tagext.TagSupport
javax.servlet.jsp.tagext.BodyTagSupport
org.opencms.jsp.CmsJspTagContainer
All Implemented Interfaces:
Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag, javax.servlet.jsp.tagext.TryCatchFinally, I_CmsJspTagParamParent

public class CmsJspTagContainer extends javax.servlet.jsp.tagext.BodyTagSupport implements javax.servlet.jsp.tagext.TryCatchFinally, I_CmsJspTagParamParent
Provides access to the page container elements.

Since:
8.0
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • ensureValidFormatterSettings

      public static I_CmsFormatterBean ensureValidFormatterSettings(CmsObject cms, CmsContainerElementBean element, CmsADEConfigData adeConfig, String containerName, String containerType, int containerWidth)
      Ensures the appropriate formatter configuration ID is set in the element settings.

      Parameters:
      cms - the cms context
      element - the element bean
      adeConfig - the ADE configuration data
      containerName - the container name
      containerType - the container type
      containerWidth - the container width
      Returns:
      the formatter configuration bean, may be null if no formatter available or a schema formatter is used
    • getFormatterConfigurationForElement

      public static I_CmsFormatterBean getFormatterConfigurationForElement(CmsObject cms, CmsContainerElementBean element, CmsADEConfigData adeConfig, String containerName, String containerType, int containerWidth)
      Returns the formatter configuration for the given element.

      Parameters:
      cms - the cms context
      element - the element bean
      adeConfig - the ADE configuration
      containerName - the container name
      containerType - the container type
      containerWidth - the container width
      Returns:
      the formatter configuration
    • getGroupContainerElements

      public static List<CmsContainerElementBean> getGroupContainerElements(CmsObject cms, CmsContainerElementBean element, javax.servlet.ServletRequest req, String containerType) throws CmsException
      Returns the element group elements.

      Parameters:
      cms - the current cms context
      element - group element
      req - the servlet request
      containerType - the container type
      Returns:
      the elements of this group
      Throws:
      CmsException - if something goes wrong
    • getInheritedContainerElements

      Reads elements from an inherited container.

      Parameters:
      cms - the current CMS context
      element - the element which references the inherited container
      Returns:
      the container elements
    • getNestedContainerName

      public static String getNestedContainerName(String name, String parentIstanceId, String namePrefix)
      Returns the prefixed nested container name.

      This will be either {parentInstanceId}-{name} or {namePrefix}-{name} or in case namePrefix equals 'none' {name} only.

      Parameters:
      name - the container name
      parentIstanceId - the parent instance id
      namePrefix - the name prefix attribute
      Returns:
      the nested container name
    • getTagClose

      protected static String getTagClose(String tagName)
      Creates the closing tag for the container.

      Parameters:
      tagName - the tag name
      Returns:
      the closing tag
    • getTagOpen

      protected static String getTagOpen(String tagName, String containerName, String tagClass, boolean nested, boolean online, String containerData)
      Creates the opening tag for the container assigning the appropriate id and class attributes.

      Parameters:
      tagName - the tag name
      containerName - the container name used as id attribute value
      tagClass - the tag class attribute value
      nested - true if this is a nested container
      online - true if we are in the online project
      containerData - the container data
      Returns:
      the opening tag
    • addParameter

      public void addParameter(String name, String value)
      Description copied from interface: I_CmsJspTagParamParent
      Add a parameter to this tag. The intent is that the <param> subtag will call this to register parameters. Assumes that 'name' and 'value' are appropriately encoded and do not contain any meaningful metacharacters; in order words, escaping is the responsibility of the caller.
      Specified by:
      addParameter in interface I_CmsJspTagParamParent
      Parameters:
      name - the name of the parameter
      value - the value of the parameter
      See Also:
    • doAfterBody

      public int doAfterBody()
      Specified by:
      doAfterBody in interface javax.servlet.jsp.tagext.IterationTag
      Overrides:
      doAfterBody in class javax.servlet.jsp.tagext.BodyTagSupport
      See Also:
      • BodyTagSupport.doAfterBody()
    • doCatch

      public void doCatch(Throwable t) throws Throwable
      Specified by:
      doCatch in interface javax.servlet.jsp.tagext.TryCatchFinally
      Throws:
      Throwable
      See Also:
      • TryCatchFinally.doCatch(java.lang.Throwable)
    • doEndTag

      public int doEndTag() throws javax.servlet.jsp.JspException
      Specified by:
      doEndTag in interface javax.servlet.jsp.tagext.Tag
      Overrides:
      doEndTag in class javax.servlet.jsp.tagext.BodyTagSupport
      Throws:
      javax.servlet.jsp.JspException
      See Also:
      • TagSupport.doEndTag()
    • doFinally

      public void doFinally()
      Specified by:
      doFinally in interface javax.servlet.jsp.tagext.TryCatchFinally
      See Also:
      • TryCatchFinally.doFinally()
    • doStartTag

      public int doStartTag()
      Internal action method.

      Specified by:
      doStartTag in interface javax.servlet.jsp.tagext.Tag
      Overrides:
      doStartTag in class javax.servlet.jsp.tagext.BodyTagSupport
      Returns:
      EVAL_BODY_BUFFERED
      See Also:
      • Tag.doStartTag()
    • getDetailview

      Returns the boolean value if this container is target of detail views.

      Returns:
      true or false
    • getEditableby

      Returns the editable by tag attribute.

      Returns:
      the editable by tag attribute
    • getMaxElements

      Returns the maxElements attribute value.

      Returns:
      the maxElements attribute value
    • getName

      public String getName()
      Returns the container name, in case of nested containers with a prefix to guaranty uniqueness.

      Returns:
      String the container name
    • getNameprefix

      Returns the name prefix.

      Returns:
      the namePrefix
    • getParam

      public String getParam()
      Returns the (optional) container parameter.

      This is useful for a dynamically generated nested container, to pass information to the formatter used inside that container. If no parameters have been set, this will return null

      Returns:
      the (optional) container parameter
    • getTag

      public String getTag()
      Returns the tag attribute.

      Returns:
      the tag attribute
    • getTagClass

      public String getTagClass()
      Returns the tag class attribute.

      Returns:
      the tag class attribute
    • getType

      public String getType()
      Returns the type attribute value.

      If the container type has not been set, the name is substituted as type.

      Returns:
      the type attribute value
    • getWidth

      public String getWidth()
      Returns the container width as a string.

      Returns:
      the container width as a string
    • setCacheable

      public void setCacheable(String cacheable)
      Sets the 'cacheable' mode for included formatters.

      If this is set to false, formatters will never be included in cacheable mode, otherwise they will only be included in cacheable mode in the Online project.

      Parameters:
      cacheable - the cacheable mode (true or false)
    • setDetailonly

      public void setDetailonly(String detailOnly)
      Sets if this container should only be displayed on detail pages.

      Parameters:
      detailOnly - if this container should only be displayed on detail pages
    • setDetailview

      public void setDetailview(String detailView)
      Sets if the current container is target of detail views.

      Parameters:
      detailView - true or false
    • setEditableby

      public void setEditableby(String editableBy)
      Sets the editable by tag attribute.

      Parameters:
      editableBy - the editable by tag attribute to set
    • setMaxElements

      public void setMaxElements(String maxElements)
      Sets the maxElements attribute value.

      Parameters:
      maxElements - the maxElements value to set
    • setName

      public void setName(String name)
      Sets the name attribute value.

      Parameters:
      name - the name value to set
    • setNameprefix

      public void setNameprefix(String namePrefix)
      Sets the name prefix.

      Parameters:
      namePrefix - the name prefix to set
    • setParam

      public void setParam(String param)
      Sets the container parameter.

      This is useful for a dynamically generated nested container, to pass information to the formatter used inside that container.

      Parameters:
      param - the parameter String to set
    • setSettings

      public void setSettings(Object presets)
      Sets the setting presets.

      Parameters:
      presets - a map with string keys and values, or null
    • setTag

      public void setTag(String tag)
      Sets the tag attribute.

      Parameters:
      tag - the createTag to set
    • setTagClass

      public void setTagClass(String tagClass)
      Sets the tag class attribute.

      Parameters:
      tagClass - the tag class attribute to set
    • setType

      public void setType(String type)
      Sets the type attribute value.

      Parameters:
      type - the type value to set
    • setWidth

      public void setWidth(String width)
      Sets the container width as a string.

      Parameters:
      width - the container width as a string
    • getContainerData

      protected String getContainerData(CmsObject cms, int maxElements, boolean isDetailView, boolean isDetailOnly)
      Returns the serialized data of the given container.

      Parameters:
      cms - the cms context
      maxElements - the maximum number of elements allowed within this container
      isDetailView - true if this container is currently being used for the detail view
      isDetailOnly - true if this is a detail only container
      Returns:
      the serialized container data
    • isEditable

      protected boolean isEditable(CmsObject cms)
      Returns if the container is editable by the current user.

      Parameters:
      cms - the cms context
      Returns:
      true if the container is editable by the current user
    • isNested

      protected boolean isNested()
      Returns true if this is a nested container.

      Returns:
      true if this is a nested container
    • printElementWrapperTagEnd

      protected void printElementWrapperTagEnd(boolean isGroupcontainer) throws IOException
      Prints the closing tag for an element wrapper if in online mode.

      Parameters:
      isGroupcontainer - true if element is a group-container
      Throws:
      IOException - if the output fails
    • printElementWrapperTagStart

      protected void printElementWrapperTagStart(CmsObject cms, CmsContainerElementBean elementBean, CmsContainerPageBean page, boolean isGroupContainer) throws Exception
      Prints the opening element wrapper tag for the container page editor if we are in Offline mode.

      Parameters:
      cms - the Cms context
      elementBean - the element bean
      page - the container page
      isGroupContainer - true if the element is a group-container
      Throws:
      Exception - if something goes wrong