fop 0.95

org.apache.fop.fo
Class FOText

java.lang.Object
  extended by org.apache.fop.fo.FONode
      extended by 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.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.fop.fo.FONode
FONode.FONodeIterator
 
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, FOX_URI, locator, log, parent, siblings
 
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)
          Bind the given PropertyList to this node Does nothing by default.
 CharIterator charIterator()
           
 FONode clone(FONode parent, boolean removeChildren)
          Perform a shallow cloning operation, set its parent, and optionally clean the list of child nodes
protected  void createBlockPointers(Block ancestorBlock)
          This method is run as part of the ancestor Block's flushText(), to create xref pointers to the previous FOText objects within the same Block
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.
protected  java.lang.String gatherContextInfo()
          Gathers context information for the getContextInfo() method.
 Block getAncestorBlock()
           
 Length getBaseLineShift()
           
 java.awt.Color getColor()
           
 CommonFont getCommonFont()
           
 CommonHyphenation getCommonHyphenation()
           
 KeepProperty getKeepTogether()
           
 Property getLetterSpacing()
           
 SpaceProperty getLineHeight()
           
 java.lang.String getLocalName()
          Returns the local name (i.e.
 FOText getNextFOTextThisBlock()
           
 java.lang.String getNormalNamespacePrefix()
          
 FOText getPrevFOTextThisBlock()
           
 CommonTextDecoration getTextDecoration()
           
 int getWhitespaceTreatment()
           
 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, attachSiblings, attributeError, attributeWarning, canHaveMarkers, clone, createPropertyList, decorateWithContextInfo, errorText, getChildNodes, getChildNodes, getContentHandlerFactory, getContextInfo, getExtensionAttachment, getFOEventHandler, getLocator, getLocatorString, getLogger, getName, getName, getNameId, getNamespaceURI, getNodeString, getParent, getRoot, getUserAgent, inMarker, invalidChildError, invalidChildError, missingChildElementError, missingPropertyError, nodesOutOfOrderError, processNode, removeChild, setLocator, startOfNode, tooManyNodesError, tooManyNodesError, validateChildNode, 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 XMLWhiteSpaceHandler 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
Adds characters (does nothing here)

Overrides:
addCharacters in class FONode
Parameters:
data - array of characters containing text to be added
start - starting array element to add
end - ending array element to add
list - currently applicable PropertyList
locator - location in fo source file.
Throws:
FOPException - if there's a problem during processing

clone

public FONode clone(FONode parent,
                    boolean removeChildren)
             throws FOPException
Perform a shallow cloning operation, set its parent, and optionally clean the list of child nodes

Overrides:
clone in class FONode
Parameters:
parent - the intended parent of the clone
removeChildren - if true, clean the list of child nodes
Returns:
the cloned FO node
Throws:
FOPException - if there's a problem while cloning the node

bind

public void bind(PropertyList pList)
          throws FOPException
Bind the given PropertyList to this node Does nothing by default. Subclasses should override this method in case they want to use the properties available on the PropertyList.

Overrides:
bind in class FONode
Parameters:
pList - the PropertyList
Throws:
FOPException - if there was an error when processing the PropertyList

endOfNode

protected void endOfNode()
                  throws FOPException
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
Throws:
FOPException - if there's a problem during processing

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

createBlockPointers

protected void createBlockPointers(Block ancestorBlock)
This method is run as part of the ancestor Block's flushText(), to create xref pointers to the previous FOText objects within the same Block


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 java.awt.Color getColor()
Returns:
the "color" property.

getKeepTogether

public KeepProperty getKeepTogether()
Returns:
the "keep-together" property.

getLetterSpacing

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

getLineHeight

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

getWhitespaceTreatment

public int getWhitespaceTreatment()
Returns:
the "white-space-treatment" 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

getLocalName

public java.lang.String getLocalName()
Returns the local name (i.e. without namespace prefix) of the node

Specified by:
getLocalName in class FONode
Returns:
the local name of this node

getNormalNamespacePrefix

public java.lang.String getNormalNamespacePrefix()

Specified by:
getNormalNamespacePrefix in class FONode
Returns:
the normally ussed namespace prefix for this kind of node (ex. "fo" for XSL-FO)

gatherContextInfo

protected java.lang.String gatherContextInfo()
Gathers context information for the getContextInfo() method.

Overrides:
gatherContextInfo in class FONode
Returns:
the collected context information or null, if none is available

fop 0.95

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