Simple caption tag which mimics a standard html caption.
| Method from org.displaytag.tags.CaptionTag Detail: |
public int doEndTag() throws JspException {
if (this.firstIteration)
{
TableTag tableTag = (TableTag) findAncestorWithClass(this, TableTag.class);
if (tableTag == null)
{
throw new TagStructureException(getClass(), "caption", "table"); //$NON-NLS-1$ //$NON-NLS-2$
}
MediaTypeEnum currentMediaType = (MediaTypeEnum) this.pageContext
.findAttribute(TableTag.PAGE_ATTRIBUTE_MEDIA);
if (currentMediaType != null && !MediaUtil.availableForMedia(this, currentMediaType))
{
return SKIP_BODY;
}
if (getBodyContent() != null)
{
// set the caption format-agnostic content so it can be written in various formats.
tableTag.setCaption(getBodyContent().getString());
// set the nested caption tag to write the caption in html format. See HtmlTableWriter.writeCaption
tableTag.setCaptionTag(this);
}
this.firstIteration = false;
}
return EVAL_PAGE;
}
|
public int doStartTag() throws JspException {
TableTag tableTag = (TableTag) findAncestorWithClass(this, TableTag.class);
if (tableTag == null)
{
throw new TagStructureException(getClass(), "caption", "table"); //$NON-NLS-1$ //$NON-NLS-2$
}
MediaTypeEnum currentMediaType = (MediaTypeEnum) this.pageContext.findAttribute(TableTag.PAGE_ATTRIBUTE_MEDIA);
if (!MediaUtil.availableForMedia(this, currentMediaType))
{
return SKIP_BODY;
}
// add caption only once
if (tableTag.isFirstIteration())
{
this.firstIteration = true;
// using int to avoid deprecation error in compilation using j2ee 1.3 (EVAL_BODY_TAG)
return 2;
}
this.firstIteration = false;
return SKIP_BODY;
}
|
public String getCloseTag() {
return TagConstants.TAG_OPENCLOSING + TagConstants.TAGNAME_CAPTION + TagConstants.TAG_CLOSE;
}
|
public String getOpenTag() {
if (this.attributeMap.size() == 0)
{
return TagConstants.TAG_OPEN + TagConstants.TAGNAME_CAPTION + TagConstants.TAG_CLOSE;
}
StringBuffer buffer = new StringBuffer();
buffer.append(TagConstants.TAG_OPEN).append(TagConstants.TAGNAME_CAPTION);
buffer.append(this.attributeMap);
buffer.append(TagConstants.TAG_CLOSE);
return buffer.toString();
}
create the open tag containing all the attributes. |
public List getSupportedMedia() {
return this.supportedMedia;
}
|
public void release() {
super.release();
this.attributeMap.clear();
this.supportedMedia = null;
}
|
public void setClass(String value) {
this.attributeMap.put(TagConstants.ATTRIBUTE_CLASS, new MultipleHtmlAttribute(value));
}
setter for the "class" html attribute. |
public void setDir(String value) {
this.attributeMap.put(TagConstants.ATTRIBUTE_DIR, value);
}
setter for the "dir" html attribute. |
public void setId(String value) {
this.attributeMap.put(TagConstants.ATTRIBUTE_ID, value);
}
setter for the "id" html attribute. |
public void setLang(String value) {
this.attributeMap.put(TagConstants.ATTRIBUTE_LANG, value);
}
setter for the "lang" html attribute. |
public void setMedia(String media) {
MediaUtil.setMedia(this, media);
}
|
public void setStyle(String value) {
this.attributeMap.put(TagConstants.ATTRIBUTE_STYLE, value);
}
setter for the "style" html attribute. |
public void setSupportedMedia(List media) {
this.supportedMedia = media;
}
|
public void setTitle(String value) {
this.attributeMap.put(TagConstants.ATTRIBUTE_TITLE, value);
}
setter for the "title" html attribute. |