org.foray.area
Class PageCollection

java.lang.Object
  extended by org.foray.common.AbstractOrderedTreeNode
      extended by org.foray.area.AreaNode
          extended by org.foray.area.NonArea
              extended by org.foray.area.PageCollection
All Implemented Interfaces:
Iterable<org.axsl.galley.AreaNode>, TreeNode, org.axsl.area.AreaNode, org.axsl.area.PageCollection, org.axsl.fo.FoContext, OrderedTreeNode

public final class PageCollection
extends NonArea
implements org.axsl.galley.PageCollection, org.axsl.area.PageCollection

PageCollection is not really an Area. It is a convenience class that is intended to be analogous to the PageSequence in the FOTree, which should be considered its cousin. Its parent should always be an AreaTree instance, and its children should always be PageRA instances.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.foray.common.AbstractOrderedTreeNode
AbstractOrderedTreeNode.PostOrderDescendantIterator
 
Nested classes/interfaces inherited from interface org.axsl.area.PageCollection
org.axsl.area.PageCollection.Force
 
Method Summary
 PageCollection ancestorPageCollection()
          Returns the ancestor page collection for this area.
 String getAreaName()
           
 AreaTree getAreaTree()
          Returns the ancestor AreaTree for this area.
 List<PageRA> getChildren()
          Return the List of this node's children.
 int getCurrentPageNumber()
          Returns the current page number.
 List<org.axsl.fo.fo.Marker> getCurrentPageSequenceMarkers()
          Returns the markers in this page sequence.
 List<org.axsl.fo.fo.Marker> getDocumentMarkers()
          Returns the markers in this document.
 int getLastPageNumber()
          Returns the last page number used.
 FOLinkage getLinkage()
          Returns the raw "generated by" instance.
 PageRA getPage()
           Overrides Area method, because anybody trying to run that method on an AreaTree instance will get an NPE, since it uses getParent().
 int getPageCount()
           
 org.axsl.common.PositiveIntegerFormatter getPageNumberFormatter()
           
 CharSequence getPageNumberPrefix()
           
 CharSequence getPageNumberSuffix()
           
 org.axsl.fo.fo.PageSequence getPageSequence()
           
 AreaTree getParent()
           
 void incrementPageCount()
          Increases the page count by 1.
 void layoutComplete()
           
 org.axsl.area.PageArea makePage(org.axsl.area.PageCollection.Force forceValue)
           
protected  boolean optimize()
          This method should be run after layout is complete, allowing cleanup and adjustments that do not affect the placement of the areas to be computed before the page is rendered.
 void padPagesAtBeginning()
          This method creates any blank pages that are needed at the beginning of an PageCollection to meet the related PageSequence's constraints.
 PageCollection previousPageCollection()
          Returns the PageCollection previous to this one from the sequence of PageCollection instances.
 void render(org.axsl.galley.RenderVisitor visitor)
           
 int sequence()
          Returns the sequence number of this PageCollection, starting at 0.
 void setParent(AreaNode node)
          Sets the parent node.
 org.axsl.fo.fo.PageSequence traitGeneratedBy()
           
 
Methods inherited from class org.foray.area.AreaNode
ancestorArea, ancestorBlockAreaNotALineArea, ancestorBlockContentFactory, ancestorBlockOrRa, ancestorGeneratedByBlockLevelFO, ancestorLineArea, ancestorNormalBlockArea, ancestorReferenceArea, ancestorSpanRA, ancestorTableArea, bpdAncestorBlockOrRa, getAllowsChildren, getChildAt, getColor, getContainingReferenceArea, getFirstAreaChild, getFirstChild, getGalley, getGraftingPoint, getLastAreaChild, getLastChild, getLogger, getNextChildOfGeneratedBy, getNextSiblingArea, getNormalLinkage, getNormalLinkage, getOrderedParent, getPreviousChildOfGeneratedBy, getPreviousSiblingArea, getSiblings, hasUnresolvedRefId, heightContainingBlock, ipdAncestorBlockArea, ipdAncestorBlockOrRa, ipdContainingRefArea, ipdParentArea, isFirst, isFirstChildOfGeneratedBy, isGeneratedByBlockLevelFo, isLast, isLastChildOfGeneratedBy, iterator, linkage, nearestArea, nearestBeforeFloatArea, nearestFootnoteArea, nearestGeneratedByBlockLevelFo, nearestNormalBlockArea, nearestTableArea, optimizeChildren, registerWithLinkage, remove, removeChild, tableWidth, widthContainingBlock
 
Methods inherited from class org.foray.common.AbstractOrderedTreeNode
children, getChildCount, getFirstLeaf, getIndex, getLastLeaf, getLevel, getNextLeaf, getNextSibling, getPreviousLeaf, getPreviousSibling, getSharedAncestor, hasChildren, isLeaf, isNodeAncestor, isNodeDescendant, nextPostOrderNode, nextPreOrderNode, postOrderDescendantIterator, siblingIndex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.axsl.galley.AreaNode
getChildAt, getGalley
 
Methods inherited from interface java.lang.Iterable
iterator
 
Methods inherited from interface org.axsl.area.AreaNode
ancestorArea, ancestorBlockContentFactory, ancestorNormalBlockArea, ancestorTableArea, isFirstChildOfGeneratedBy, nearestArea, nearestGeneratedByBlockLevelFo, removeChild, siblingIndex
 
Methods inherited from interface javax.swing.tree.TreeNode
children, getAllowsChildren, getChildCount, getIndex, isLeaf
 
