org.apache.fop.render.afp.modca
Class AFPDataStream

java.lang.Object
  extended byorg.apache.fop.render.afp.modca.AFPDataStream

public class AFPDataStream
extends java.lang.Object

A data stream is a continuous ordered stream of data elements and objects conforming to a given format. Application programs can generate data streams destined for a presentation service, archive library, presentation device or another application program. The strategic presentation data stream architectures used is Mixed Object Document Content Architecture (MO:DCA�). The MO:DCA architecture defines the data stream used by applications to describe documents and object envelopes for interchange with other applications and application services. Documents defined in the MO:DCA format may be archived in a database, then later retrieved, viewed, annotated and printed in local or distributed systems environments. Presentation fidelity is accommodated by including resource objects in the documents that reference them.


Field Summary
protected static org.apache.commons.logging.Log LOGGER
          Static logging instance
 
Constructor Summary
AFPDataStream()
          Default constructor for the AFPDataStream.
 
Method Summary
 void createFont(byte fontReference, java.lang.String fontFamily, java.lang.String weight, java.lang.String style, int size)
          Helper method to create a map coded font object on the current page, this method delegates the construction of the map coded font object to the active environment group on the current page.
 void createIncludePageOverlay(java.lang.String name, int orientation)
          Helper method which allows creation of the MPO object, via the AEG.
 void createIncludePageSegment(java.lang.String name, int xCoor, int yCoor)
          Creates an IncludePageSegment on the current page.
 void createLine(int x1, int y1, int x2, int y2, int thickness)
          Method to create a line on the current page.
 void createPageGroupTagLogicalElement(TagLogicalElementBean[] attributes)
          Creates a TagLogicalElement on the current page group.
 void createPageTagLogicalElement(TagLogicalElementBean[] attributes)
          Creates a TagLogicalElement on the current page.
 void createShading(int x, int y, int w, int h, int red, int green, int blue)
          This method will create shading on the page using the specified ooordinates (the shading contrast is controlled via the red, green blue parameters, by converting this to grey scale).
 void createText(int fontNumber, int x, int y, byte[] data)
          Helper method to create text on the current page, this method delegates to the current presentation text object in order to construct the text.
 void endDocument()
          The document is ended by invoking this method which creates an instance of the AFP Document object and registers the start with a validation map which ensures that methods are not invoked out of the correct sequence.
 void endPage()
          Helper method to mark the end of the current page.
 void endPageGroup()
          Helper method to mark the end of the page group.
 void setLandscapeRotation(int rotation)
          Sets the rotation to be used for landsacpe pages, valid values are 0, 90, 180, 270 (default).
 void setPortraitRotation(int rotation)
          Sets the rotation to be used for portrait pages, valid values are 0 (default), 90, 180, 270.
 void setProducer(java.lang.String producer)
          Sets the application producing the AFP.
 void startDocument()
          The document is started by invoking this method which creates an instance of the AFP Document object.
 void startPage(int pageWidth, int pageHeight)
          Start a new page.
 void startPageGroup(java.lang.String name)
          Start a new page group.
 void write(java.io.OutputStream outputstream)
          Write the document data to the output stream, this will invoke getDataStream on the document, which is then invoked recursively on child AFPObject's to construct the full data stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

protected static final org.apache.commons.logging.Log LOGGER
Static logging instance

Constructor Detail

AFPDataStream

public AFPDataStream()
Default constructor for the AFPDataStream.

Method Detail

startDocument

public void startDocument()
The document is started by invoking this method which creates an instance of the AFP Document object.


endDocument

public void endDocument()
The document is ended by invoking this method which creates an instance of the AFP Document object and registers the start with a validation map which ensures that methods are not invoked out of the correct sequence.


startPage

public void startPage(int pageWidth,
                      int pageHeight)
Start a new page. When processing has finished on the current page, the endPage()method must be invoked to mark the page ending.

Parameters:
pageWidth - the width of the page
pageHeight - the height of the page

