org.mmbase.bridge.jsp.taglib
Class ImageTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by javax.servlet.jsp.tagext.BodyTagSupport
          extended by org.mmbase.bridge.jsp.taglib.ContextReferrerTag
              extended by org.mmbase.bridge.jsp.taglib.CloudReferrerTag
                  extended by org.mmbase.bridge.jsp.taglib.NodeReferrerTag
                      extended by org.mmbase.bridge.jsp.taglib.FieldReferrerTag
                          extended by org.mmbase.bridge.jsp.taglib.FieldTag
                              extended by org.mmbase.bridge.jsp.taglib.ImageTag
All Implemented Interfaces:
Serializable, BodyTag, IterationTag, JspTag, Tag, TryCatchFinally, FieldProvider, TagIdentifier, Writer
Direct Known Subclasses:
AttachmentTag

public class ImageTag
extends FieldTag

Produces an url to the image servlet mapping. Using this tag makes your pages more portable to other system, and hopefully less sensitive for future changes in how the image servlet works.

Version:
$Id: ImageTag.java 42414 2010-06-07 12:30:58Z michiel $
Author:
Michiel Meeuwissen
See Also:
Serialized Form

Field Summary
static String CROP_BEGIN
           
static String CROP_END
           
static String CROP_MIDDLE
           
static int MODE_HTML_ATTRIBUTES
           
static int MODE_HTML_IMG
           
static int MODE_URL
           
static UrlEscaper URLESCAPER
           
 
Fields inherited from class org.mmbase.bridge.jsp.taglib.FieldTag
field, fieldName, name, notfound
 
Fields inherited from class org.mmbase.bridge.jsp.taglib.FieldReferrerTag
parentFieldId
 
Fields inherited from class org.mmbase.bridge.jsp.taglib.NodeReferrerTag
parentNodeId
 
Fields inherited from class org.mmbase.bridge.jsp.taglib.CloudReferrerTag
cloudId
 
Fields inherited from class org.mmbase.bridge.jsp.taglib.ContextReferrerTag
contextId, EVAL_BODY, helper, id, pageContextTag, referid, writerid
 
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
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
ImageTag()
           
 
Method Summary
 int doEndTag()
          write the value of the field.
 int doStartTag()
           
protected  String encodeURL(Node node, String servletPath)
           
protected  String getAltAttribute(Node node)
           
protected  String getBaseAttributes(String url, Dimension dim)
           
protected  String getCropTemplate(Node node, int width, int height, String cropTemplate)
          Returns the crop template string to be used by img servlet
 Dimension getDimension(Node node, String template)
           
protected  String getOtherAttributes()
           
protected  String getOutputValue(int mode, Node node, String servletPath, Dimension dim)
           
protected  String getResizeTemplate(Node node, int width, int height)
          Returns the resize template string to be used by img servlet without cropping
 String getServletArgument(Node node, String t)
           
 Parameters getServletArguments(String servletArgument, Function servletPathFunction)
           
 Function getServletFunction(Node node)
           
protected  Node getServletNode(Node node, String template)
           
protected  String getServletPath(Node node, String servletArgument)
           
protected  String getSrcAttribute(String url)
           
 String getTemplate(Node node, String t, int widthTemplate, int heightTemplate, String cropTemplate)
          Get template to manipulate image
 void setAbsolute(String a)
           
 void setAlign(String align)
           
 void setAlt(String a)
           
 void setBorder(String border)
           
 void setCrop(String crop)
           
 void setDisposition(String d)
           
 void setHeight(String height)
           
 void setHspace(String hspace)
           
 void setMode(String m)
           
 void setStyle(String style)
           
 void setStyleClass(String styleClass)
           
 void setTemplate(String t)
          The transformation template
 void setVspace(String vspace)
           
 void setWidth(String width)
           
 void setXmlnamespace(String x)
           
 
Methods inherited from class org.mmbase.bridge.jsp.taglib.FieldTag
convert, doAfterBody, doFinally, getFieldVar, getNodeVar, handleEditTag, setFieldVar, setFieldVar, setName, setNotfound
 
Methods inherited from class org.mmbase.bridge.jsp.taglib.FieldReferrerTag
findFieldProvider, findFieldProvider, getField, setField
 
Methods inherited from class org.mmbase.bridge.jsp.taglib.NodeReferrerTag
fillStandardParameters, findNode, findNodeProvider, findNodeProvider, getCloudVar, getLocale, getNode, getNode, getNodeFromPageContext, initTag, setElement, setNode
 
Methods inherited from class org.mmbase.bridge.jsp.taglib.CloudReferrerTag
findCloudProvider, findCloudProvider, getCloudContext, getNode, getNodeOrNull, setCloud
 
Methods inherited from class org.mmbase.bridge.jsp.taglib.ContextReferrerTag
appendMoreParameters, doCatch, findLoopOrQuery, findParentTag, findParentTag, findWriter, findWriter, getAttribute, getAttribute, getAttributeBoolean, getAttributeInteger, getAttributeInteger, getAttributeValue, getContentTag, getContextProvider, getContextTag, getCurrentBlock, getDefaultLocale, getEscapedValue, getFormTag, getId, getLocaleFromContext, getObject, getObjectConditional, getPageContext, getPageContextTag, getQuery, getReferid, getString, getTaglibVersion, getThreadPageContext, getTimeZone, getWriterValue, haveBody, release, setContext, setEscape, setId, setJspvar, setListdelimiter, setPageContext, setPageContextOnly, setReferid, setVartype, setWrite, setWriter
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doInitBody, getBodyContent, getPreviousOut, setBodyContent
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getParent, getValue, getValues, removeValue, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.mmbase.bridge.jsp.taglib.TagIdentifier
getId
 
