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

java.lang.Object
  extended byorg.apache.fop.render.afp.modca.AFPObject
      extended byorg.apache.fop.render.afp.modca.PageObject

public class PageObject
extends AFPObject

Pages contain the data objects that comprise a presentation document. Each page has a set of data objects associated with it. Each page within a document is independent from any other page, and each must establish its own environment parameters. The page is the level in the document component hierarchy that is used for printing or displaying a document's content. The data objects contained in the page envelope in the data stream are presented when the page is presented. Each data object has layout information associated with it that directs the placement and orientation of the data on the page. In addition, each page contains layout information that specifies the measurement units, page width, and page depth. A page is initiated by a begin page structured field and terminated by an end page structured field. Structured fields that define objects and active environment groups or that specify attributes of the page may be encountered in page state.


Field Summary
protected  java.lang.String _name
          The name of the page object
protected  byte[] _nameBytes
          The name of the page object as EBCIDIC bytes
 
Fields inherited from class org.apache.fop.render.afp.modca.AFPObject
LOGGER
 
Constructor Summary
PageObject(java.lang.String name, int width, int height)
          Construct a new page object for the specified name argument, the page name should be an 8 character identifier.
 
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 page.
 void createIncludePageOverlay(java.lang.String name, int orientation)
          Creates an IncludePageOverlay on the page.
 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)
          Helper method to create a line on the current page, this method delegates to the presentation text object in order to construct the line.
 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 createTagLogicalElement(java.lang.String name, java.lang.String value)
          Creates a TagLogicalElement on the page.
 void createText(int fontNumber, int x, int y, byte[] data)
          Helper method to create text on the current page, this method delegates to the presentation text object in order to construct the text.
 void endPage()
          Helper method to mark the end of the page.
 ActiveEnvironmentGroup getActiveEnvironmentGroup()
          Returns the ActiveEnvironmentGroup associated with this page.
 byte[] getDataStream()
          Accessor method to obtain the byte array AFP datastream for the page.
protected  byte[] getEnd()
          Helper method to return the end of the page as a byte array.
protected  byte[] getStart()
          Helper method to return the start of the page as a byte array.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_name

protected java.lang.String _name
The name of the page object


_nameBytes

protected byte[] _nameBytes
The name of the page object as EBCIDIC bytes

Constructor Detail

PageObject

public PageObject(java.lang.String name,
                  int width,
                  int height)
Construct a new page object for the specified name argument, the page name should be an 8 character identifier.

Parameters:
name - the name of the page.
width - the width of the page.
height - the height of the page.
Method Detail

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 page.

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

createLine

public void createLine(int x1,
                       int y1,
                       int x2,
                       int y2,
                       int thickness)
Helper method to create a line on the current page, this method delegates to the presentation text object in order to construct the line.

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

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 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 data
y - the y coordinate of the text data
data - the text data to create

endPage

public void endPage()
Helper method to mark the end of the page. This should end the control sequence on the current presenation text object.


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

getDataStream

public byte[] getDataStream()
                     throws java.io.IOException
Accessor method to obtain the byte array AFP datastream for the page.

Specified by:
getDataStream in class AFPObject
Returns:
byte[] data stream
Throws:
java.io.IOException

createIncludePageOverlay

public void createIncludePageOverlay(java.lang.String name,
                                     int orientation)
Creates an IncludePageOverlay on the page.

Parameters:
name - the name of the overlay
orientation - the orientation required for the overlay

createTagLogicalElement

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

Parameters:
name - the name of the tag
value - the value of the tag

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 page segment
xCoor - the x cooridinate of the page segment.
yCoor - the y cooridinate of the page segment.

getActiveEnvironmentGroup

public ActiveEnvironmentGroup getActiveEnvironmentGroup()
Returns the ActiveEnvironmentGroup associated with this page.

Returns:
the ActiveEnvironmentGroup object

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.

getStart

protected byte[] getStart()
Helper method to return the start of the page as a byte array.

Returns:
byte[] data stream

getEnd

protected byte[] getEnd()
Helper method to return the end of the page as a byte array.

Returns:
byte[] data stream