endPage

public void endPage()
Helper method to mark the end of the current page.


createFont

public void createFont(byte fontReference,
                       java.lang.String fontFamily,
                       java.lang.String weight,
                       java.lang.String style,
                       int size)
Helper method to create a map coded font object on the current page, this method delegates the construction of the map coded font object to the active environment group on the current page.

Parameters:
fontReference - the font number used as the resource identifier
fontFamily - the font family identifies the font name
weight - the weight of the font (e.g. normal, bold)
style - the style of the font (e.g. normal, italics)
size - the point size of the font

createText

public void createText(int fontNumber,
                       int x,
                       int y,
                       byte[] data)
Helper method to create text on the current page, this method delegates to the current presentation text object in order to construct the text.

Parameters:
fontNumber - the font number used as the resource identifier
x - the x coordinate of the text
y - the y coordinate of the text
data - the text data to create

createLine

public void createLine(int x1,
                       int y1,
                       int x2,
                       int y2,
                       int thickness)
Method to create a line on the current page.

Parameters:
x1 - the first x coordinate of the line
y1 - the first y coordinate of the line
x2 - the second x coordinate of the line
y2 - the second y coordinate of the line
thickness - the thickness of the line

setProducer

public void setProducer(java.lang.String producer)
Sets the application producing the AFP.

Parameters:
producer - the application producing the AFP datastream

createShading

public void createShading(int x,
                          int y,
                          int w,
                          int h,
                          int red,
                          int green,
                          int blue)
This method will create shading on the page using the specified ooordinates (the shading contrast is controlled via the red, green blue parameters, by converting this to grey scale).

Parameters:
x - the x coordinate of the shading
y - the y coordinate of the shading
w - the width of the shaded area
h - the height of the shaded area
red - the red value
green - the green value
blue - the blue value

write

public void write(java.io.OutputStream outputstream)
           throws java.io.IOException
Write the document data to the output stream, this will invoke getDataStream on the document, which is then invoked recursively on child AFPObject's to construct the full data stream.

Parameters:
outputstream - the output stream to which data is written
Throws:
java.io.IOException.
java.io.IOException

createIncludePageOverlay

public void createIncludePageOverlay(java.lang.String name,
                                     int orientation)
Helper method which allows creation of the MPO object, via the AEG. And the IPO via the Page. (See actual object for descriptions.)

Parameters:
name - the name of the static overlay
orientation - the orientation for the overlay (0, 90, 180, 270)

createIncludePageSegment

public void createIncludePageSegment(java.lang.String name,
                                     int xCoor,
                                     int yCoor)
Creates an IncludePageSegment on the current page.

Parameters:
name - the name of the include page segment
xCoor - the x coordinate for the overlay
yCoor - the y coordinate for the overlay

createPageTagLogicalElement

public void createPageTagLogicalElement(TagLogicalElementBean[] attributes)
Creates a TagLogicalElement on the current page.

Parameters:
attributes - the array of key value pairs.

createPageGroupTagLogicalElement

public void createPageGroupTagLogicalElement(TagLogicalElementBean[] attributes)
Creates a TagLogicalElement on the current page group.

Parameters:
attributes - the array of key value pairs.

startPageGroup

public void startPageGroup(java.lang.String name)
Start a new page group. When processing has finished on the current page group the endPageGroup()method must be invoked to mark the page group ending.

Parameters:
name - the name of the page group

endPageGroup

public void endPageGroup()
Helper method to mark the end of the page group.


setPortraitRotation

public void setPortraitRotation(int rotation)
Sets the rotation to be used for portrait pages, valid values are 0 (default), 90, 180, 270.

Parameters:
rotation - The rotation in degrees.

setLandscapeRotation

public void setLandscapeRotation(int rotation)
Sets the rotation to be used for landsacpe pages, valid values are 0, 90, 180, 270 (default).

Parameters:
rotation - The rotation in degrees.