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:
java.io.Serializable
,javax.servlet.jsp.tagext.BodyTag
,javax.servlet.jsp.tagext.IterationTag
,javax.servlet.jsp.tagext.JspTag
,javax.servlet.jsp.tagext.Tag
,I_CmsJspTagParamParent
public class CmsJspTagImage extends CmsJspImageScalerTagSupport implements I_CmsJspTagParamParent
Creates HTML code for <img src> tags that use the OpenCms image scaling capabilities.- Since:
- 6.2.0
- See Also:
- Serialized Form
-
-
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
-
-
Constructor Summary
Constructors Constructor Description CmsJspTagImage()
Creates a new image scaling tag instance.
-
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
doEndTag()
int
doStartTag()
Returns
.BodyTag.EVAL_BODY_BUFFERED
java.lang.String
getAlign()
Returns the value of the HTML "align" attribute.java.lang.String
getAlt()
Returns the value of the HTML "alt" attribute.java.lang.String
getBorder()
Returns the value of the HTML "border" attribute.java.lang.String
getCssclass()
Returns the value of the HTML "class" attribute.java.lang.String
getHspace()
Returns the value of the HTML "hspace" attribute.java.lang.String
getId()
Returns the value of the HTML "id" attribute.java.lang.String
getLongdesc()
Returns the value of the HTML "longdesc" attribute.java.lang.String
getName()
Returns the value of the HTML "name" attribute.java.lang.String
getNoDim()
Returns"true"
if the created HTML image tag does not contain height and width attributes.static CmsImageScaler
getScaler(CmsImageScaler scaler, CmsImageScaler original, java.lang.String scaleParam)
Creates the images scaler used by this image tag.java.lang.String
getStyle()
Returns the value of the HTML "style" attribute.java.lang.String
getTitle()
Returns the value of the HTML "title" attribute.java.lang.String
getUsemap()
Returns the value of the HTML "usemap" attribute.java.lang.String
getVspace()
Returns the value of the HTML "vspace" attribute.static java.lang.String
imageTagAction(java.lang.String src, CmsImageScaler scaler, java.util.Map<java.lang.String,java.lang.String> attributes, boolean partialTag, boolean noDim, javax.servlet.ServletRequest req)
Internal action method to create the tag content.static java.lang.String
imageTagAction(java.lang.String src, CmsImageScaler scaler, java.util.Map<java.lang.String,java.lang.String> attributes, boolean partialTag, javax.servlet.ServletRequest req)
Internal action method to create the tag content.java.lang.String
isPartialTag()
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
setAlign(java.lang.String value)
Sets the value of the HTML "align" attribute.void
setAlt(java.lang.String value)
Sets the value of the HTML "alt" attribute.void
setBorder(java.lang.String value)
Sets the value of the HTML "border" attribute.void
setCssclass(java.lang.String value)
Sets the value of the HTML "class" attribute.void
setHspace(java.lang.String value)
Sets the value of the HTML "hspace" attribute.void
setId(java.lang.String value)
Sets the value of the HTML "id" attribute.void
setLongdesc(java.lang.String value)
Sets the value of the HTML "longdesc" attribute.void
setName(java.lang.String value)
Sets the value of the HTML "name" attribute.void
setNoDim(java.lang.String noDim)
Controls if the created HTML image tag contains height and width attributes.void
setPartialTag(java.lang.String partialTag)
Controls if the created HTML image tag is a full or partial tag.void
setStyle(java.lang.String value)
Sets the value of the HTML "style" attribute.void
setTitle(java.lang.String value)
Sets the value of the HTML "title" attribute.void
setUsemap(java.lang.String value)
Sets the value of the HTML "usemap" attribute.void
setVspace(java.lang.String value)
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
-
-
-
-
Constructor Detail
-
CmsJspTagImage
public CmsJspTagImage()
Creates a new image scaling tag instance.
-
-
Method Detail
-
getScaler
public static CmsImageScaler getScaler(CmsImageScaler scaler, CmsImageScaler original, java.lang.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 java.lang.String imageTagAction(java.lang.String src, CmsImageScaler scaler, java.util.Map<java.lang.String,java.lang.String> attributes, boolean partialTag, boolean noDim, javax.servlet.ServletRequest req) throws CmsException
Internal 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 java.lang.String imageTagAction(java.lang.String src, CmsImageScaler scaler, java.util.Map<java.lang.String,java.lang.String> attributes, boolean partialTag, javax.servlet.ServletRequest req) throws CmsException
Internal 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
public void addParameter(java.lang.String name, java.lang.String value)
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:
I_CmsJspTagParamParent.addParameter(java.lang.String, java.lang.String)
-
doEndTag
public int doEndTag() throws javax.servlet.jsp.JspException
- 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
public int 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
public java.lang.String getAlign()
Returns the value of the HTML "align" attribute.- Returns:
- the value of the HTML "align" attribute
-
getAlt
public java.lang.String getAlt()
Returns the value of the HTML "alt" attribute.- Returns:
- the value of the HTML "alt" attribute
-
getBorder
public java.lang.String getBorder()
Returns the value of the HTML "border" attribute.- Returns:
- the value of the HTML "border" attribute
-
getCssclass
public java.lang.String getCssclass()
Returns the value of the HTML "class" attribute.- Returns:
- the value of the HTML "class" attribute
-
getHspace
public java.lang.String getHspace()
Returns the value of the HTML "hspace" attribute.- Returns:
- the value of the HTML "hspace" attribute
-
getId
public java.lang.String 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
public java.lang.String getLongdesc()
Returns the value of the HTML "longdesc" attribute.- Returns:
- the value of the HTML "longdesc" attribute
-
getName
public java.lang.String getName()
Returns the value of the HTML "name" attribute.- Returns:
- the value of the HTML "name" attribute
-
getNoDim
public java.lang.String 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
public java.lang.String getStyle()
Returns the value of the HTML "style" attribute.- Returns:
- the value of the HTML "style" attribute
-
getTitle
public java.lang.String getTitle()
Returns the value of the HTML "title" attribute.- Returns:
- the value of the HTML "title" attribute
-
getUsemap
public java.lang.String getUsemap()
Returns the value of the HTML "usemap" attribute.- Returns:
- the value of the HTML "usemap" attribute
-
getVspace
public java.lang.String getVspace()
Returns the value of the HTML "vspace" attribute.- Returns:
- the value of the HTML "vspace" attribute
-
isPartialTag
public java.lang.String 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
public void 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
public void setAlign(java.lang.String value)
Sets the value of the HTML "align" attribute.- Parameters:
value
- the value of the HTML "align" attribute to set
-
setAlt
public void setAlt(java.lang.String value)
Sets the value of the HTML "alt" attribute.- Parameters:
value
- the value of the HTML "alt" attribute to set
-
setBorder
public void setBorder(java.lang.String value)
Sets the value of the HTML "border" attribute.- Parameters:
value
- the value of the HTML "border" attribute to set
-
setCssclass
public void setCssclass(java.lang.String value)
Sets the value of the HTML "class" attribute.- Parameters:
value
- the value of the HTML "class" attribute to set
-
setHspace
public void setHspace(java.lang.String value)
Sets the value of the HTML "hspace" attribute.- Parameters:
value
- the value of the HTML "hspace" attribute to set
-
setId
public void setId(java.lang.String value)
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
public void setLongdesc(java.lang.String value)
Sets the value of the HTML "longdesc" attribute.- Parameters:
value
- the value of the HTML "longdesc" attribute to set
-
setName
public void setName(java.lang.String value)
Sets the value of the HTML "name" attribute.- Parameters:
value
- the value of the HTML "name" attribute to set
-
setNoDim
public void setNoDim(java.lang.String noDim)
Controls if the created HTML image tag contains height and width attributes.- Parameters:
noDim
- the value to set
-
setPartialTag
public void setPartialTag(java.lang.String partialTag)
Controls if the created HTML image tag is a full or partial tag.- Parameters:
partialTag
- the value to set
-
setStyle
public void setStyle(java.lang.String value)
Sets the value of the HTML "style" attribute.- Parameters:
value
- the value of the HTML "style" attribute to set
-
setTitle
public void setTitle(java.lang.String value)
Sets the value of the HTML "title" attribute.- Parameters:
value
- the value of the HTML "title" attribute to set
-
setUsemap
public void setUsemap(java.lang.String value)
Sets the value of the HTML "usemap" attribute.- Parameters:
value
- the value of the HTML "usemap" attribute to set
-
setVspace
public void setVspace(java.lang.String value)
Sets the value of the HTML "vspace" attribute.- Parameters:
value
- the value of the HTML "vspace" attribute to set
-
-