org.opencms.jsp
Class CmsJspTagImage

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by javax.servlet.jsp.tagext.BodyTagSupport
          extended by 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 javax.servlet.jsp.tagext.BodyTagSupport
implements I_CmsJspTagParamParent

Creates HTML code for <img src> tags that use the OpenCms image scaling capabilities.

Since:
6.2.0
Version:
$Revision: 1.13 $
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
CmsJspTagImage()
          Creates a new image scaling tag instance.
 
Method Summary
 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 getHeight()
          Returns the scaling height for the image.
 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 getScaleColor()
          Returns the background color used by the image scaler.
 java.lang.String getScaleFilter()
          Returns the filter list used by the image scaler.
 java.lang.String getScalePosition()
          Returns the position used by the image scaler.
 java.lang.String getScaleQuality()
          Returns the quality used by the image scaler.
 java.lang.String getScaleRendermode()
          Returns the render mode used by the image scaler.
 java.lang.String getScaleType()
          Returns the scaling type for the image.
 java.lang.String getSrc()
          Returns the source of the image to scale, which will have the OpenCms webapp / servlet prefix added.
 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.
 java.lang.String getWidth()
          Returns the scaling width for the image.
static java.lang.String imageTagAction(java.lang.String src, CmsImageScaler scaler, java.util.Map 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()
           
 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 setHeight(java.lang.String value)
          Sets the scaling height for the image.
 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 setPartialTag(java.lang.String partialTag)
          Controls if the created HTML image tag is a full or partial tag.
 void setScaleColor(java.lang.String value)
          Sets the background color used by the image scaler.
 void setScaleFilter(java.lang.String value)
          Sets the filter(s) used by the image scaler.
 void setScalePosition(java.lang.String value)
          Sets the position used by the image scaler.
 void setScaleQuality(java.lang.String value)
          Sets the quality used by the image scaler.
 void setScaleRendermode(java.lang.String value)
          Sets the render mode used by the image scaler.
 void setScaleType(java.lang.String value)
          Sets the scaling type for the image.
 void setSrc(java.lang.String value)
          Sets the source of the image.
 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.
 void setWidth(java.lang.String value)
          Sets the scaling width for the image.
 
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 Detail

CmsJspTagImage

public CmsJspTagImage()
Creates a new image scaling tag instance.

Method Detail

imageTagAction

public static java.lang.String imageTagAction(java.lang.String src,
                                              CmsImageScaler scaler,
                                              java.util.Map attributes,
                                              boolean partialTag,
                                              javax.servlet.ServletRequest req)
                                       throws CmsException
Internal action method to create the tag content.

Parameters:
src - the image source
scaler - the image scaleing parameters
attributes - the additional image HTML attributes
partialTag - if true, the opening <img and closing /> is omitted
req - 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 interface I_CmsJspTagParamParent
Parameters:
name - the name of the parameter
value - 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 interface javax.servlet.jsp.tagext.Tag
Overrides:
doEndTag in class javax.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 interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class javax.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

getHeight

public java.lang.String getHeight()
Returns the scaling height for the image.

Returns:
the scaling height for the image

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 class javax.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

getScaleColor

public java.lang.String getScaleColor()
Returns the background color used by the image scaler.

Returns:
the background color used by the image scaler

getScaleFilter

public java.lang.String getScaleFilter()
Returns the filter list used by the image scaler.

Returns:
the filter list used by the image scaler

getScalePosition

public java.lang.String getScalePosition()
Returns the position used by the image scaler.

Returns:
the position used by the image scaler

getScaleQuality

public java.lang.String getScaleQuality()
Returns the quality used by the image scaler.

Returns:
the quality used by the image scaler

getScaleRendermode

public java.lang.String getScaleRendermode()
Returns the render mode used by the image scaler.

Returns:
the render mode used by the image scaler

getScaleType

public java.lang.String getScaleType()
Returns the scaling type for the image.

Returns:
the scaling type for the image

getSrc

public java.lang.String getSrc()
Returns the source of the image to scale, which will have the OpenCms webapp / servlet prefix added.

Returns:
the source of the image to scale

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

getWidth

public java.lang.String getWidth()
Returns the scaling width for the image.

Returns:
the scaling width for the image

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()
Specified by:
release in interface javax.servlet.jsp.tagext.Tag
Overrides:
release in class javax.servlet.jsp.tagext.BodyTagSupport
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

setHeight

public void setHeight(java.lang.String value)
Sets the scaling height for the image.

If no valid integer is given, then "0" is used as value.

Parameters:
value - the scaling height for the image 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 class javax.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

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

setScaleColor

public void setScaleColor(java.lang.String value)
Sets the background color used by the image scaler.

Parameters:
value - the background color to set

setScaleFilter

public void setScaleFilter(java.lang.String value)
Sets the filter(s) used by the image scaler.

Parameters:
value - the filter(s) to set

setScalePosition

public void setScalePosition(java.lang.String value)
Sets the position used by the image scaler.

Parameters:
value - the position to set

setScaleQuality

public void setScaleQuality(java.lang.String value)
Sets the quality used by the image scaler.

Parameters:
value - the quality to set

setScaleRendermode

public void setScaleRendermode(java.lang.String value)
Sets the render mode used by the image scaler.

Parameters:
value - the render mode to set

setScaleType

public void setScaleType(java.lang.String value)
Sets the scaling type for the image.

If no valid integer is given, then "0" is used as value.

Parameters:
value - the scaling type for the image to set

setSrc

public void setSrc(java.lang.String value)
Sets the source of the image.

The source must be an absolute path in the current users OpenCms site, without any webapp or servlet prefix.

Parameters:
value - the image source 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

setWidth

public void setWidth(java.lang.String value)
Sets the scaling width for the image.

If no valid integer is given, then "0" is used as value.

Parameters:
value - the scaling width for the image to set