net.sf.jasperreports.engine.fill
Class JRFillTextField

java.lang.Object
  extended bynet.sf.jasperreports.engine.fill.JRFillElement
      extended bynet.sf.jasperreports.engine.fill.JRFillTextElement
          extended bynet.sf.jasperreports.engine.fill.JRFillTextField
All Implemented Interfaces:
JRAlignment, JRAnchor, JRChild, JRElement, JRHyperlink, JRTextElement, JRTextField

public class JRFillTextField
extends JRFillTextElement
implements JRTextField

Version:
$Id: JRFillTextField.java,v 1.34 2005/08/19 13:47:31 teodord Exp $
Author:
Teodor Danciu (teodord@users.sourceforge.net)

Nested Class Summary
 
Nested classes inherited from class net.sf.jasperreports.engine.fill.JRFillTextElement
JRFillTextElement.TextChopper
 
Field Summary
 
Fields inherited from class net.sf.jasperreports.engine.fill.JRFillTextElement
textChopper
 
Fields inherited from class net.sf.jasperreports.engine.fill.JRFillElement
band, elementGroup, filler, parent, printWhenGroupChanges, template
 
Fields inherited from interface net.sf.jasperreports.engine.JRTextField
STANDARD_DATE_FORMAT_DEFAULT, STANDARD_DATE_FORMAT_FULL, STANDARD_DATE_FORMAT_HIDE, STANDARD_DATE_FORMAT_LONG, STANDARD_DATE_FORMAT_MEDIUM, STANDARD_DATE_FORMAT_SEPARATOR, STANDARD_DATE_FORMAT_SHORT
 
Fields inherited from interface net.sf.jasperreports.engine.JRTextElement
LINE_SPACING_1_1_2, LINE_SPACING_DOUBLE, LINE_SPACING_SINGLE, ROTATION_LEFT, ROTATION_NONE, ROTATION_RIGHT, TEXT_ALIGN_CENTER, TEXT_ALIGN_JUSTIFIED, TEXT_ALIGN_LEFT, TEXT_ALIGN_RIGHT
 
Fields inherited from interface net.sf.jasperreports.engine.JRElement
MODE_OPAQUE, MODE_TRANSPARENT, POSITION_TYPE_FIX_RELATIVE_TO_BOTTOM, POSITION_TYPE_FIX_RELATIVE_TO_TOP, POSITION_TYPE_FLOAT, STRETCH_TYPE_NO_STRETCH, STRETCH_TYPE_RELATIVE_TO_BAND_HEIGHT, STRETCH_TYPE_RELATIVE_TO_TALLEST_OBJECT
 
Fields inherited from interface net.sf.jasperreports.engine.JRAlignment
HORIZONTAL_ALIGN_CENTER, HORIZONTAL_ALIGN_JUSTIFIED, HORIZONTAL_ALIGN_LEFT, HORIZONTAL_ALIGN_RIGHT, VERTICAL_ALIGN_BOTTOM, VERTICAL_ALIGN_JUSTIFIED, VERTICAL_ALIGN_MIDDLE, VERTICAL_ALIGN_TOP
 
Fields inherited from interface net.sf.jasperreports.engine.JRAnchor
NO_BOOKMARK
 
Fields inherited from interface net.sf.jasperreports.engine.JRHyperlink
HYPERLINK_TARGET_BLANK, HYPERLINK_TARGET_SELF, HYPERLINK_TYPE_LOCAL_ANCHOR, HYPERLINK_TYPE_LOCAL_PAGE, HYPERLINK_TYPE_NONE, HYPERLINK_TYPE_REFERENCE, HYPERLINK_TYPE_REMOTE_ANCHOR, HYPERLINK_TYPE_REMOTE_PAGE
 
Constructor Summary
protected JRFillTextField(JRBaseFiller filler, JRTextField textField, JRFillObjectFactory factory)
           
 
Method Summary
 void collectExpressions(JRExpressionCollector collector)
           
protected  void copy(JRPrintText text)
           
protected  void evaluate(byte evaluation)
           
protected  void evaluateText(byte evaluation)
           
