org.foray.core
Class FOrayTarget

java.lang.Object
  extended by org.foray.core.FOrayTarget
All Implemented Interfaces:
EventListener, org.axsl.area.AreaTreeListener, org.axsl.fo.FoTreeListener

public class FOrayTarget
extends Object
implements org.axsl.fo.FoTreeListener, org.axsl.area.AreaTreeListener

This class acts as a bridge between the XML:FO parser and the formatting/rendering classes. It will queue PageSequences up until all the IDs required by them are satisfied, at which time it will render the pages.

StreamRenderer is created by Driver and called from FOTreeBuilder when a PageSequence is created, and AreaTree when a Page is formatted.


Constructor Summary
FOrayTarget(FOrayDocument document, org.axsl.output.OutputTarget outputTarget, org.axsl.layout.Layout layout, OutputStream outputStream)
          Constructor.
 
Method Summary
 void cleanup()
          Closes the OutputStream, if any.
 void foComplete(org.axsl.fo.FoTreeEvent event)
           
 void foDocumentComplete(org.axsl.fo.FoTreeEvent event)
           
 void foPageSequenceComplete(org.axsl.fo.FoTreeEvent event)
           
 org.axsl.area.AreaTreeFactory getAreaTreeFactory()
          Return the AreaTreeFactory for this target.
 FOrayDocument getDocument()
          Returns the parent document.
 org.axsl.font.FontConsumer getFontConsumer()
          Return the FontConsumer for this target.
 org.axsl.font.FontServer getFontServer()
          Return the FontServer for this target.
 org.axsl.layout.LayoutFactory getLayoutFactory()
          Return the LayoutFactory for this target.
 org.axsl.layout.Layout getLayoutStrategy()
          Return the LayoutStrategy for this target.
 org.apache.commons.logging.Log getLogger()
          Returns the logger.
 OutputStream getOutputStream()
          Return the OutputStream for this target.
 org.axsl.output.OutputTarget getOutputTarget()
          Return the OutputTarget for this target.
 SessionConfig getSessionConfig()
          Return the SessionConfig for this target.
 org.axsl.text.TextServer getTextServer()
          Return the TextConsumer for this target.
 void pageComplete(org.axsl.area.AreaTreeEvent event)
           
 void render(org.axsl.fo.fo.PageSequence pageSequence)
          Outputs the PageSequence.
 void startRenderer()
          Starts the output processing.
 void stopRenderer()
          Cleans up after output processing.
 boolean wantsFoCompleteEvents()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FOrayTarget

public FOrayTarget(FOrayDocument document,
                   org.axsl.output.OutputTarget outputTarget,
                   org.axsl.layout.Layout layout,
                   OutputStream outputStream)
            throws FOrayException
Constructor.

Parameters:
document - The parent document.
outputTarget - The output target to which the document should be processed.
layout - The layout implementation responsible for laying the document out.
outputStream - The output stream, if any, to which the document should be written.
Throws:
FOrayException - For errors during document processing.
Method Detail

startRenderer

public void startRenderer()
                   throws FOrayException
Starts the output processing.

Throws:
FOrayException - For errors during processing.

stopRenderer

public void stopRenderer()
                  throws SAXException
Cleans up after output processing.

Throws:
SAXException - For errors during cleanup.

render

public void render(org.axsl.fo.fo.PageSequence pageSequence)
            throws FOrayException
Outputs the PageSequence.

Parameters:
pageSequence - The page sequence to be processed.
Throws:
FOrayException - For errors during processing.

pageComplete

public void pageComplete(org.axsl.area.AreaTreeEvent event)
Specified by:
pageComplete in interface org.axsl.area.AreaTreeListener

getLogger

public org.apache.commons.logging.Log getLogger()
Returns the logger.

Returns:
The logger.

foComplete

public void foComplete(org.axsl.fo.FoTreeEvent event)
Specified by:
foComplete in interface org.axsl.fo.FoTreeListener

foPageSequenceComplete

public void foPageSequenceComplete(org.axsl.fo.FoTreeEvent event)
                            throws org.axsl.fo.FoTreeException
Specified by:
foPageSequenceComplete in interface org.axsl.fo.FoTreeListener
Throws:
org.axsl.fo.FoTreeException

foDocumentComplete

public void foDocumentComplete(org.axsl.fo.FoTreeEvent event)
                        throws org.axsl.fo.FoTreeException
Specified by:
foDocumentComplete in interface org.axsl.fo.FoTreeListener
Throws:
org.axsl.fo.FoTreeException

wantsFoCompleteEvents

public boolean wantsFoCompleteEvents()
Specified by:
wantsFoCompleteEvents in interface org.axsl.fo.FoTreeListener

getFontConsumer

public org.axsl.font.FontConsumer getFontConsumer()
Return the FontConsumer for this target.

Returns:
The FontConsumer for this target.

getFontServer

public org.axsl.font.FontServer getFontServer()
Return the FontServer for this target.

Returns:
The FontServer for this target.

getTextServer

public org.axsl.text.TextServer getTextServer()
Return the TextConsumer for this target.

Returns:
The TextConsumer for this target.

getOutputStream

public OutputStream getOutputStream()
Return the OutputStream for this target.

Returns:
The OutputStream for this target.

getOutputTarget

public org.axsl.output.OutputTarget getOutputTarget()
Return the OutputTarget for this target.

Returns:
The OutputTarget for this target.

getSessionConfig

public SessionConfig getSessionConfig()
Return the SessionConfig for this target.

Returns:
The SessionConfig for this target.

getLayoutStrategy

public org.axsl.layout.Layout getLayoutStrategy()
Return the LayoutStrategy for this target.

Returns:
The LayoutStrategy for this target.

cleanup

public void cleanup()
Closes the OutputStream, if any. This method is part of the external API, and should not be run automatically, because the OutputStream may be under the control of an external process that wishes to leave it open and do some more processing to it.


getDocument

public FOrayDocument getDocument()
Returns the parent document.

Returns:
The parent document.

getAreaTreeFactory

public org.axsl.area.AreaTreeFactory getAreaTreeFactory()
Return the AreaTreeFactory for this target.

Returns:
The AreaTreeFactory for this target.

getLayoutFactory

public org.axsl.layout.LayoutFactory getLayoutFactory()
Return the LayoutFactory for this target.

Returns:
The LayoutFactory for this target.


Copyright © 2017. All rights reserved.