fop 0.90alpha1

org.apache.fop.fo
Class FOText

java.lang.Object
  |
  +--org.apache.fop.fo.FONode
        |
        +--org.apache.fop.fo.FOText
All Implemented Interfaces:
java.lang.Cloneable

public class FOText
extends FONode

A text node (PCDATA) in the formatting object tree. Unfortunately the BufferManager implementatation holds onto references to the character data in this object longer than the lifetime of the object itself, causing excessive memory consumption and OOM errors.

Author:
unascribed, Mark Lillywhite

Field Summary
 char[] ca
          the character array containing the text
 int endIndex
          The ending valid index of the ca array to be processed.
 int startIndex
          The starting valid index of the ca array to be processed.
 
Fields inherited from class org.apache.fop.fo.FONode
FO_URI, locator, log, parent
 
Constructor Summary
FOText(FONode parent)
          Creates a now FO text node.
 
Method Summary
protected  void addCharacters(char[] data, int start, int end, PropertyList list, org.xml.sax.Locator locator)
          Adds characters (does nothing here)
 void bind(PropertyList pList)
           
 CharIterator charIterator()
           
protected  void endOfNode()
          Primarily used for making final content model validation checks and/or informing the FOEventHandler that the end of this FO has been reached.
 Block getAncestorBlock()
           
 Length getBaseLineShift()
           
 ColorType getColor()
           
 CommonFont getCommonFont()
           
 CommonHyphenation getCommonHyphenation()
           
 Property getLetterSpacing()
           
 SpaceProperty getLineHeight()
           
 java.lang.String getLocalName()
          Returns the local name (i.e. without namespace prefix) of the node
 FOText getNextFOTextThisBlock()
           
 java.lang.String getNormalNamespacePrefix()
           
 FOText getPrevFOTextThisBlock()
           
 CommonTextDecoration getTextDecoration()
           
 Property getWordSpacing()
           
 int getWrapOption()
           
static int isWordChar(char inputChar)
          Determines whether the input char should be considered part of a "word".
 java.lang.String toString()
           
 boolean willCreateArea()
          Check if this text node will create an area.
 
Methods inherited from class org.apache.fop.fo.FONode
addChildNode, attributeError, attributeWarning, clone, clone, createPropertyList, errorText, getChildNodes, getChildNodes, getExtensionAttachment, getFOEventHandler, getLocator, getLocatorString, getLogger, getName, getName, getNameId, getNamespaceURI, getNodeString, getParent, getRoot, getUserAgent, invalidChildError, invalidChildError, missingChildElementError, missingPropertyError, nodesOutOfOrderError, processNode, removeChild, setLocator, startOfNode, tooManyNodesError, tooManyNodesError, validateChildNode, warningText
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ca

public char[] ca
the character array containing the text

startIndex

public int startIndex
The starting valid index of the ca array to be processed. This value is originally equal to 0, but becomes incremented during leading whitespace removal by the flow.Block class, via the TextCharIterator.remove() method below.

endIndex

public int endIndex
The ending valid index of the ca array to be processed. This value is originally equal to ca.length, but becomes decremented during between-word whitespace removal by the flow.Block class, via the TextCharIterator.remove() method below.
Constructor Detail

FOText

public FOText(FONode parent)
Creates a now FO text node.
Parameters:
parent - FONode that is the parent of this object
Method Detail

addCharacters

protected void addCharacters(char[] data,
                             int start,
                             int end,
                             PropertyList list,
                             org.xml.sax.Locator locator)
                      throws FOPException
Description copied from class: FONode
Adds characters (does nothing here)
Overrides:
addCharacters in class FONode
See Also:
FONode

bind

public void bind(PropertyList pList)
          throws FOPException
See Also:
FObj.bind(PropertyList)

endOfNode

protected void endOfNode()
                  throws FOPException
Description copied from class: FONode
Primarily used for making final content model validation checks and/or informing the FOEventHandler that the end of this FO has been reached.
Overrides:
endOfNode in class FONode
See Also:
FONode.endOfNode()

willCreateArea

public boolean willCreateArea()
Check if this text node will create an area. This means either there is non-whitespace or it is preserved whitespace. Maybe this just needs to check length > 0, since char iterators handle whitespace.
Returns:
true if this will create an area in the output

charIterator

public CharIterator charIterator()
Overrides:
charIterator in class FONode
Returns:
a new TextCharIterator

getPrevFOTextThisBlock

public FOText getPrevFOTextThisBlock()
Returns:
The previous FOText node in this Block; null, if this is the first FOText in this Block.

getNextFOTextThisBlock

public FOText getNextFOTextThisBlock()
Returns:
The next FOText node in this Block; null if this is the last FOText in this Block; null if subsequent FOText nodes have not yet been processed.

getAncestorBlock

public Block getAncestorBlock()
Returns:
The nearest ancestor block object which contains this FOText.

isWordChar

public static int isWordChar(char inputChar)
Determines whether the input char should be considered part of a "word". This is used primarily to determine whether the character immediately following starts a new word, but may have other uses. We have not found a definition of "word" in the standard (1.0), so the logic used here is based on the programmer's best guess.
Parameters:
inputChar - the character to be tested.
Returns:
int IS_WORD_CHAR_TRUE, IS_WORD_CHAR_FALSE, or IS_WORD_CHAR_MAYBE, depending on whether the character should be considered part of a word or not.

getCommonFont

public CommonFont getCommonFont()
Returns:
the Common Font Properties.

getCommonHyphenation

public CommonHyphenation getCommonHyphenation()
Returns:
the Common Hyphenation Properties.

getColor

public ColorType getColor()
Returns:
the "color" property.

getLetterSpacing

public Property getLetterSpacing()
Returns:
the "letter-spacing" property.

getLineHeight

public SpaceProperty getLineHeight()
Returns:
the "line-height" property.

getWordSpacing

public Property getWordSpacing()
Returns:
the "word-spacing" property.

getWrapOption

public int getWrapOption()
Returns:
the "wrap-option" property.

getTextDecoration

public CommonTextDecoration getTextDecoration()
Returns:
the "text-decoration" property.

getBaseLineShift

public Length getBaseLineShift()
Returns:
the baseline-shift property

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

getLocalName

public java.lang.String getLocalName()
Description copied from class: FONode
Returns the local name (i.e. without namespace prefix) of the node
Overrides:
getLocalName in class FONode
See Also:
FONode.getLocalName()

getNormalNamespacePrefix

public java.lang.String getNormalNamespacePrefix()
Overrides:
getNormalNamespacePrefix in class FONode
See Also:
FONode.getNormalNamespacePrefix()

fop 0.90alpha1

Copyright 1999-2005 The Apache Software Foundation. All Rights Reserved.