protected  JRPrintElement fill()
           
protected  java.lang.String getAnchorName()
           
 JRExpression getAnchorNameExpression()
          Returns an expression whose value represents the anchor name.
 int getBookmarkLevel()
          Returns the level of the bookmark corresponding to the anchor.
 JRChild getCopy(JRAbstractObjectFactory factory)
           
protected static java.text.DateFormat getDateFormat(int[] dateStyle, int[] timeStyle, java.util.Locale locale)
           
protected static int[] getDateStyle(java.lang.String pattern)
           
 JRGroup getEvaluationGroup()
          Gets the evaluation group for this text field.
 byte getEvaluationTime()
          Gets the evaluation time for this text field.
 JRExpression getExpression()
          Gets the expression for this field.
protected  java.lang.String getHyperlinkAnchor()
           
 JRExpression getHyperlinkAnchorExpression()
          Returns the expression whose value represents the anchor.
protected  java.lang.Integer getHyperlinkPage()
           
 JRExpression getHyperlinkPageExpression()
          Returns an integer representing the page index of the link.
protected  java.lang.String getHyperlinkReference()
           
 JRExpression getHyperlinkReferenceExpression()
          Returns the expression whose value represents the hyperlink reference.
 byte getHyperlinkTarget()
          Retrieves the hyperlink target for the element.
 byte getHyperlinkType()
          Retrieves the hyperlink type for the element.
protected  JRTemplateText getJRTemplateText()
           
 java.lang.String getPattern()
          Gets the pattern used for this text field.
 boolean isBlankWhenNull()
          Indicates whether an empty string will be displayed if the field's expression evaluates to null.
 boolean isStretchWithOverflow()
          Specifies whether the text field will stretch vertically if its text does not fit in one line.
protected  boolean prepare(int availableStretchHeight, boolean isOverflow)
           
protected  void resolveElement(JRPrintElement element, byte evaluation)
          Resolves an element.
 void setBlankWhenNull(boolean isBlank)
          Specifies whether an empty string sholuld be displayed if the field's expression evaluates to null.
protected  void setDateFormat(java.lang.String pattern)
           
protected  void setFormat()
           
 void setPattern(java.lang.String pattern)
          Sets the pattern used for this text field.
 void setStretchWithOverflow(boolean isStretchWithOverflow)
          Set to true if the text field should stretch vertically if its text does not fit in one line.
 void writeXml(JRXmlWriter xmlWriter)
           
 
Methods inherited from class net.sf.jasperreports.engine.fill.JRFillTextElement
chopTextElement, getBox, getFont, getHorizontalAlignment, getLeadingOffset, getLineSpacing, getLineSpacingFactor, getRawText, getRotation, getRunDirection, getStyledText, getStyledTextAttributes, getText, getTextAlignment, getTextEnd, getTextHeight, getTextStart, getVerticalAlignment, isStyledText, reset, rewind, setHorizontalAlignment, setLeadingOffset, setLineSpacing, setLineSpacingFactor, setRawText, setRotation, setStyledText, setTextAlignment, setTextEnd, setTextHeight, setTextStart, setVerticalAlignment
 
Methods inherited from class net.sf.jasperreports.engine.fill.JRFillElement
addDependantElement, evaluatePrintWhenExpression, getBackcolor, getBand, getBandBottomY, getDependantElements, getElementGroup, getForecolor, getGroupElements, getHeight, getKey, getMode, getPositionType, getPrintWhenExpression, getPrintWhenGroupChanges, getRelativeY, getStretchHeight, getStretchType, getWidth, getX, getY, isAlreadyPrinted, isPrintInFirstWholeBand, isPrintRepeatedValues, isPrintWhenDetailOverflows, isPrintWhenExpressionNull, isPrintWhenTrue, isRemoveLineWhenBlank, isReprinted, isToPrint, moveDependantElements, setAlreadyPrinted, setBackcolor, setBand, setBandBottomY, setForecolor, setMode, setPositionType, setPrintInFirstWholeBand, setPrintRepeatedValues, setPrintWhenDetailOverflows, setPrintWhenExpressionNull, setPrintWhenTrue, setRelativeY, setRemoveLineWhenBlank, setReprinted, setStretchHeight, setStretchType, setToPrint, setWidth, setX, stretchElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.jasperreports.engine.JRTextElement
getBox, getFont, getLineSpacing, getRotation, getTextAlignment, isStyledText, setLineSpacing, setRotation, setStyledText, setTextAlignment
 
