Class CmsJspTagContainer

  • All Implemented Interfaces:
    java.io.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:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String DEFAULT_MAX_ELEMENTS
      Default number of max elements in the container in case no value has been set.
      static java.lang.String DETAIL_FUNCTION_CONTAINER_NAME
      The detail function container name.
      static java.lang.String DUMMY_ELEMENT
      HTML used for invisible dummy elements.
      • Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport

        bodyContent
      • Fields inherited from class javax.servlet.jsp.tagext.TagSupport

        id, pageContext
      • Fields inherited from interface javax.servlet.jsp.tagext.BodyTag

        EVAL_BODY_BUFFERED, EVAL_BODY_TAG
      • Fields inherited from interface javax.servlet.jsp.tagext.IterationTag

        EVAL_BODY_AGAIN
      • Fields inherited from interface javax.servlet.jsp.tagext.Tag

        EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addParameter​(java.lang.String name, java.lang.String value)
      Add a parameter to this tag.
      int doAfterBody()  
      void doCatch​(java.lang.Throwable t)  
      int doEndTag()  
      void doFinally()  
      int doStartTag()
      Internal action method.
      static I_CmsFormatterBean ensureValidFormatterSettings​(CmsObject cms, CmsContainerElementBean element, CmsADEConfigData adeConfig, java.lang.String containerName, java.lang.String containerType, int containerWidth)
      Ensures the appropriate formatter configuration ID is set in the element settings.
      protected java.lang.String getContainerData​(CmsObject cms, int maxElements, boolean isDetailView, boolean isDetailOnly)
      Returns the serialized data of the given container.
      java.lang.String getDetailview()
      Returns the boolean value if this container is target of detail views.
      java.lang.String getEditableby()
      Returns the editable by tag attribute.
      static I_CmsFormatterBean getFormatterConfigurationForElement​(CmsObject cms, CmsContainerElementBean element, CmsADEConfigData adeConfig, java.lang.String containerName, java.lang.String containerType, int containerWidth)
      Returns the formatter configuration for the given element.
      static java.util.List<CmsContainerElementBean> getGroupContainerElements​(CmsObject cms, CmsContainerElementBean element, javax.servlet.ServletRequest req, java.lang.String containerType)
      Returns the element group elements.
      static java.util.List<CmsContainerElementBean> getInheritedContainerElements​(CmsObject cms, CmsContainerElementBean element)
      Reads elements from an inherited container.
      java.lang.String getMaxElements()
      Returns the maxElements attribute value.
      java.lang.String getName()
      Returns the container name, in case of nested containers with a prefix to guaranty uniqueness.
      java.lang.String getNameprefix()
      Returns the name prefix.
      static java.lang.String getNestedContainerName​(java.lang.String name, java.lang.String parentIstanceId, java.lang.String namePrefix)
      Returns the prefixed nested container name.
      java.lang.String getParam()
      Returns the (optional) container parameter.
      java.lang.String getTag()
      Returns the tag attribute.
      java.lang.String getTagClass()
      Returns the tag class attribute.
      protected static java.lang.String getTagClose​(java.lang.String tagName)
      Creates the closing tag for the container.
      protected static java.lang.String getTagOpen​(java.lang.String tagName, java.lang.String containerName, java.lang.String tagClass, boolean nested, boolean online, java.lang.String containerData)
      Creates the opening tag for the container assigning the appropriate id and class attributes.
      java.lang.String getType()
      Returns the type attribute value.
      java.lang.String getWidth()
      Returns the container width as a string.
      protected boolean isEditable​(CmsObject cms)
      Returns if the container is editable by the current user.
      protected boolean isNested()
      Returns true if this is a nested container.
      protected void printElementWrapperTagEnd​(boolean isGroupcontainer)
      Prints the closing tag for an element wrapper if in online mode.
      protected void printElementWrapperTagStart​(CmsObject cms, CmsContainerElementBean elementBean, CmsContainerPageBean page, boolean isGroupContainer)
      Prints the opening element wrapper tag for the container page editor if we are in Offline mode.
      void setCacheable​(java.lang.String cacheable)
      Sets the 'cacheable' mode for included formatters.
      void setDetailonly​(java.lang.String detailOnly)
      Sets if this container should only be displayed on detail pages.
      void setDetailview​(java.lang.String detailView)
      Sets if the current container is target of detail views.
      void setEditableby​(java.lang.String editableBy)
      Sets the editable by tag attribute.
      void setMaxElements​(java.lang.String maxElements)
      Sets the maxElements attribute value.
      void setName​(java.lang.String name)
      Sets the name attribute value.
      void setNameprefix​(java.lang.String namePrefix)
      Sets the name prefix.
      void setParam​(java.lang.String param)
      Sets the container parameter.
      void setSettings​(java.lang.Object presets)
      Sets the setting presets.
      void setTag​(java.lang.String tag)
      Sets the tag attribute.
      void setTagClass​(java.lang.String tagClass)
      Sets the tag class attribute.
      void setType​(java.lang.String type)
      Sets the type attribute value.
      void setWidth​(java.lang.String width)
      Sets the container width as a string.
      • Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport

        doInitBody, getBodyContent, getPreviousOut, release, setBodyContent
      • Methods inherited from class javax.servlet.jsp.tagext.TagSupport

        findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface javax.servlet.jsp.tagext.Tag

        getParent, setPageContext, setParent
    • Method Detail

      • ensureValidFormatterSettings

        public static I_CmsFormatterBean ensureValidFormatterSettings​(CmsObject cms,
                                                                      CmsContainerElementBean element,
                                                                      CmsADEConfigData adeConfig,
                                                                      java.lang.String containerName,
                                                                      java.lang.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,
                                                                             java.lang.String containerName,
                                                                             java.lang.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
      • getNestedContainerName

        public static java.lang.String getNestedContainerName​(java.lang.String name,
                                                              java.lang.String parentIstanceId,
                                                              java.lang.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 java.lang.String getTagClose​(java.lang.String tagName)
        Creates the closing tag for the container.

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

        protected static java.lang.String getTagOpen​(java.lang.String tagName,
                                                     java.lang.String containerName,
                                                     java.lang.String tagClass,
                                                     boolean nested,
                                                     boolean online,
                                                     java.lang.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
      • 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​(java.lang.Throwable t)
                     throws java.lang.Throwable
        Specified by:
        doCatch in interface javax.servlet.jsp.tagext.TryCatchFinally
        Throws:
        java.lang.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

        public java.lang.String getDetailview()
        Returns the boolean value if this container is target of detail views.

        Returns:
        true or false
      • getEditableby

        public java.lang.String getEditableby()
        Returns the editable by tag attribute.

        Returns:
        the editable by tag attribute
      • getMaxElements

        public java.lang.String getMaxElements()
        Returns the maxElements attribute value.

        Returns:
        the maxElements attribute value
      • getName

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

        Returns:
        String the container name
      • getNameprefix

        public java.lang.String getNameprefix()
        Returns the name prefix.

        Returns:
        the namePrefix
      • getParam

        public java.lang.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 java.lang.String getTag()
        Returns the tag attribute.

        Returns:
        the tag attribute
      • getTagClass

        public java.lang.String getTagClass()
        Returns the tag class attribute.

        Returns:
        the tag class attribute
      • getType

        public java.lang.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 java.lang.String getWidth()
        Returns the container width as a string.

        Returns:
        the container width as a string
      • setCacheable

        public void setCacheable​(java.lang.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​(java.lang.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​(java.lang.String detailView)
        Sets if the current container is target of detail views.

        Parameters:
        detailView - true or false
      • setEditableby

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

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

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

        Parameters:
        maxElements - the maxElements value to set
      • setName

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

        Parameters:
        name - the name value to set
      • setNameprefix

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

        Parameters:
        namePrefix - the name prefix to set
      • setParam

        public void setParam​(java.lang.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​(java.lang.Object presets)
        Sets the setting presets.

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

        public void setTag​(java.lang.String tag)
        Sets the tag attribute.

        Parameters:
        tag - the createTag to set
      • setTagClass

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

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

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

        Parameters:
        type - the type value to set
      • setWidth

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

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

        protected java.lang.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 java.io.IOException
        Prints the closing tag for an element wrapper if in online mode.

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

        protected void printElementWrapperTagStart​(CmsObject cms,
                                                   CmsContainerElementBean elementBean,
                                                   CmsContainerPageBean page,
                                                   boolean isGroupContainer)
                                            throws java.lang.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:
        java.lang.Exception - if something goes wrong