Methods inherited from interface org.mmbase.bridge.jsp.taglib.Writer
getWriterValue, haveBody, setEscape, setJspvar, setVartype, setWrite
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setParent
 

Field Detail

MODE_URL

public static final int MODE_URL
See Also:
Constant Field Values

MODE_HTML_ATTRIBUTES

public static final int MODE_HTML_ATTRIBUTES
See Also:
Constant Field Values

MODE_HTML_IMG

public static final int MODE_HTML_IMG
See Also:
Constant Field Values

CROP_BEGIN

public static final String CROP_BEGIN
See Also:
Constant Field Values

CROP_MIDDLE

public static final String CROP_MIDDLE
See Also:
Constant Field Values

CROP_END

public static final String CROP_END
See Also:
Constant Field Values

URLESCAPER

public static final UrlEscaper URLESCAPER
Constructor Detail

ImageTag

public ImageTag()
Method Detail

setTemplate

public void setTemplate(String t)
                 throws JspTagException
The transformation template

Throws:
JspTagException

setMode

public void setMode(String m)
             throws JspTagException
Throws:
JspTagException

setAlign

public void setAlign(String align)
              throws JspTagException
Throws:
JspTagException

setBorder

public void setBorder(String border)
               throws JspTagException
Throws:
JspTagException

setStyleClass

public void setStyleClass(String styleClass)
                   throws JspTagException
Throws:
JspTagException

setCrop

public void setCrop(String crop)
             throws JspTagException
Throws:
JspTagException

setHeight

public void setHeight(String height)
               throws JspTagException
Throws:
JspTagException

setHspace

public void setHspace(String hspace)
               throws JspTagException
Throws:
JspTagException

setStyle

public void setStyle(String style)
              throws JspTagException
Throws:
JspTagException

setVspace

public void setVspace(String vspace)
               throws JspTagException
Throws:
JspTagException

setWidth

public void setWidth(String width)
              throws JspTagException
Throws:
JspTagException

setAlt

public void setAlt(String a)
            throws JspTagException
Throws:
JspTagException

setAbsolute

public void setAbsolute(String a)
                 throws JspTagException
Throws:
JspTagException
Since:
MMBase-1.9.1

setDisposition

public void setDisposition(String d)
                    throws JspTagException
Throws:
JspTagException
Since:
MMBase-1.9.1

setXmlnamespace

public void setXmlnamespace(String x)
                     throws JspTagException
Throws:
JspTagException
Since:
MMBase-1.9.2

getServletNode

protected Node getServletNode(Node node,
                              String template)

doStartTag

public int doStartTag()
               throws JspException
Specified by:
doStartTag in interface Tag
Overrides:
doStartTag in class FieldTag
Throws:
JspException

doEndTag

public int doEndTag()
             throws JspTagException
Description copied from class: FieldTag
write the value of the field.

Specified by:
doEndTag in interface Tag
Overrides:
doEndTag in class FieldTag
Throws:
JspTagException

getServletArgument

public String getServletArgument(Node node,
                                 String t)

getServletPath

protected String getServletPath(Node node,
                                String servletArgument)
                         throws JspTagException
Throws:
JspTagException

getServletFunction

public Function getServletFunction(Node node)

getServletArguments

public Parameters getServletArguments(String servletArgument,
                                      Function servletPathFunction)
                               throws JspTagException
Throws:
JspTagException

encodeURL

protected String encodeURL(Node node,
                           String servletPath)
Since:
MMBase-1.9.4

getOutputValue

protected String getOutputValue(int mode,
                                Node node,
                                String servletPath,
                                Dimension dim)
                         throws JspTagException
Throws:
JspTagException

getSrcAttribute

protected String getSrcAttribute(String url)
                          throws JspTagException
Throws:
JspTagException

getBaseAttributes

protected String getBaseAttributes(String url,
                                   Dimension dim)
                            throws JspTagException
Throws:
JspTagException

getAltAttribute

protected String getAltAttribute(Node node)
                          throws JspTagException
Throws:
JspTagException

getOtherAttributes

protected String getOtherAttributes()
                             throws JspTagException
Throws:
JspTagException

getDimension

public Dimension getDimension(Node node,
                              String template)

getTemplate

public String getTemplate(Node node,
                          String t,
                          int widthTemplate,
                          int heightTemplate,
                          String cropTemplate)
Get template to manipulate image

Parameters:
node - - image node
t - - custom template string
widthTemplate - - width of image, which is used when custom is not provided
heightTemplate - - height of image, which is used when custom is not provided
cropTemplate - - crop the image. values are 'begin', 'middle' and 'end'.
Returns:
template for image

getCropTemplate

protected String getCropTemplate(Node node,
                                 int width,
                                 int height,
                                 String cropTemplate)
Returns the crop template string to be used by img servlet

Parameters:
node - - get template for this node
width - - template width
height - - template height
Returns:
the crop template

getResizeTemplate

protected String getResizeTemplate(Node node,
                                   int width,
                                   int height)
Returns the resize template string to be used by img servlet without cropping

Parameters:
node - - get template for this node
width - - template width
height - - template height
Returns:
the resize template


MMBase 2.0-SNAPSHOT - null