Package org.opencms.jsp
Class CmsJspTagResourceLoad
java.lang.Object
javax.servlet.jsp.tagext.TagSupport
javax.servlet.jsp.tagext.BodyTagSupport
org.opencms.jsp.CmsJspScopedVarBodyTagSuport
org.opencms.jsp.CmsJspTagResourceLoad
- All Implemented Interfaces:
Serializable
,javax.servlet.jsp.tagext.BodyTag
,javax.servlet.jsp.tagext.IterationTag
,javax.servlet.jsp.tagext.JspTag
,javax.servlet.jsp.tagext.Tag
,I_CmsResourceContainer
- Direct Known Subclasses:
CmsJspTagContentLoad
public class CmsJspTagResourceLoad
extends CmsJspScopedVarBodyTagSuport
implements I_CmsResourceContainer
Implementation of the
<cms:resourceload/>
tag,
used to access and display resource information from the VFS.- Since:
- 8.0
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected CmsObject
The CmsObject for the current user.protected String
The name of the collector to use for list building.protected String
The name of the resource collector used.protected String
The parameters of the resource collector uses.protected List<CmsResource>
The list of collected resource items.protected CmsContentInfoBean
The bean to store information required to make the result list browsable.protected CmsFlexController
The FlexController for the current request.protected String
The index of the current page that gets displayed.protected String
The number of page links in the Google-like page navigation.protected String
The size of a page to be displayed.protected String
Parameter used for the collector.protected boolean
Indicates if the collector results should be preloaded.protected String
The (optional) property to extend the parameter with.protected CmsResource
Reference to the last loaded resource element.protected String
The file name to load the current content value from.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
ConstructorDescriptionEmpty constructor, required for JSP tags.CmsJspTagResourceLoad
(I_CmsResourceContainer container, javax.servlet.jsp.PageContext context, String collectorName, String collectorParam) Constructor used when usingresourceload
from scriptlet code.CmsJspTagResourceLoad
(I_CmsResourceContainer container, javax.servlet.jsp.PageContext context, String collectorName, String collectorParam, String pageIndex, String pageSize) Constructor used when usingresourceload
from scriptlet code. -
Method Summary
Modifier and TypeMethodDescriptionint
int
doEndTag()
protected void
Load the next resource from the initialized list of resources.int
Returns the collector.Returns the name of the currently used resource collector.Returns the parameters of the currently used resource collector.Returns the list of all currently loaded resources (instances of
).CmsResource
protected CmsContentInfoBean
Returns the content info bean.protected CmsResource
Returns the next resource from the collector.Returns the index of the page to be displayed.Returns the number of page links in the Google-like page navigation.Returns the size of a single page to be displayed.getParam()
Returns the collector parameter.Returns"true"
if this content load tag should only preload the values from the collector.Returns the property.Returns the currently loaded resource.Returns the resource name in the VFS for the currently loaded resource.protected static String
getResourceName
(CmsObject cms, I_CmsResourceContainer contentContainer) Returns the resource name currently processed.boolean
Deprecated.boolean
Resource iteration method to be used by JSP scriptlet code.protected void
init
(I_CmsResourceContainer container) Initializes this content load tag.boolean
Returnstrue
if this container is used as a resource preloader.protected static List<CmsResource>
limitCollectorResult
(CmsContentInfoBean contentInfoBean, List<CmsResource> collectorResult) Limits the collector's result list to the size of a page to be displayed in a JSP.void
release()
void
setCollector
(String collector) Sets the collector name.void
setPageIndex
(String pageIndex) Sets the index of the page to be displayed.void
setPageNavLength
(String pageNavLength) Sets the number of page links in the Google-like page navigation.void
setPageSize
(String pageSize) Sets the size of a single page to be displayed.void
Sets the collector parameter.void
setPreload
(String preload) Sets the preload flag for this resource load tag.void
setProperty
(String property) Sets the property.Methods inherited from class org.opencms.jsp.CmsJspScopedVarBodyTagSuport
getScope, getScopeAsInt, getScopeAsString, getScopeInt, getVar, isScopeVarSet, setScope, setVar, storeAttribute, storeAttribute
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
-
Field Details
-
m_cms
The CmsObject for the current user. -
m_collector
The name of the collector to use for list building. -
m_collectorName
The name of the resource collector used. -
m_collectorParam
The parameters of the resource collector uses. -
m_collectorResult
The list of collected resource items. -
m_contentInfoBean
The bean to store information required to make the result list browsable. -
m_controller
The FlexController for the current request. -
m_pageIndex
The index of the current page that gets displayed. -
m_pageSize
The size of a page to be displayed. -
m_param
Parameter used for the collector. -
m_preload
Indicates if the collector results should be preloaded. -
m_property
The (optional) property to extend the parameter with. -
m_resource
Reference to the last loaded resource element. -
m_resourceName
The file name to load the current content value from.
-
-
Constructor Details
-
CmsJspTagResourceLoad
public CmsJspTagResourceLoad()Empty constructor, required for JSP tags. -
CmsJspTagResourceLoad
public CmsJspTagResourceLoad(I_CmsResourceContainer container, javax.servlet.jsp.PageContext context, String collectorName, String collectorParam) throws javax.servlet.jsp.JspException Constructor used when usingresourceload
from scriptlet code.- Parameters:
container
- the parent resource container (could be a preloader)context
- the JSP page contextcollectorName
- the collector name to usecollectorParam
- the collector param to use- Throws:
javax.servlet.jsp.JspException
- in case something goes wrong
-
CmsJspTagResourceLoad
public CmsJspTagResourceLoad(I_CmsResourceContainer container, javax.servlet.jsp.PageContext context, String collectorName, String collectorParam, String pageIndex, String pageSize) throws javax.servlet.jsp.JspException Constructor used when usingresourceload
from scriptlet code.- Parameters:
container
- the parent resource container (could be a preloader)context
- the JSP page contextcollectorName
- the collector name to usecollectorParam
- the collector param to usepageIndex
- the display page index (may contain macros)pageSize
- the display page size (may contain macros)- Throws:
javax.servlet.jsp.JspException
- in case something goes wrong
-
-
Method Details
-
getResourceName
Returns the resource name currently processed.- Parameters:
cms
- the current OpenCms user contextcontentContainer
- the current resource container- Returns:
- the resource name currently processed
-
limitCollectorResult
protected static List<CmsResource> limitCollectorResult(CmsContentInfoBean contentInfoBean, List<CmsResource> collectorResult) Limits the collector's result list to the size of a page to be displayed in a JSP.- Parameters:
contentInfoBean
- the info bean of the collectorcollectorResult
- the result list of the collector- Returns:
- a limited collector's result list
-
doAfterBody
- Specified by:
doAfterBody
in interfacejavax.servlet.jsp.tagext.IterationTag
- Overrides:
doAfterBody
in classjavax.servlet.jsp.tagext.BodyTagSupport
- Throws:
javax.servlet.jsp.JspException
- See Also:
-
BodyTagSupport.doAfterBody()
-
doEndTag
- Specified by:
doEndTag
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
doEndTag
in classjavax.servlet.jsp.tagext.BodyTagSupport
- See Also:
-
Tag.doEndTag()
-
doStartTag
- Specified by:
doStartTag
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
doStartTag
in classjavax.servlet.jsp.tagext.BodyTagSupport
- Throws:
javax.servlet.jsp.JspException
CmsIllegalArgumentException
- See Also:
-
Tag.doStartTag()
-
getCollector
Returns the collector.- Returns:
- the collector
-
getCollectorName
Description copied from interface:I_CmsResourceContainer
Returns the name of the currently used resource collector.- Specified by:
getCollectorName
in interfaceI_CmsResourceContainer
- Returns:
- the name of the currently used resource collector
- See Also:
-
getCollectorParam
Description copied from interface:I_CmsResourceContainer
Returns the parameters of the currently used resource collector.- Specified by:
getCollectorParam
in interfaceI_CmsResourceContainer
- Returns:
- the parameters of the currently used resource collector
- See Also:
-
getCollectorResult
Description copied from interface:I_CmsResourceContainer
Returns the list of all currently loaded resources (instances of
).CmsResource
- Specified by:
getCollectorResult
in interfaceI_CmsResourceContainer
- Returns:
- the list of all currently loaded resources
- See Also:
-
getPageIndex
Returns the index of the page to be displayed.- Returns:
- the index of the page to be displayed
-
getPageSize
Returns the size of a single page to be displayed.- Returns:
- the size of a single page to be displayed
-
getParam
Returns the collector parameter.- Returns:
- the collector parameter
-
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
Returns the property.- Returns:
- the property
-
getResource
Description copied from interface:I_CmsResourceContainer
Returns the currently loaded resource.- Specified by:
getResource
in interfaceI_CmsResourceContainer
- Returns:
- the currently loaded resource
- See Also:
-
getResourceName
Description copied from interface:I_CmsResourceContainer
Returns the resource name in the VFS for the currently loaded resource.- Specified by:
getResourceName
in interfaceI_CmsResourceContainer
- Returns:
- the resource name in the VFS for the currently loaded resource
- See Also:
-
hasMoreContent
Deprecated.Description copied from interface:I_CmsResourceContainer
Resource 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 interfaceI_CmsResourceContainer
- Returns:
true
if more resources are to be iterated- Throws:
javax.servlet.jsp.JspException
- in case something goes wrong- See Also:
-
hasMoreResources
Description copied from interface:I_CmsResourceContainer
Resource 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:
hasMoreResources
in interfaceI_CmsResourceContainer
- Returns:
true
if more resources are to be iterated- Throws:
javax.servlet.jsp.JspException
- in case something goes wrong- See Also:
-
isPreloader
Description copied from interface:I_CmsResourceContainer
Returnstrue
if this container is used as a resource preloader.A resource preloader is used to load resources without looping through it.
- Specified by:
isPreloader
in interfaceI_CmsResourceContainer
- Returns:
true
if this container is used as a resource preloader- See Also:
-
release
- Specified by:
release
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
release
in classCmsJspScopedVarBodyTagSuport
- See Also:
-
Tag.release()
-
setCollector
Sets the collector name.- Parameters:
collector
- the collector name to set
-
setPageIndex
Sets the index of the page to be displayed.- Parameters:
pageIndex
- the index of the page to be displayed
-
setPageSize
Sets the size of a single page to be displayed.- Parameters:
pageSize
- the size of a single page to be displayed
-
setParam
Sets the collector parameter.- Parameters:
param
- the collector parameter to set
-
setPreload
Sets the preload flag for this resource 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
Sets the property.- Parameters:
property
- the property to set
-
doLoadNextResource
Load the next resource from the initialized list of resources. -
getContentInfoBean
Returns the content info bean.- Returns:
- the content info bean
-
getNextResource
Returns the next resource from the collector.- Returns:
- the next resource from the collector
-
init
Initializes this content load tag.- Parameters:
container
- the parent container (could be a preloader)- Throws:
javax.servlet.jsp.JspException
- in case something goes wrong
-