Package org.opencms.jsp
Class CmsJspTagImage
java.lang.Object
javax.servlet.jsp.tagext.TagSupport
javax.servlet.jsp.tagext.BodyTagSupport
org.opencms.jsp.CmsJspImageScalerTagSupport
org.opencms.jsp.CmsJspTagImage
- 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_CmsJspTagParamParent
Creates HTML code for <img src> tags that use the OpenCms image scaling capabilities.
- Since:
- 6.2.0
- See Also:
-
Field Summary
Fields inherited from class org.opencms.jsp.CmsJspImageScalerTagSupport
m_scaler, m_src, SCALE_ATTR_HEIGHT, SCALE_ATTR_MAXHEIGHT, SCALE_ATTR_MAXWIDTH, SCALE_ATTR_POSITION, SCALE_ATTR_QUALITY, SCALE_ATTR_RENDERMODE, SCALE_ATTR_TYPE, SCALE_ATTR_WIDTH
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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addParameter
(String name, String value) Add a parameter to this tag.int
doEndTag()
int
Returns
.BodyTag.EVAL_BODY_BUFFERED
getAlign()
Returns the value of the HTML "align" attribute.getAlt()
Returns the value of the HTML "alt" attribute.Returns the value of the HTML "border" attribute.Returns the value of the HTML "class" attribute.Returns the value of the HTML "hspace" attribute.getId()
Returns the value of the HTML "id" attribute.Returns the value of the HTML "longdesc" attribute.getName()
Returns the value of the HTML "name" attribute.getNoDim()
Returns"true"
if the created HTML image tag does not contain height and width attributes.static CmsImageScaler
getScaler
(CmsImageScaler scaler, CmsImageScaler original, String scaleParam) Creates the images scaler used by this image tag.getStyle()
Returns the value of the HTML "style" attribute.getTitle()
Returns the value of the HTML "title" attribute.Returns the value of the HTML "usemap" attribute.Returns the value of the HTML "vspace" attribute.static String
imageTagAction
(String src, CmsImageScaler scaler, Map<String, String> attributes, boolean partialTag, boolean noDim, javax.servlet.ServletRequest req) Internal action method to create the tag content.static String
imageTagAction
(String src, CmsImageScaler scaler, Map<String, String> attributes, boolean partialTag, javax.servlet.ServletRequest req) Internal action method to create the tag content.Returns"true"
if the HTML tag should only be created as partial tag.void
release()
Does some cleanup and creates a new ImageScaler before the tag is released to the tag pool.void
Sets the value of the HTML "align" attribute.void
Sets the value of the HTML "alt" attribute.void
Sets the value of the HTML "border" attribute.void
setCssclass
(String value) Sets the value of the HTML "class" attribute.void
Sets the value of the HTML "hspace" attribute.void
Sets the value of the HTML "id" attribute.void
setLongdesc
(String value) Sets the value of the HTML "longdesc" attribute.void
Sets the value of the HTML "name" attribute.void
Controls if the created HTML image tag contains height and width attributes.void
setPartialTag
(String partialTag) Controls if the created HTML image tag is a full or partial tag.void
Sets the value of the HTML "style" attribute.void
Sets the value of the HTML "title" attribute.void
Sets the value of the HTML "usemap" attribute.void
Sets the value of the HTML "vspace" attribute.Methods inherited from class org.opencms.jsp.CmsJspImageScalerTagSupport
getHeight, getMaxHeight, getMaxWidth, getScaleColor, getScaleFilter, getScalePosition, getScaleQuality, getScaleRendermode, getScaleType, getSrc, getWidth, setHeight, setMaxHeight, setMaxWidth, setScaleColor, setScaleFilter, setScalePosition, setScaleQuality, setScaleRendermode, setScaleType, setSrc, setWidth
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doAfterBody, doInitBody, getBodyContent, getPreviousOut, setBodyContent
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getParent, getValue, getValues, removeValue, 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 Details
-
CmsJspTagImage
public CmsJspTagImage()Creates a new image scaling tag instance.
-
-
Method Details
-
getScaler
public static CmsImageScaler getScaler(CmsImageScaler scaler, CmsImageScaler original, String scaleParam) Creates the images scaler used by this image tag.- Parameters:
scaler
- the scaler created from this tags parametersoriginal
- a scaler that contains the original image dimensionsscaleParam
- optional scaler parameters for cropping- Returns:
- the images scaler used by this image tag
-
imageTagAction
public static String imageTagAction(String src, CmsImageScaler scaler, Map<String, String> attributes, boolean partialTag, boolean noDim, javax.servlet.ServletRequest req) throws CmsExceptionInternal action method to create the tag content.- Parameters:
src
- the image sourcescaler
- the image scaleing parametersattributes
- the additional image HTML attributespartialTag
- iftrue
, the opening<img
and closing/>
is omittednoDim
- iftrue
, theheight
andwidth
attributes are omittedreq
- the current request- Returns:
- the created <img src> tag content
- Throws:
CmsException
- in case something goes wrong
-
imageTagAction
public static String imageTagAction(String src, CmsImageScaler scaler, Map<String, String> attributes, boolean partialTag, javax.servlet.ServletRequest req) throws CmsExceptionInternal action method to create the tag content.- Parameters:
src
- the image sourcescaler
- the image scaleing parametersattributes
- the additional image HTML attributespartialTag
- iftrue
, the opening<img
and closing/>
is omittedreq
- the current request- Returns:
- the created <img src> tag content
- Throws:
CmsException
- in case something goes wrong
-
addParameter
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 interfaceI_CmsJspTagParamParent
- Parameters:
name
- the name of the parametervalue
- the value of the parameter- See Also:
-
doEndTag
- Specified by:
doEndTag
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
doEndTag
in classjavax.servlet.jsp.tagext.BodyTagSupport
- Throws:
javax.servlet.jsp.JspException
- See Also:
-
Tag.doEndTag()
-
doStartTag
Returns
.BodyTag.EVAL_BODY_BUFFERED
- Specified by:
doStartTag
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
doStartTag
in classjavax.servlet.jsp.tagext.BodyTagSupport
- Returns:
BodyTag.EVAL_BODY_BUFFERED
- See Also:
-
Tag.doStartTag()
-
getAlign
Returns the value of the HTML "align" attribute.- Returns:
- the value of the HTML "align" attribute
-
getAlt
Returns the value of the HTML "alt" attribute.- Returns:
- the value of the HTML "alt" attribute
-
getBorder
Returns the value of the HTML "border" attribute.- Returns:
- the value of the HTML "border" attribute
-
getCssclass
Returns the value of the HTML "class" attribute.- Returns:
- the value of the HTML "class" attribute
-
getHspace
Returns the value of the HTML "hspace" attribute.- Returns:
- the value of the HTML "hspace" attribute
-
getId
Returns the value of the HTML "id" attribute.- Overrides:
getId
in classjavax.servlet.jsp.tagext.TagSupport
- Returns:
- the value of the HTML "id" attribute
-
getLongdesc
Returns the value of the HTML "longdesc" attribute.- Returns:
- the value of the HTML "longdesc" attribute
-
getName
Returns the value of the HTML "name" attribute.- Returns:
- the value of the HTML "name" attribute
-
getNoDim
Returns"true"
if the created HTML image tag does not contain height and width attributes.- Returns:
"true"
if the created HTML image tag does not contain height and width attributes
-
getStyle
Returns the value of the HTML "style" attribute.- Returns:
- the value of the HTML "style" attribute
-
getTitle
Returns the value of the HTML "title" attribute.- Returns:
- the value of the HTML "title" attribute
-
getUsemap
Returns the value of the HTML "usemap" attribute.- Returns:
- the value of the HTML "usemap" attribute
-
getVspace
Returns the value of the HTML "vspace" attribute.- Returns:
- the value of the HTML "vspace" attribute
-
isPartialTag
Returns"true"
if the HTML tag should only be created as partial tag.- Returns:
"true"
if the HTML tag should only be created as partial tag
-
release
Description copied from class:CmsJspImageScalerTagSupport
Does some cleanup and creates a new ImageScaler before the tag is released to the tag pool.- Specified by:
release
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
release
in classCmsJspImageScalerTagSupport
- See Also:
-
Tag.release()
-
setAlign
Sets the value of the HTML "align" attribute.- Parameters:
value
- the value of the HTML "align" attribute to set
-
setAlt
Sets the value of the HTML "alt" attribute.- Parameters:
value
- the value of the HTML "alt" attribute to set
-
setBorder
Sets the value of the HTML "border" attribute.- Parameters:
value
- the value of the HTML "border" attribute to set
-
setCssclass
Sets the value of the HTML "class" attribute.- Parameters:
value
- the value of the HTML "class" attribute to set
-
setHspace
Sets the value of the HTML "hspace" attribute.- Parameters:
value
- the value of the HTML "hspace" attribute to set
-
setId
Sets the value of the HTML "id" attribute.- Overrides:
setId
in classjavax.servlet.jsp.tagext.TagSupport
- Parameters:
value
- the value of the HTML "id" attribute to set
-
setLongdesc
Sets the value of the HTML "longdesc" attribute.- Parameters:
value
- the value of the HTML "longdesc" attribute to set
-
setName
Sets the value of the HTML "name" attribute.- Parameters:
value
- the value of the HTML "name" attribute to set
-
setNoDim
Controls if the created HTML image tag contains height and width attributes.- Parameters:
noDim
- the value to set
-
setPartialTag
Controls if the created HTML image tag is a full or partial tag.- Parameters:
partialTag
- the value to set
-
setStyle
Sets the value of the HTML "style" attribute.- Parameters:
value
- the value of the HTML "style" attribute to set
-
setTitle
Sets the value of the HTML "title" attribute.- Parameters:
value
- the value of the HTML "title" attribute to set
-
setUsemap
Sets the value of the HTML "usemap" attribute.- Parameters:
value
- the value of the HTML "usemap" attribute to set
-
setVspace
Sets the value of the HTML "vspace" attribute.- Parameters:
value
- the value of the HTML "vspace" attribute to set
-