Methods inherited from interface org.axsl.fo.FoContext
bpdAncestorBlockOrRa, getGraftingPoint, heightContainingBlock, ipdAncestorBlockArea, ipdAncestorBlockOrRa, ipdContainingRefArea, ipdParentArea, isFirst, isLast, tableWidth, widthContainingBlock
 

Method Detail

getPage

public PageRA getPage()
Overrides Area method, because anybody trying to run that method on an AreaTree instance will get an NPE, since it uses getParent().

Specified by:
getPage in interface org.axsl.area.AreaNode
Overrides:
getPage in class AreaNode

getPageSequence

public org.axsl.fo.fo.PageSequence getPageSequence()
Specified by:
getPageSequence in interface org.axsl.area.PageCollection

getPageCount

public int getPageCount()
Specified by:
getPageCount in interface org.axsl.area.PageCollection

incrementPageCount

public void incrementPageCount()
Increases the page count by 1.


sequence

public int sequence()
Returns the sequence number of this PageCollection, starting at 0. The first PageCollection in the AreaTree will return 0, the second will return 1, etc.

Returns:
The sequence number of this PageCollection, starting at 0, or a -1 if this PageCollection is not found.

previousPageCollection

public PageCollection previousPageCollection()
Returns the PageCollection previous to this one from the sequence of PageCollection instances.

Returns:
The previous PageCollection, or null if this is the first one.

getCurrentPageNumber

public int getCurrentPageNumber()
Returns the current page number.

Returns:
The current page number.

getLastPageNumber

public int getLastPageNumber()
Returns the last page number used.

Returns:
The last page number used.

getCurrentPageSequenceMarkers

public List<org.axsl.fo.fo.Marker> getCurrentPageSequenceMarkers()
Returns the markers in this page sequence.

Returns:
The markers in this page sequence.

getDocumentMarkers

public List<org.axsl.fo.fo.Marker> getDocumentMarkers()
Returns the markers in this document.

Returns:
The markers in this document.

makePage

public org.axsl.area.PageArea makePage(org.axsl.area.PageCollection.Force forceValue)
                                throws org.axsl.area.AreaTreeException
Specified by:
makePage in interface org.axsl.area.PageCollection
Throws:
org.axsl.area.AreaTreeException

padPagesAtBeginning

public void padPagesAtBeginning()
                         throws org.axsl.area.AreaTreeException
This method creates any blank pages that are needed at the beginning of an PageCollection to meet the related PageSequence's constraints.

Throws:
org.axsl.area.AreaTreeException - If the FO Tree cannot provide the information needed to add the pages needed for padding.

layoutComplete

public void layoutComplete()
                    throws org.axsl.area.AreaTreeException
Specified by:
layoutComplete in interface org.axsl.area.PageCollection
Throws:
org.axsl.area.AreaTreeException

getAreaTree

public AreaTree getAreaTree()
Description copied from class: AreaNode
Returns the ancestor AreaTree for this area.

Specified by:
getAreaTree in interface org.axsl.area.AreaNode
Specified by:
getAreaTree in interface org.axsl.area.PageCollection
Overrides:
getAreaTree in class AreaNode
Returns:
The ancestor AreaTree for this area.

ancestorPageCollection

public PageCollection ancestorPageCollection()
Returns the ancestor page collection for this area. Overrides the AreaNode method, because this is the PageCollection instance being sought.

Overrides:
ancestorPageCollection in class AreaNode
Returns:
The ancestor page collection.

getAreaName

public String getAreaName()
Specified by:
getAreaName in interface org.axsl.area.AreaNode

render

public void render(org.axsl.galley.RenderVisitor visitor)
            throws org.axsl.galley.GalleyVisitorException
Throws:
org.axsl.galley.GalleyVisitorException

getParent

public AreaTree getParent()
Specified by:
getParent in interface TreeNode
Specified by:
getParent in class AreaNode

setParent

public void setParent(AreaNode node)
               throws org.axsl.area.AreaTreeException
Description copied from class: AreaNode
Sets the parent node.

Specified by:
setParent in class AreaNode
Parameters:
node - The new parent node.
Throws:
org.axsl.area.AreaTreeException - If the parent node is not compatible with the implementations specification for a parent node.

getChildren

public List<PageRA> getChildren()
Description copied from class: AbstractOrderedTreeNode
Return the List of this node's children.

Specified by:
getChildren in class AreaNode
Returns:
The List of this node's children.

optimize

protected boolean optimize()
Description copied from class: AreaNode
This method should be run after layout is complete, allowing cleanup and adjustments that do not affect the placement of the areas to be computed before the page is rendered. For example, empty areas should be removed. Also classes like LineArea can use this to adjust word-spacing and other variables. NOTE: This method is called recursively by each node. The process starts at PageRA.layoutComplete().

Specified by:
optimize in class AreaNode
Returns:
True iff the Area node thinks it should be removed.

getLinkage

public FOLinkage getLinkage()
Description copied from class: AreaNode
Returns the raw "generated by" instance.

Specified by:
getLinkage in class AreaNode
Returns:
The raw linkage item.

traitGeneratedBy

public org.axsl.fo.fo.PageSequence traitGeneratedBy()
Specified by:
traitGeneratedBy in interface org.axsl.area.AreaNode
Specified by:
traitGeneratedBy in class AreaNode

getPageNumberFormatter

public org.axsl.common.PositiveIntegerFormatter getPageNumberFormatter()

getPageNumberPrefix

public CharSequence getPageNumberPrefix()

getPageNumberSuffix

public CharSequence getPageNumberSuffix()


Copyright © 2017. All rights reserved.