|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.servlet.jsp.tagext.TagSupport com.jalios.jcms.taglib.MediaTag
public class MediaTag
Print the HTML required to provide a media player for any file.
Field Summary | |
---|---|
static String |
MEDIA_DATA
Request attribute name to retrieve the Data to be displayed, might be null. |
static String |
MEDIA_DESCRIPTION
Request attribute name to retrieve the description to be displayed, might be null. |
static String |
MEDIA_MAX_HEIGHT
Request attribute name to retrieve the maximum height of the media file to be displayed. |
static String |
MEDIA_MAX_WIDTH
Request attribute name to retrieve the maximum width of the media file to be displayed. |
static String |
MEDIA_PATH
Request attribute name to retrieve the path of the media file to be displayed. |
static String |
REVISION
|
Fields inherited from class javax.servlet.jsp.tagext.TagSupport |
---|
id, pageContext |
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 | |
---|---|
MediaTag()
|
Method Summary | |
---|---|
int |
doEndTag()
|
int |
doStartTag()
|
static String |
getMediaTemplatePath(String templateName,
Data data)
Retrieve the path of the JSP suitable to display the specified Data. |
static String |
getMediaTemplatePath(String templateName,
String mediaPath,
String mediaContentType)
Retrieve the path of the JSP suitable to display the specified media. |
void |
includeMediaTemplate()
Include the JSP suitable to display the specified media. |
void |
setData(Data data)
|
void |
setDescription(String mediaDescription)
Sets a optionnal description to use in appropriate HTML attribute if any (img alt text, title or such). |
void |
setFile(File file)
|
void |
setFileDoc(FileDocument fileDoc)
|
void |
setMaxHeight(int height)
|
void |
setMaxWidth(int width)
|
void |
setPath(String path)
|
void |
setTemplate(String templateName)
Sets the name of the template to be used by this tag. |
Methods inherited from class javax.servlet.jsp.tagext.TagSupport |
---|
doAfterBody, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String REVISION
public static final String MEDIA_PATH
String path = (String) request.getAttribute(MediaTag.MEDIA_PATH);
public static final String MEDIA_MAX_WIDTH
int maxWidth = Util.toInt(request.getAttribute(MediaTag.MEDIA_MAX_WIDTH), 320);
public static final String MEDIA_MAX_HEIGHT
int maxHeight = Util.toInt(request.getAttribute(MediaTag.MEDIA_MAX_HEIGHT), 240);
public static final String MEDIA_DATA
Data data = (Data) request.getAttribute(MediaTag.MEDIA_DATA);
public static final String MEDIA_DESCRIPTION
String mediaDescription = (String) request.getAttribute(MediaTag.MEDIA_DESCRIPTION);
Constructor Detail |
---|
public MediaTag()
Method Detail |
---|
public void setData(Data data)
public void setFileDoc(FileDocument fileDoc)
public void setPath(String path)
public void setFile(File file)
public void setMaxWidth(int width)
public void setMaxHeight(int height)
public void setTemplate(String templateName)
See properties media.template.{templateName}.{type-mime}
in jcms.prop
for example on how to define new templates.
templateName
- a template name (default value is "default").public void setDescription(String mediaDescription)
If empty, the data's name or the media's path is used.
mediaDescription
- a short description for use in HTML attributespublic int doStartTag() throws javax.servlet.jsp.JspException
doStartTag
in interface javax.servlet.jsp.tagext.Tag
doStartTag
in class javax.servlet.jsp.tagext.TagSupport
javax.servlet.jsp.JspException
public int doEndTag()
doEndTag
in interface javax.servlet.jsp.tagext.Tag
doEndTag
in class javax.servlet.jsp.tagext.TagSupport
public void includeMediaTemplate() throws javax.servlet.ServletException, IOException
IOException
javax.servlet.ServletException
public static String getMediaTemplatePath(String templateName, String mediaPath, String mediaContentType)
templateName
- the name of the template to retrievemediaPath
- the path of the media to display, relative to the webapp root (eg. upload/docs/myfile.ext)mediaContentType
- the content type of the media to display (eg. image/jpeg)
public static String getMediaTemplatePath(String templateName, Data data)
templateName
- the name of the template to retrievedata
- the Data to display
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |