org.apache.fop.render.afp.modca

Class AbstractPageObject

Known Direct Subclasses:
Overlay, PageObject

public abstract class AbstractPageObject
extends AbstractNamedAFPObject

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 ActiveEnvironmentGroup
activeEnvironmentGroup
The active environment group for the page
protected List
objects
The list of objects within the page
protected ArrayList
segments
The list of the include page segments
protected ArrayList
tagLogicalElements
The list of tag logical elements

Fields inherited from class org.apache.fop.render.afp.modca.AbstractNamedAFPObject

name, nameBytes

Fields inherited from class org.apache.fop.render.afp.modca.AbstractAFPObject

log

Constructor Summary

AbstractPageObject(String name, int width, int height, int rotation, int widthResolution, int heightResolution)
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, 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 page.
void
createIncludePageSegment(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, int lineRotation, Color col)
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
createNoOperation(String content)
Creates a NoOperation on the 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(String name, String value)
Creates a TagLogicalElement on the page.
void
createText(int fontNumber, int x, int y, int textRotation, Color col, int vsci, int ica, 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.
int
getHeight()
Returns the height of the page
ImageObject
getImageObject()
Helper method to create an image on the current page and to return the object.
int
getRotation()
Returns the rotation of the page
int
getWidth()
Returns the width of the page
boolean
isComplete()
Returns an indication if the page is complete

Methods inherited from class org.apache.fop.render.afp.modca.AbstractAFPObject

writeDataStream, writeObjectList

Field Details

activeEnvironmentGroup

protected ActiveEnvironmentGroup activeEnvironmentGroup
The active environment group for the page

objects

protected List objects
The list of objects within the page

segments

protected ArrayList segments
The list of the include page segments

tagLogicalElements

protected ArrayList tagLogicalElements
The list of tag logical elements

Constructor Details

AbstractPageObject

public AbstractPageObject(String name,
                          int width,
                          int height,
                          int rotation,
                          int widthResolution,
                          int heightResolution)
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.
rotation - the rotation of the page.
widthResolution - the width resolution of the page.
heightResolution - the height resolution of the page.

Method Details

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 page.
Parameters:
fontReference - the font number used as the resource identifier
font - the font
size - the point size of the font

createIncludePageSegment

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

createLine

public void createLine(int x1,
                       int y1,
                       int x2,
                       int y2,
                       int thickness,
                       int lineRotation,
                       Color col)
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
lineRotation - the rotation of the line
col - The text color.

createNoOperation

public void createNoOperation(String content)
Creates a NoOperation on the page.
Parameters:
content - the byte data

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

createTagLogicalElement

public void createTagLogicalElement(String name,
                                    String value)
Creates a TagLogicalElement on the page.
Parameters:
name - the name of the tag
value - the value of the tag

createText

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

getActiveEnvironmentGroup

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

getHeight

public int getHeight()
Returns the height of the page
Returns:
the height of the page

getImageObject

public ImageObject getImageObject()
Helper method to create an image on the current page and to return the object.
Returns:
the image object

getRotation

public int getRotation()
Returns the rotation of the page
Returns:
the rotation of the page

getWidth

public int getWidth()
Returns the width of the page
Returns:
the width of the page

isComplete

public boolean isComplete()
Returns an indication if the page is complete
Returns:
whether this page is complete

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