|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.servlet.jsp.tagext.TagSupport | +--javax.servlet.jsp.tagext.BodyTagSupport | +--javawebparts.taglib.basicstr.AbbreviateTag
This class is a custom tag that adds ellipses to a a string.
This tag uses the following attributes:
leftEdge - The left edge of the source string. Use 0 to start at the
beginning. Anything greater than 4 will result in ellipses added to the
BEGINNING of the string.
maxSize - The maximum size of the resultant string. This must always be
at least 4!
Here are some usage examples taken directly from the Commons Lang docs:
When the text is "abcdefghijklmno" and...
leftEdge is -1 and maxSize is 10 = "abcdefg..."
leftEdge is 0 and maxSize is 10 = "abcdefg..."
leftEdge is 1 and maxSize is 10 = "abcdefg..."
leftEdge is 4 and maxSize is 10 = "abcdefg..."
leftEdge is 5 and maxSize is 10 = "...fghi..."
leftEdge is 6 and maxSize is 10 = "...ghij..."
leftEdge is 8 and maxSize is 10 = "...ijklmno"
leftEdge is 10 and maxSize is 10 = "...ijklmno"
leftEdge is 12 and maxSize is 10 = "...ijklmno"
leftEdge is 0 and mazSize is 3 = ""
leftEdge is 5 and mazSize is 6 = ""
Field Summary | |
private java.lang.String |
leftEdge
This is the attribute that defines the left edge of the string to use. |
private static org.apache.commons.logging.Log |
log
Log instance. |
private java.lang.String |
maxSize
This is the attribute that defines the maximum size of the resultant string. |
private java.lang.String |
text
This is the body content text to be altered. |
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 | |
AbbreviateTag()
|
Method Summary | |
int |
doAfterBody()
Alter the body content. |
int |
doEndTag()
Render the altered body. |
void |
setLeftEdge(java.lang.String inLeftEdge)
leftEdge mutator. |
void |
setMaxSize(java.lang.String inMaxSize)
maxSize mutator. |
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport |
doInitBody, doStartTag, getBodyContent, getPreviousOut, release, setBodyContent |
Methods inherited from class javax.servlet.jsp.tagext.TagSupport |
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, 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 |
Field Detail |
private static org.apache.commons.logging.Log log
private java.lang.String text
private java.lang.String leftEdge
private java.lang.String maxSize
Constructor Detail |
public AbbreviateTag()
Method Detail |
public void setLeftEdge(java.lang.String inLeftEdge)
inLeftEdge
- leftEdge.public void setMaxSize(java.lang.String inMaxSize)
inMaxSize
- maxSize.public int doAfterBody() throws javax.servlet.jsp.JspException
doAfterBody
in interface javax.servlet.jsp.tagext.IterationTag
doAfterBody
in class javax.servlet.jsp.tagext.BodyTagSupport
javax.servlet.jsp.JspException
- If anything goes wrong.public int doEndTag() throws javax.servlet.jsp.JspException
doEndTag
in interface javax.servlet.jsp.tagext.Tag
doEndTag
in class javax.servlet.jsp.tagext.BodyTagSupport
javax.servlet.jsp.JspException
- If anything goes wrong.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |