org.opencms.jsp
Class CmsJspTagContainer

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by org.opencms.jsp.CmsJspTagContainer
All Implemented Interfaces:
java.io.Serializable, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag

public class CmsJspTagContainer
extends javax.servlet.jsp.tagext.TagSupport

Provides access to the page container elements.

Since:
8.0
See Also:
Serialized Form

Nested Class Summary
static class CmsJspTagContainer.JsonContainer
          Json property name constants for containers.
 
Field Summary
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 DUMMY_ELEMENT
          HTML used for invisible dummy elements.
static java.lang.String KEY_CONTAINER_DATA
          Key used to write container data into the javascript window object.
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
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
 
Constructor Summary
CmsJspTagContainer()
           
 
Method Summary
 int doStartTag()
          Internal action method.
protected static java.lang.String getContainerDataTag(CmsContainerBean container, java.lang.String widthStr, boolean isDetailView)
          Creates a new data tag for the given container.
 java.lang.String getDetailview()
          Returns the boolean value if this container is target of detail views.
 java.lang.String getMaxElements()
          Returns the maxElements attribute value.
 java.lang.String getName()
          Returns the name attribute value.
 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)
          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  void printElementWrapperTagEnd(boolean isOnline, boolean isGroupcontainer)
          Prints the closing tag for an element wrapper if in online mode.
protected  void printElementWrapperTagStart(boolean isOnline, CmsObject cms, CmsContainerElementBean elementBean, boolean isGroupContainer)
          Prints the opening element wrapper tag for the container page editor if we are in Offline mode.
 void release()
           
 void setDetailview(java.lang.String detailView)
          Sets if the current container is target of detail views.
 void setMaxElements(java.lang.String maxElements)
          Sets the maxElements attribute value.
 void setName(java.lang.String name)
          Sets the name attribute value.
 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.TagSupport
doAfterBody, doEndTag, 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
 

Field Detail

DEFAULT_MAX_ELEMENTS

public static final java.lang.String DEFAULT_MAX_ELEMENTS
Default number of max elements in the container in case no value has been set.

See Also:
Constant Field Values

DUMMY_ELEMENT

public static final java.lang.String DUMMY_ELEMENT
HTML used for invisible dummy elements.

See Also:
Constant Field Values

KEY_CONTAINER_DATA

public static final java.lang.String KEY_CONTAINER_DATA
Key used to write container data into the javascript window object.

See Also:
Constant Field Values
Constructor Detail

CmsJspTagContainer

public CmsJspTagContainer()
Method Detail

getContainerDataTag

protected static java.lang.String getContainerDataTag(CmsContainerBean container,
                                                      java.lang.String widthStr,
                                                      boolean isDetailView)
                                               throws JSONException
Creates a new data tag for the given container.

Parameters:
container - the container to get the data tag for
widthStr - the width of the container as a string
isDetailView - true if this container is currently being used for the detail view
Returns:
html data tag for the given container
Throws:
JSONException - if there is a problem with JSON manipulation

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)
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
Returns:
the opening tag

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Internal action method.

Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class javax.servlet.jsp.tagext.TagSupport
Returns:
SKIP_BODY
Throws:
javax.servlet.jsp.JspException - in case something goes wrong
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

getMaxElements

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

Returns:
the maxElements attribute value

getName

public java.lang.String getName()
Returns the name attribute value.

Returns:
String the name attribute value

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

release

public void release()
Specified by:
release in interface javax.servlet.jsp.tagext.Tag
Overrides:
release in class javax.servlet.jsp.tagext.TagSupport
See Also:
Tag.release()

setDetailview

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

Parameters:
detailView - true or false

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

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

printElementWrapperTagEnd

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

Parameters:
isOnline - if true, we are online
isGroupcontainer - true if element is a group-container
Throws:
java.io.IOException - if the output fails

printElementWrapperTagStart

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

Parameters:
isOnline - true if we are in Online mode
cms - the Cms context
elementBean - the element bean
isGroupContainer - true if the element is a group-container
Throws:
java.lang.Exception - if something goes wrong