Methods inherited from interface net.sf.jasperreports.engine.JRElement
getBackcolor, getElementGroup, getForecolor, getHeight, getKey, getMode, getPositionType, getPrintWhenExpression, getPrintWhenGroupChanges, getStretchType, getWidth, getX, getY, isPrintInFirstWholeBand, isPrintRepeatedValues, isPrintWhenDetailOverflows, isRemoveLineWhenBlank, setBackcolor, setForecolor, setMode, setPositionType, setPrintInFirstWholeBand, setPrintRepeatedValues, setPrintWhenDetailOverflows, setRemoveLineWhenBlank, setStretchType, setWidth, setX
 
Methods inherited from interface net.sf.jasperreports.engine.JRAlignment
getHorizontalAlignment, getVerticalAlignment, setHorizontalAlignment, setVerticalAlignment
 

Constructor Detail

JRFillTextField

protected JRFillTextField(JRBaseFiller filler,
                          JRTextField textField,
                          JRFillObjectFactory factory)
Method Detail

isStretchWithOverflow

public boolean isStretchWithOverflow()
Description copied from interface: JRTextField
Specifies whether the text field will stretch vertically if its text does not fit in one line.

Specified by:
isStretchWithOverflow in interface JRTextField
Returns:
true if the text field will stretch vertically, false otherwise

setStretchWithOverflow

public void setStretchWithOverflow(boolean isStretchWithOverflow)
Description copied from interface: JRTextField
Set to true if the text field should stretch vertically if its text does not fit in one line.

Specified by:
setStretchWithOverflow in interface JRTextField

getEvaluationTime

public byte getEvaluationTime()
Description copied from interface: JRTextField
Gets the evaluation time for this text field.

Specified by:
getEvaluationTime in interface JRTextField
Returns:
one of the evaluation time constants in JRExpression

getPattern

public java.lang.String getPattern()
Description copied from interface: JRTextField
Gets the pattern used for this text field. The pattern will be used in a SimpleDateFormat for dates and a DecimalFormat for numeric text fields. The pattern format must follow one of these two classes formatting rules, as specified in the JDK API docs.

Specified by:
getPattern in interface JRTextField
Returns:
a string containing the pattern.

setPattern

public void setPattern(java.lang.String pattern)
Description copied from interface: JRTextField
Sets the pattern used for this text field. The pattern will be used in a SimpleDateFormat for dates and a DecimalFormat for numeric text fields. The pattern format must follow one of these two classes formatting rules, as specified in the JDK API docs. If the pattern is incorrect, the exception thrown by formatter classes will be rethrown by the JasperReports fill engine.

Specified by:
setPattern in interface JRTextField

isBlankWhenNull

public boolean isBlankWhenNull()
Description copied from interface: JRTextField
Indicates whether an empty string will be displayed if the field's expression evaluates to null.

Specified by:
isBlankWhenNull in interface JRTextField
Returns:
true if an empty string will be displayed instead of null values, false otherwise

setBlankWhenNull

public void setBlankWhenNull(boolean isBlank)
Description copied from interface: JRTextField
Specifies whether an empty string sholuld be displayed if the field's expression evaluates to null.

Specified by:
setBlankWhenNull in interface JRTextField
Parameters:
isBlank - true if an empty string will be displayed instead of null values, false otherwise

getHyperlinkType

public byte getHyperlinkType()
Description copied from interface: JRHyperlink
Retrieves the hyperlink type for the element.

Specified by:
getHyperlinkType in interface JRHyperlink
Returns:
one of the hyperlink type constants

getHyperlinkTarget

public byte getHyperlinkTarget()
Description copied from interface: JRHyperlink
Retrieves the hyperlink target for the element.

