org.opencms.jsp
Class CmsJspTagContentLoad

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by javax.servlet.jsp.tagext.BodyTagSupport
          extended by org.opencms.jsp.CmsJspTagContentLoad
All Implemented Interfaces:
java.io.Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.Tag, I_CmsXmlContentContainer

public class CmsJspTagContentLoad
extends javax.servlet.jsp.tagext.BodyTagSupport
implements I_CmsXmlContentContainer

Implementation of the <cms:contentload/> tag, used to access and display XML content item information from the VFS.

Since:
6.0.0
Version:
$Revision: 1.35 $
Author:
Alexander Kandzior
See Also:
Serialized Form

Field Summary
 
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
 
Constructor Summary
CmsJspTagContentLoad()
          Empty constructor, required for JSP tags.
CmsJspTagContentLoad(I_CmsXmlContentContainer container, javax.servlet.jsp.PageContext context, java.lang.String collectorName, java.lang.String collectorParam, java.util.Locale locale, boolean editable)
          Constructor used when using contentload from scriptlet code.
CmsJspTagContentLoad(I_CmsXmlContentContainer container, javax.servlet.jsp.PageContext context, java.lang.String collectorName, java.lang.String collectorParam, java.lang.String pageIndex, java.lang.String pageSize, java.util.Locale locale, boolean editable)
          Constructor used when using contentload from scriptlet code.
CmsJspTagContentLoad(I_CmsXmlContentContainer container, javax.servlet.jsp.PageContext context, java.lang.String collectorName, java.lang.String collectorParam, java.lang.String pageIndex, java.lang.String pageSize, java.util.Locale locale, CmsDirectEditMode editMode)
          Constructor used when using contentload from scriptlet code.
 
Method Summary
 int doAfterBody()
           
 int doEndTag()
           
protected  void doLoadNextFile()
          Load the next file name from the initialized list of file names.
 int doStartTag()
           
 java.lang.String getCollector()
          Returns the collector.
 java.lang.String getCollectorName()
          Returns the name of the currently used XML content collector.
 java.lang.String getCollectorParam()
          Returns the parameters of the currently used XML content collector.
 java.util.List getCollectorResult()
          Returns the list of all currently loaded XML content documents (instances of I_CmsXmlDocument).
protected  CmsContentInfoBean getContentInfoBean()
          Returns the content info bean.
 java.lang.String getEditable()
          Returns the editable flag.
 java.lang.String getLocale()
          Returns the locale.
 java.lang.String getPageIndex()
          Returns the index of the page to be displayed.
 java.lang.String getPageNavLength()
          Returns the number of page links in the Google-like page navigation.
 java.lang.String getPageSize()
          Returns the size of a single page to be displayed.
 java.lang.String getParam()
          Returns the collector parameter.
 java.lang.String getPreload()
          Returns "true" if this content load tag should only preload the values from the collector.
 java.lang.String getProperty()
          Returns the property.
 java.lang.String getResourceName()
          Returns the resource name in the VFS for the currently loaded XML content document.
protected static java.lang.String getResourceName(CmsObject cms, I_CmsXmlContentContainer contentContainer)
          Returns the resource name currently processed.
 I_CmsXmlDocument getXmlDocument()
          Returns the currently loaded OpenCms XML content document.
 java.lang.String getXmlDocumentElement()
          Returns the currently selected element name in the loaded XML content document.
 java.util.Locale getXmlDocumentLocale()
          Returns the currently selected locale used for acessing the content in the loaded XML content document.
 boolean hasMoreContent()
          Content iteration method to be used by JSP scriptlet code.
protected  void init(I_CmsXmlContentContainer container)
          Initializes this content load tag.
 boolean isPreloader()
          Returns true if this container is used as a content preloader.
 void release()
           
 void setCollector(java.lang.String collector)
          Sets the collector.
 void setEditable(java.lang.String mode)
          Sets the editable mode.
 void setLocale(java.lang.String locale)
          Sets the locale.
 void setPageIndex(java.lang.String pageIndex)
          Sets the index of the page to be displayed.
 void setPageNavLength(java.lang.String pageNavLength)
          Sets the number of page links in the Google-like page navigation.
 void setPageSize(java.lang.String pageSize)
          Sets the size of a single page to be displayed.
 void setParam(java.lang.String param)
          Sets the collector parameter.
 void setPreload(java.lang.String preload)
          Sets the preload flag for this content load tag.
 void setProperty(java.lang.String property)
          Sets the property.
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doInitBody, getBodyContent, getPreviousOut, 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
 

Constructor Detail

CmsJspTagContentLoad

public CmsJspTagContentLoad()
Empty constructor, required for JSP tags.


CmsJspTagContentLoad

