org.apache.taglibs.string
Class WordWrapTag

java.lang.Object
  extended byjavax.servlet.jsp.tagext.TagSupport
      extended byjavax.servlet.jsp.tagext.BodyTagSupport
          extended byorg.apache.taglibs.string.StringTagSupport
              extended byorg.apache.taglibs.string.WordWrapTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, java.io.Serializable, javax.servlet.jsp.tagext.Tag

public class WordWrapTag
extends StringTagSupport

Word-wrap a String. This involves formatting a long String to fit within a certain character width of page. A delimiter may be passed in to put at the end of each line and a splitting character can be specified for when a word has to be cut in half.

delimiter
Character to put between each line. Default is a newline character.
width
Width to word wrap to. Default is 80.
split
Character to use when a word has to be split. Default is a - character.
delimiterInside
Flag indicating if the delimiter should be included in chunk before length reaches width. Default is true.

Author:
bayard@generationjava.com
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
WordWrapTag()
           
 
Method Summary
 java.lang.String changeString(java.lang.String text)
          Perform a transformation on the passed in String.
 java.lang.String getDelimiter()
          Get the delimiter property
 boolean getDelimiterInside()
          Get the delimiterInside property
 java.lang.String getSplit()
          Get the split property
 java.lang.String getWidth()
          Get the width property
 void initAttributes()
          Initialise any properties to default values.
 void setDelimiter(java.lang.String delimiter)
          Set the delimiter property
 void setDelimiterInside(boolean delimiterInside)
          Set the delimiterInside property
 void setSplit(java.lang.String split)
          Set the split property
 void setWidth(java.lang.String width)
          Set the width property
 
Methods inherited from class org.apache.taglibs.string.StringTagSupport
doEndTag, evaluateString, getVar, setVar
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doAfterBody, 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
 

Constructor Detail

WordWrapTag

public WordWrapTag()
Method Detail

getWidth

public java.lang.String getWidth()
Get the width property

Returns:
String property

setWidth

public void setWidth(java.lang.String width)
Set the width property

Parameters:
width - String property

getDelimiter

public java.lang.String getDelimiter()
Get the delimiter property

Returns:
String property

setDelimiter

public void setDelimiter(java.lang.String delimiter)
Set the delimiter property

Parameters:
delimiter - String property

getSplit

public java.lang.String getSplit()
Get the split property

Returns:
String property

setSplit

public void setSplit(java.lang.String split)
Set the split property

Parameters:
split - String property

getDelimiterInside

public boolean getDelimiterInside()
Get the delimiterInside property

Returns:
delimiterInside property

setDelimiterInside

public void setDelimiterInside(boolean delimiterInside)
Set the delimiterInside property

Parameters:
delimiterInside - property

changeString

public java.lang.String changeString(java.lang.String text)
                              throws javax.servlet.jsp.JspException
Description copied from class: StringTagSupport
Perform a transformation on the passed in String.

Specified by:
changeString in class StringTagSupport
Parameters:
text - String to be manipulated
Returns:
String result of operation upon passed in String
Throws:
javax.servlet.jsp.JspException

initAttributes

public void initAttributes()
Description copied from class: StringTagSupport
Initialise any properties to default values. This method is called upon construction, and after changeString(String) is called. This is a default empty implementation.

Overrides:
initAttributes in class StringTagSupport


Copyright ? 2000-2004 The Apache Software Foundation. All Rights Reserved.