Package org.apache.fop.afp.modca
Class AbstractPageObject
- java.lang.Object
-
- All Implemented Interfaces:
Completable
,Streamable
- Direct Known Subclasses:
AbstractResourceGroupContainer
public abstract class AbstractPageObject extends AbstractNamedAFPObject implements Completable
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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.fop.afp.modca.AbstractAFPObject
AbstractAFPObject.Category, AbstractAFPObject.Type
-
-
Field Summary
Fields Modifier and Type Field Description protected ActiveEnvironmentGroup
activeEnvironmentGroup
The active environment group for the pageprotected boolean
complete
The page stateprivate PresentationTextObject
currentPresentationTextObject
The current presentation text objectprotected Factory
factory
the object factoryprivate int
height
The page heightprivate int
heightRes
The height resolutionprotected java.util.List
objects
The list of objects within this resource containerprotected int
rotation
The page rotationprivate int
width
The page widthprivate int
widthRes
The width resolution-
Fields inherited from class org.apache.fop.afp.modca.AbstractNamedAFPObject
name
-
Fields inherited from class org.apache.fop.afp.modca.AbstractTripletStructuredObject
triplets
-
Fields inherited from class org.apache.fop.afp.modca.AbstractAFPObject
LOG, SF_CLASS, SF_HEADER_LENGTH
-
-
Constructor Summary
Constructors Constructor Description AbstractPageObject(Factory factory)
Default constructorAbstractPageObject(Factory factory, java.lang.String name)
Main constructorAbstractPageObject(Factory factory, java.lang.String name, int width, int height, int rotation, int widthRes, int heightRes)
Construct a new page object for the specified name argument, the page name should be an 8 character identifier.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addObject(java.lang.Object obj)
Adds an AFP object reference to this pagevoid
createFont(int 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(java.lang.String name, int x, int y, boolean hard)
Creates an IncludePageSegment on the current page.void
createLine(AFPLineDataInfo lineDataInfo)
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(java.lang.String content)
Creates a NoOperation on the page.void
createTagLogicalElement(TagLogicalElement.State state)
Creates a TagLogicalElement on the page.void
createText(PtocaProducer producer)
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.void
endPresentationObject()
Ends the presentation text objectActiveEnvironmentGroup
getActiveEnvironmentGroup()
Returns the ActiveEnvironmentGroup associated with this page.int
getHeight()
Returns the height of the pagePresentationTextObject
getPresentationTextObject()
Helper method to create a presentation text object on the current page and to return the object.int
getRotation()
Returns the rotation of the pageprotected java.util.List
getTagLogicalElements()
Returns the list ofTagLogicalElement
s.int
getWidth()
Returns the width of the pageboolean
isComplete()
Returns true if this object is completevoid
setComplete(boolean complete)
Sets whether or not this object is complete or notprotected void
writeContent(java.io.OutputStream os)
Helper method to write the contents of the Object.-
Methods inherited from class org.apache.fop.afp.modca.AbstractNamedAFPObject
copySF, getName, getNameBytes, getNameLength, setName, toString
-
Methods inherited from class org.apache.fop.afp.modca.AbstractTripletStructuredObject
addTriplet, addTriplets, getFullyQualifiedName, getTripletDataLength, getTriplets, hasTriplet, hasTriplets, setComment, setFullyQualifiedName, setFullyQualifiedName, setObjectClassification, writeTriplets
-
Methods inherited from class org.apache.fop.afp.modca.AbstractStructuredObject
writeEnd, writeStart, writeToStream
-
Methods inherited from class org.apache.fop.afp.modca.AbstractAFPObject
copySF, truncate, writeChunksToStream, writeObjects
-
-
-
-
Field Detail
-
activeEnvironmentGroup
protected ActiveEnvironmentGroup activeEnvironmentGroup
The active environment group for the page
-
currentPresentationTextObject
private PresentationTextObject currentPresentationTextObject
The current presentation text object
-
objects
protected java.util.List objects
The list of objects within this resource container
-
width
private int width
The page width
-
height
private int height
The page height
-
rotation
protected int rotation
The page rotation
-
complete
protected boolean complete
The page state
-
widthRes
private int widthRes
The width resolution
-
heightRes
private int heightRes
The height resolution
-
factory
protected final Factory factory
the object factory
-
-
Constructor Detail
-
AbstractPageObject
public AbstractPageObject(Factory factory)
Default constructor- Parameters:
factory
- the object factory
-
AbstractPageObject
public AbstractPageObject(Factory factory, java.lang.String name)
Main constructor- Parameters:
factory
- the object factoryname
- the name of this page object
-
AbstractPageObject
public AbstractPageObject(Factory factory, java.lang.String name, int width, int height, int rotation, int widthRes, int heightRes)
Construct a new page object for the specified name argument, the page name should be an 8 character identifier.- Parameters:
factory
- the object factory.name
- the name of the page.width
- the width of the page.height
- the height of the page.rotation
- the rotation of the page.widthRes
- the width resolution of the page.heightRes
- the height resolution of the page.
-
-
Method Detail
-
createFont
public void createFont(int 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 identifierfont
- the fontsize
- the point size of the font
-
createLine
public void createLine(AFPLineDataInfo lineDataInfo)
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:
lineDataInfo
- the line data information.
-
createText
public void createText(PtocaProducer producer) throws java.io.UnsupportedEncodingException
Helper method to create text on the current page, this method delegates to the presentation text object in order to construct the text.- Parameters:
producer
- the producer- Throws:
java.io.UnsupportedEncodingException
- thrown if character encoding is not supported
-
endPage
public void endPage()
Helper method to mark the end of the page. This should end the control sequence on the current presentation text object.
-
endPresentationObject
public void endPresentationObject()
Ends the presentation text object
-
getPresentationTextObject
public PresentationTextObject getPresentationTextObject()
Helper method to create a presentation text object on the current page and to return the object.- Returns:
- the presentation text object
-
getTagLogicalElements
protected java.util.List getTagLogicalElements()
Returns the list ofTagLogicalElement
s.- Returns:
- the TLEs
-
createTagLogicalElement
public void createTagLogicalElement(TagLogicalElement.State state)
Creates a TagLogicalElement on the page.- Parameters:
state
- the state of the TLE
-
createNoOperation
public void createNoOperation(java.lang.String content)
Creates a NoOperation on the page.- Parameters:
content
- the byte data
-
createIncludePageSegment
public void createIncludePageSegment(java.lang.String name, int x, int y, boolean hard)
Creates an IncludePageSegment on the current page.- Parameters:
name
- the name of the page segmentx
- the x coordinate of the page segment.y
- the y coordinate of the page segment.hard
- true if hard page segment possible
-
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
-
getWidth
public int getWidth()
Returns the width of the page- Returns:
- the width of the page
-
getRotation
public int getRotation()
Returns the rotation of the page- Returns:
- the rotation of the page
-
writeContent
protected void writeContent(java.io.OutputStream os) throws java.io.IOException
Helper method to write the contents of the Object.- Overrides:
writeContent
in classAbstractStructuredObject
- Parameters:
os
- The stream to write to- Throws:
java.io.IOException
- throws an I/O exception if one occurred
-
addObject
public void addObject(java.lang.Object obj)
Adds an AFP object reference to this page- Parameters:
obj
- an AFP object
-
setComplete
public void setComplete(boolean complete)
Sets whether or not this object is complete or not- Specified by:
setComplete
in interfaceCompletable
- Parameters:
complete
- true if this object is complete
-
isComplete
public boolean isComplete()
Returns true if this object is complete- Specified by:
isComplete
in interfaceCompletable
- Returns:
- true if this object is complete
-
-