public CmsJspTagContentLoad(I_CmsXmlContentContainer container,
                            javax.servlet.jsp.PageContext context,
                            java.lang.String collectorName,
                            java.lang.String collectorParam,
                            java.util.Locale locale,
                            boolean editable)
                     throws javax.servlet.jsp.JspException
Constructor used when using contentload from scriptlet code.

Parameters:
container - the parent content container (could be a preloader)
context - the JSP page context
collectorName - the collector name to use
collectorParam - the collector param to use
locale - the locale to use
editable - indicates if "direct edit" support is wanted
Throws:
javax.servlet.jsp.JspException - in case something goes wrong

CmsJspTagContentLoad

public CmsJspTagContentLoad(I_CmsXmlContentContainer container,
                            javax.servlet.jsp.PageContext context,
                            java.lang.String collectorName,
                            java.lang.String collectorParam,
                            java.lang.String pageIndex,
                            java.lang.String pageSize,
                            java.util.Locale locale,
                            boolean editable)
                     throws javax.servlet.jsp.JspException
Constructor used when using contentload from scriptlet code.

Parameters:
container - the parent content container (could be a preloader)
context - the JSP page context
collectorName - the collector name to use
collectorParam - the collector param to use
pageIndex - the display page index (may contain macros)
pageSize - the display page size (may contain macros)
locale - the locale to use
editable - indicates if "direct edit" support is wanted
Throws:
javax.servlet.jsp.JspException - in case something goes wrong

CmsJspTagContentLoad

public CmsJspTagContentLoad(I_CmsXmlContentContainer container,
                            javax.servlet.jsp.PageContext context,
                            java.lang.String collectorName,
                            java.lang.String collectorParam,
                            java.lang.String pageIndex,
                            java.lang.String pageSize,
                            java.util.Locale locale,
                            CmsDirectEditMode editMode)
                     throws javax.servlet.jsp.JspException
Constructor used when using contentload from scriptlet code.

Parameters:
container - the parent content container (could be a preloader)
context - the JSP page context
collectorName - the collector name to use
collectorParam - the collector param to use
pageIndex - the display page index (may contain macros)
pageSize - the display page size (may contain macros)
locale - the locale to use
editMode - indicates which "direct edit" mode is wanted
Throws:
javax.servlet.jsp.JspException - in case something goes wrong
Method Detail

getResourceName

protected static java.lang.String getResourceName(CmsObject cms,
                                                  I_CmsXmlContentContainer contentContainer)
Returns the resource name currently processed.

Parameters:
cms - the current OpenCms user context
contentContainer - the current content container
Returns:
the resource name currently processed

doAfterBody

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

doEndTag

public int doEndTag()
Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doEndTag in class javax.servlet.jsp.tagext.BodyTagSupport
See Also:
Tag.doEndTag()

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException,
                      CmsIllegalArgumentException
Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class javax.servlet.jsp.tagext.BodyTagSupport
Throws:
javax.servlet.jsp.JspException
CmsIllegalArgumentException
See Also:
Tag.doStartTag()

getCollector

public java.lang.String getCollector()
Returns the collector.

Returns:
the collector

getCollectorName

public java.lang.String getCollectorName()
Description copied from interface: I_CmsXmlContentContainer
Returns the name of the currently used XML content collector.

Specified by:
getCollectorName in interface I_CmsXmlContentContainer
Returns:
the name of the currently used XML content collector
See Also:
I_CmsXmlContentContainer.getCollectorName()

getCollectorParam

public java.lang.String getCollectorParam()
Description copied from interface: I_CmsXmlContentContainer
Returns the parameters of the currently used XML content collector.

Specified by:
getCollectorParam in interface I_CmsXmlContentContainer
Returns:
the parameters of the currently used XML content collector
See Also:
I_CmsXmlContentContainer.getCollectorParam()

getCollectorResult

public java.util.List getCollectorResult()
Description copied from interface: I_CmsXmlContentContainer
Returns the list of all currently loaded XML content documents (instances of I_CmsXmlDocument).

Specified by:
getCollectorResult in interface I_CmsXmlContentContainer
Returns:
the list of all currently loaded XML content documents
See Also:
I_CmsXmlContentContainer.getCollectorResult()

getEditable

public java.lang.String getEditable()
Returns the editable flag.

Returns:
the editable flag

getLocale

public java.lang.String getLocale()
Returns the locale.

Returns:
the locale

getPageIndex

public java.lang.String getPageIndex()
Returns the index of the page to be displayed.

Returns:
the index of the page to be displayed

getPageNavLength

public java.lang.String getPageNavLength()
Returns the number of page links in the Google-like page navigation.

Returns:
the number of page links in the Google-like page navigation

getPageSize

public java.lang.String getPageSize()
Returns the size of a single page to be displayed.