Specified by:
getHyperlinkTarget in interface JRHyperlink
Returns:
one of the hyperlink target constants

getEvaluationGroup

public JRGroup getEvaluationGroup()
Description copied from interface: JRTextField
Gets the evaluation group for this text field. Used only when evaluation time is group.

Specified by:
getEvaluationGroup in interface JRTextField
See Also:
JRExpression.EVALUATION_TIME_GROUP

getExpression

public JRExpression getExpression()
Description copied from interface: JRTextField
Gets the expression for this field. The result obtained after evaluating this expression will be dispayed as the field text.

Specified by:
getExpression in interface JRTextField

getAnchorNameExpression

public JRExpression getAnchorNameExpression()
Description copied from interface: JRAnchor
Returns an expression whose value represents the anchor name.

Specified by:
getAnchorNameExpression in interface JRAnchor

getHyperlinkReferenceExpression

public JRExpression getHyperlinkReferenceExpression()
Description copied from interface: JRHyperlink
Returns the expression whose value represents the hyperlink reference. It is only used when the hyperlink type is reference or anchor

Specified by:
getHyperlinkReferenceExpression in interface JRHyperlink

getHyperlinkAnchorExpression

public JRExpression getHyperlinkAnchorExpression()
Description copied from interface: JRHyperlink
Returns the expression whose value represents the anchor. It is only used when the hyperlink type is anchor.

Specified by:
getHyperlinkAnchorExpression in interface JRHyperlink

getHyperlinkPageExpression

public JRExpression getHyperlinkPageExpression()
Description copied from interface: JRHyperlink
Returns an integer representing the page index of the link. It is only used when the hyperlink type is page. If the expression does not evaluate to an integer, an exception will be thrown.

Specified by:
getHyperlinkPageExpression in interface JRHyperlink

getAnchorName

protected java.lang.String getAnchorName()

getHyperlinkReference

protected java.lang.String getHyperlinkReference()

getHyperlinkAnchor

protected java.lang.String getHyperlinkAnchor()

getHyperlinkPage

protected java.lang.Integer getHyperlinkPage()

getJRTemplateText

protected JRTemplateText getJRTemplateText()

evaluate

protected void evaluate(byte evaluation)
                 throws JRException
Specified by:
evaluate in class JRFillElement
Throws:
JRException

evaluateText

protected void evaluateText(byte evaluation)
                     throws JRException
Throws:
JRException

prepare

protected boolean prepare(int availableStretchHeight,
                          boolean isOverflow)
Overrides:
prepare in class JRFillElement

fill

protected JRPrintElement fill()
Specified by:
fill in class JRFillElement

copy

protected void copy(JRPrintText text)

setFormat

protected void setFormat()

setDateFormat

protected void setDateFormat(java.lang.String pattern)

getDateStyle

protected static int[] getDateStyle(java.lang.String pattern)

getDateFormat

protected static java.text.DateFormat getDateFormat(int[] dateStyle,
                                                    int[] timeStyle,
                                                    java.util.Locale locale)

getCopy

public JRChild getCopy(JRAbstractObjectFactory factory)
Specified by:
getCopy in interface JRChild

collectExpressions

public void collectExpressions(JRExpressionCollector collector)
Specified by:
collectExpressions in interface JRElement

writeXml

public void writeXml(JRXmlWriter xmlWriter)
Specified by:
writeXml in interface JRChild

resolveElement

protected void resolveElement(JRPrintElement element,
                              byte evaluation)
                       throws JRException
Description copied from class: JRFillElement
Resolves an element.

Specified by:
resolveElement in class JRFillElement
Parameters:
element - the element
evaluation - the evaluation type
Throws:
JRException

getBookmarkLevel

public int getBookmarkLevel()
Description copied from interface: JRAnchor
Returns the level of the bookmark corresponding to the anchor.

Specified by:
getBookmarkLevel in interface JRAnchor
Returns:
the level of the bookmark corresponding to the anchor (starting from 1) or NO_BOOKMARK if no bookmark should be created for this anchor


© 2001-2005 JasperSoft Corporation www.jaspersoft.com