fop 0.95

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

java.lang.Object
  extended by org.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 log
          Static logging instance
 
Constructor Summary
AFPDataStream()
          Default constructor for the AFPDataStream.
 
Method Summary
 void createFont(byte fontReference, AFPFont font, 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)
          Helper method which allows creation of the MPO object, via the AEG.
 void createIncludePageSegment(java.lang.String name, int x, int y)
          Creates an IncludePageSegment on the current page.
 void createInvokeMediumMap(java.lang.String name)
          Helper method which allows creation of the IMM object.
 void createLine(int x1, int y1, int x2, int y2, int thickness, java.awt.Color col)
          Method to create a line on the current page.
 void createNoOperation(java.lang.String content)
          Creates a NoOperation item
 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 coordinates (the shading contrast is controlled via the red, green, blue parameters, by converting this to grey scale).
 void createTagLogicalElement(java.lang.String name, java.lang.String value)
          Creates a TagLogicalElement on the current page or page group
 void createText(int fontNumber, int x, int y, java.awt.Color col, int vsci, int ica, 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 endOverlay()
          Helper method to mark the end of the current overlay.
 void endPage()
          Helper method to mark the end of the current page.
 void endPageGroup()
          Helper method to mark the end of the page group.
 ImageObject getImageObject(int x, int y, int w, int h, int wr, int hr)
          Returns an ImageObject used to create an image in the datastream.
 void restorePage(PageObject pageObject)
          Helper method to restore the current page.
 PageObject savePage()
          Helper method to save the current page.
 void setLandscapeRotation(int pageRotation)
          Sets the rotation to be used for landscape pages, valid values are 0, 90, 180, 270 (default).
 void setOffsets(int xOff, int yOff, int rot)
          Sets the offsets to be used for element positioning
 void setPortraitRotation(int pageRotation)
          Sets the rotation to be used for portrait pages, valid values are 0 (default), 90, 180, 270.
 void startDocument(java.io.OutputStream docOutputStream)
          The document is started by invoking this method which creates an instance of the AFP Document object.
 void startOverlay(int overlayX, int overlayY, int overlayWidth, int overlayHeight, int overlayWidthResolution, int overlayHeightResolution, int overlayRotation)
          Start a new overlay.
 void startPage(int pageWidth, int pageHeight, int pageRotation, int pageWidthResolution, int pageHeightResolution)
          Start a new page.
 void startPageGroup()
          Start a new page group.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log
Static logging instance

Constructor Detail

AFPDataStream

public AFPDataStream()
Default constructor for the AFPDataStream.

Method Detail

startDocument

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

Parameters:
docOutputStream - the outputStream which the document is written to.

endDocument

public void endDocument()
                 throws java.io.IOException
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.

Throws:
java.io.IOException - throws an I/O exception of some sort has occurred

startPage

public void startPage(int pageWidth,
                      int pageHeight,
                      int pageRotation,
                      int pageWidthResolution,
                      int pageHeightResolution)
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
pageRotation - the rotation of the page
pageWidthResolution - the width resolution of the page
pageHeightResolution - the height resolution of the page

startOverlay

public void startOverlay(int overlayX,
                         int overlayY,
                         int overlayWidth,
                         int overlayHeight,
                         int overlayWidthResolution,
                         int overlayHeightResolution,
                         int overlayRotation)
Start a new overlay. When processing has finished on the current overlay, the endOverlay()method must be invoked to mark the overlay ending.

Parameters:
overlayX - the x position of the overlay on the page
overlayY - the y position of the overlay on the page
overlayWidth - the width of the overlay
overlayHeight - the height of the overlay
overlayWidthResolution - the width resolution of the overlay
overlayHeightResolution - the height resolution of the overlay
overlayRotation - the rotation of the overlay

endOverlay

public void endOverlay()
Helper method to mark the end of the current overlay.


savePage

public PageObject savePage()
Helper method to save the current page.

Returns:
current page object that was saved

restorePage

public void restorePage(PageObject pageObject)
Helper method to restore the current page.

Parameters:
pageObject - page object

endPage

public void endPage()
             throws java.io.IOException
Helper method to mark the end of the current page.

Throws:
java.io.IOException - thrown when an I/O exception of some sort has occurred

setOffsets

public void setOffsets(int xOff,
                       int yOff,
                       int rot)
Sets the offsets to be used for element positioning

Parameters:
xOff - the offset in the x direction
yOff - the offset in the y direction
rot - the rotation

createFont

public void createFont(byte fontReference,
                       AFPFont font,
                       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
font - the font
size - the point size of the font

createText

public void createText(int fontNumber,
                       int x,
                       int y,
                       java.awt.Color col,
                       int vsci,
                       int ica,
                       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
col - the text color
vsci - The variable space character increment.
ica - The inter character adjustment.
data - the text data to create

getImageObject

public ImageObject getImageObject(int x,
                                  int y,
                                  int w,
                                  int h,
                                  int wr,
                                  int hr)
Returns an ImageObject used to create an image in the datastream.

Parameters:
x - the x position of the image
y - the y position of the image
w - the width of the image
h - the height of the image
wr - the width resolution of the image
hr - the height resolution of the image
Returns:
ImageObject used to create an image in the datastream

createLine

public void createLine(int x1,
                       int y1,
                       int x2,
                       int y2,
                       int thickness,
                       java.awt.Color col)
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
col - The text color.

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 coordinates (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

createIncludePageOverlay

public void createIncludePageOverlay(java.lang.String name)
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

createInvokeMediumMap

public void createInvokeMediumMap(java.lang.String name)
Helper method which allows creation of the IMM object.

Parameters:
name - the name of the medium map

createIncludePageSegment

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

Parameters:
name - the name of the include page segment
x - the x coordinate for the overlay
y - 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.

createTagLogicalElement

public void createTagLogicalElement(java.lang.String name,
                                    java.lang.String value)
Creates a TagLogicalElement on the current page or page group

Parameters:
name - The tag name
value - The tag value

createNoOperation

public void createNoOperation(java.lang.String content)
Creates a NoOperation item

Parameters:
content - byte data

startPageGroup

public void startPageGroup()
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.


endPageGroup

public void endPageGroup()
                  throws java.io.IOException
Helper method to mark the end of the page group.

Throws:
java.io.IOException - thrown if an I/O exception of some sort has occurred

setPortraitRotation

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

Parameters:
pageRotation - The rotation in degrees.

setLandscapeRotation

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

Parameters:
pageRotation - The rotation in degrees.

fop 0.95

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