Returns:
the size of a single page to be displayed

getParam

public java.lang.String getParam()
Returns the collector parameter.

Returns:
the collector parameter

getPreload

public java.lang.String getPreload()
Returns "true" if this content load tag should only preload the values from the collector.

Returns:
"true" if this content load tag should only preload the values from the collector

getProperty

public java.lang.String getProperty()
Returns the property.

Returns:
the property

getResourceName

public java.lang.String getResourceName()
Description copied from interface: I_CmsXmlContentContainer
Returns the resource name in the VFS for the currently loaded XML content document.

Specified by:
getResourceName in interface I_CmsXmlContentContainer
Returns:
the resource name in the VFS for the currently loaded XML content document
See Also:
I_CmsXmlContentContainer.getResourceName()

getXmlDocument

public I_CmsXmlDocument getXmlDocument()
Description copied from interface: I_CmsXmlContentContainer
Returns the currently loaded OpenCms XML content document.

Specified by:
getXmlDocument in interface I_CmsXmlContentContainer
Returns:
the currently loaded OpenCms XML content document
See Also:
I_CmsXmlContentContainer.getXmlDocument()

getXmlDocumentElement

public java.lang.String getXmlDocumentElement()
Description copied from interface: I_CmsXmlContentContainer
Returns the currently selected element name in the loaded XML content document.

Specified by:
getXmlDocumentElement in interface I_CmsXmlContentContainer
Returns:
the currently selected element name in the loaded XML content document
See Also:
I_CmsXmlContentContainer.getXmlDocumentElement()

getXmlDocumentLocale

public java.util.Locale getXmlDocumentLocale()
Description copied from interface: I_CmsXmlContentContainer
Returns the currently selected locale used for acessing the content in the loaded XML content document.

Specified by:
getXmlDocumentLocale in interface I_CmsXmlContentContainer
Returns:
the currently selected locale used for acessing the content in the loaded XML content document
See Also:
I_CmsXmlContentContainer.getXmlDocumentLocale()

hasMoreContent

public boolean hasMoreContent()
                       throws javax.servlet.jsp.JspException
Description copied from interface: I_CmsXmlContentContainer
Content iteration method to be used by JSP scriptlet code.

Calling this method will insert "direct edit" HTML to the output page (if required).

Specified by:
hasMoreContent in interface I_CmsXmlContentContainer
Returns:
true if more content is to be iterated
Throws:
javax.servlet.jsp.JspException - in case something goes wrong
See Also:
I_CmsXmlContentContainer.hasMoreContent()

isPreloader

public boolean isPreloader()
Description copied from interface: I_CmsXmlContentContainer
Returns true if this container is used as a content preloader.

A content preloader is used to load content without looping through it.

Specified by:
isPreloader in interface I_CmsXmlContentContainer
Returns:
true if this container is used as a content preloader
See Also:
I_CmsXmlContentContainer.isPreloader()

release

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

setCollector

public void setCollector(java.lang.String collector)
Sets the collector.

Parameters:
collector - the collector to set

setEditable

public void setEditable(java.lang.String mode)
Sets the editable mode.

Parameters:
mode - the mode to set

setLocale

public void setLocale(java.lang.String locale)
Sets the locale.

Parameters:
locale - the locale to set

setPageIndex

public void setPageIndex(java.lang.String pageIndex)
Sets the index of the page to be displayed.

Parameters:
pageIndex - the index of the page to be displayed

setPageNavLength

public void setPageNavLength(java.lang.String pageNavLength)
Sets the number of page links in the Google-like page navigation.

Parameters:
pageNavLength - the number of page links in the Google-like page navigation

setPageSize

public void setPageSize(java.lang.String pageSize)
Sets the size of a single page to be displayed.

Parameters:
pageSize - the size of a single page to be displayed

setParam

public void setParam(java.lang.String param)
Sets the collector parameter.

Parameters:
param - the collector parameter to set

setPreload

public void setPreload(java.lang.String preload)
Sets the preload flag for this content load tag.

If this is set to true, then the collector result will only be preloaded, but not iterated.

Parameters:
preload - the preload flag to set

setProperty

public void setProperty(java.lang.String property)
Sets the property.

Parameters:
property - the property to set

doLoadNextFile

protected void doLoadNextFile()
                       throws CmsException
Load the next file name from the initialized list of file names.

Throws:
CmsException - if something goes wrong

getContentInfoBean

protected CmsContentInfoBean getContentInfoBean()
Returns the content info bean.

Returns:
the content info bean

init

protected void init(I_CmsXmlContentContainer container)
             throws javax.servlet.jsp.JspException
Initializes this content load tag.

Parameters:
container - the parent container (could be a preloader)
Throws:
javax.servlet.jsp.JspException - in case something goes wrong