org.foray.area
Class Area

java.lang.Object
  extended by org.foray.common.AbstractOrderedTreeNode
      extended by org.foray.area.AreaNode
          extended by org.foray.area.Area
All Implemented Interfaces:
Iterable<org.axsl.galley.AreaNode>, TreeNode, org.axsl.area.Area, org.axsl.area.AreaNode, org.axsl.fo.FoContext, OrderedTreeNode
Direct Known Subclasses:
AreaFixed, AreaFlexible

public abstract class Area
extends AreaNode
implements org.axsl.galley.Area, org.axsl.area.Area

Abstract superclass for all Areas in the AreaTree.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.foray.common.AbstractOrderedTreeNode
AbstractOrderedTreeNode.PostOrderDescendantIterator
 
Constructor Summary
protected Area()
          Constructor.
 
Method Summary
 int brBpd()
           
 int brIpd()
           
 int brOriginBPDOffset()
          The difference, in millipoints, between the page-viewport-area's before-edge and this Area's border-rectangle before-edge.
 int brOriginIPDOffset()
          The difference, in millipoints, between the page-viewport-area's start-edge and this Area's border-rectangle start-edge.
 int brOriginX()
           
 int brOriginY()
           
 Rectangle2D.Float brPoints()
          Returns the border rectangle measured in points (1/72 of an inch).
abstract  org.axsl.common.value.RelativeAxis contentStackingAxis()
          Returns the content stacking axis for this area.
 org.axsl.common.value.AbsoluteAxis contentStackingAxisAbsolute()
          Return the absolute axis for this area.
 org.axsl.common.value.AbsoluteDirection contentStackingDirectionAbsolute()
          Return the absolute direction for this area.
abstract  int crBpd()
           
abstract  int crIpd()
           
abstract  int crOriginBPDOffset()
          The difference, in millipoints, between the page-viewport-area's before-edge and this Area's content-rectangle before-edge.
abstract  int crOriginIPDOffset()
          The difference, in millipoints, between the page-viewport-area's start-edge and this Area's content-rectangle start-edge.
 int crOriginX()
           
 int crOriginY()
           
 Rectangle2D.Float crPoints()
          Returns the content rectangle measured in points (1/72 of an inch).
 String destinationName()
           
 boolean generatedByExists()
           
 String generatedByName()
           
 Area getAreaParent()
          Returns the parent Area.
 org.axsl.common.value.AbsoluteAxis getBPAxis()
          Tells which axis (horizontal or vertical) is the block-progression axis.
 org.axsl.font.Font.WritingMode getFontWritingMode()
          Returns the writing mode associated with this Area.
 org.axsl.common.value.AbsoluteAxis getIPAxis()
          Tells which axis (horizontal or vertical) is the inline-progression axis.
 org.axsl.area.BlockContainerRefArea getNearestAncestorAreaContainer()
          Returns the nearest ancestor area that is a block container.
abstract  Area getOverflowArea(Area childRequesting)
          This method is used by child Areas to ask the parent Area into which Area the child Area's overflow should be placed.
abstract  int getProgressionDimension()
          Returns the actual total value, in millipoints, of the size of this area (not counting space-before, etc.) in its progression direction.
 org.axsl.common.value.WritingMode getWritingMode()
          Returns the writing-mode for this area.
 boolean hasFenceFollowing()
          Indicates whether there is an absolute fence following this Area for purposes of stacking constraints.
 boolean hasFencePreceding()
          Indicates whether there is an absolute fence preceding this Area for purposes of stacking constraints.
abstract  void incrementProgressionDimension(int incrementAmount)
          Change the progression-dimension used by this Area.
abstract  boolean isAbsolutelyPositioned()
          Indicates whether this Area is positioned absolutely or relatively.
 boolean isBlockArea()
          Indicates whether this Area is a block area.
protected  boolean isFirstChildOfParent()
          Indicates whether this area is its parent's first child.
 boolean isInNormalFlow()
          Indicates whether this Area is part of the normal flow.
protected  boolean isLastChildOfParent()
          Indicates whether this area is its parent's last child.
 boolean isLinkRoot()
           
 int larBPD()
          Returns the BPD of the LAR.
 int larIPD()
          Returns the IPD of the LAR.
 int larOriginX()
          See brOriginX() where point-of-origin is defined.
 int larOriginY()
          See brOriginX() where point-of-origin is defined.
 String linkDestination()
           
 org.axsl.common.value.LinkType linkType()
           
 int narBPD()
          Retursn the BPD of the NAR.
 int narIPD()
          Returns the IPD of the NAR.
 int narOriginX()
          See brOriginX() where point-of-origin is defined.
 int narOriginY()
          See brOriginX() where point-of-origin is defined.
 Area nearestArea()
           
 int parentAllocationWidth()
          Returns the allocation width of this area's parent.
abstract  int pdAvailable()
           
abstract  int pdUsedBySiblings()
          Returns the total amount of the progression-dimension that has been used by siblings.
 int prBpd()
          Returns the BPD of the PR.
 int prIpd()
          Returns the IPD of the PR.
 int prOriginBPDOffset()
          The difference, in millipoints, between the page-viewport-area's before-edge and this Area's padding-rectangle before-edge.
 int prOriginIPDOffset()
          The difference, in millipoints, between the page-viewport-area's start-edge and this Area's padding-rectangle start-edge.
 int prOriginX()
          Implementation of BackgroundArea.prOriginX().
 int prOriginY()
          Implementation of BackgroundArea.prOriginY().
 short referenceOrientationCumulative()
          Returns the cumulative reference orientation for this area.
abstract  void setMinimumProgressionDimension(int minimumPD)
          Set the minimum progression dimension for this Area.
abstract  void setProgressionDimension(int progressionDimension)
          Sets the progression-dimension used by this Area.
 boolean shouldAdjustParentPD()
          Indicates whether the parent progression dimension should be adjusted.
 AreaClass traitAreaClass()
          Returns the area-class trait for this Area.
abstract  int traitBorderAfterWidth()
          Returns the border-after-width trait for this area.
abstract  int traitBorderBeforeWidth()
          Returns the border-before-width trait for this area.
abstract  int traitBorderEndWidth()
          Returns the border-end-width trait for this area.
abstract  int traitBorderStartWidth()
          Returns the border-start-width trait for this area.
abstract  int traitEndIndent()
          Returns the end-indent trait.
 String traitId()
           
 boolean traitIsFirst()
          Indicates whether this is the first child of the "generated by".
 boolean traitIsLast()
          Indicates whether this is the last child of the "generated by".
 boolean traitIsReferenceArea()
          Indicates whether this area is a reference area.
abstract  int traitPaddingAfter()
          Returns the padding-after trait for this area.
abstract  int traitPaddingBefore()
          Returns the padding-before trait for this area.
abstract  int traitPaddingEnd()
          Returns the padding-end trait for this area.
abstract  int traitPaddingStart()
          Returns the padding-start trait for this area.
abstract  int traitSpaceAfterOptimum()
          Returns the space-after optimum trait for this area.
abstract  int traitSpaceBeforeOptimum()
          Returns the space-before optimum trait for this area.
abstract  int traitSpaceEndOptimum()
          Returns the space-end optimum trait for this area.
abstract  int traitSpaceStartOptimum()
          Returns the space-start optimum trait for this area.
abstract  int traitStartIndent()
          Returns the start-indent trait.
 org.axsl.common.value.WhiteSpaceTreatment traitWhiteSpaceTreatment()
          Returns the whitespace-treatment trait for this area.
 
Methods inherited from class org.foray.area.AreaNode
ancestorArea, ancestorBlockAreaNotALineArea, ancestorBlockContentFactory, ancestorBlockOrRa, ancestorGeneratedByBlockLevelFO, ancestorLineArea, ancestorNormalBlockArea, ancestorPageCollection, ancestorReferenceArea, ancestorSpanRA, ancestorTableArea, bpdAncestorBlockOrRa, getAllowsChildren, getAreaTree, getChildAt, getChildren, getColor, getContainingReferenceArea, getFirstAreaChild, getFirstChild, getGalley, getGraftingPoint, getLastAreaChild, getLastChild, getLinkage, getLogger, getNextChildOfGeneratedBy, getNextSiblingArea, getNormalLinkage, getNormalLinkage, getOrderedParent, getPage, getParent, getPreviousChildOfGeneratedBy, getPreviousSiblingArea, getSiblings, hasUnresolvedRefId, heightContainingBlock, ipdAncestorBlockArea, ipdAncestorBlockOrRa, ipdContainingRefArea, ipdParentArea, isFirst, isFirstChildOfGeneratedBy, isGeneratedByBlockLevelFo, isLast, isLastChildOfGeneratedBy, iterator, linkage, nearestBeforeFloatArea, nearestFootnoteArea, nearestGeneratedByBlockLevelFo, nearestNormalBlockArea, nearestTableArea, optimize, optimizeChildren, registerWithLinkage, remove, removeChild, setParent, tableWidth, traitGeneratedBy, 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
getAreaName, getChildAt, getGalley, render
 
Methods inherited from interface java.lang.Iterable
iterator
 
Methods inherited from interface org.axsl.area.AreaNode
ancestorArea, ancestorBlockContentFactory, ancestorNormalBlockArea, ancestorTableArea, getAreaName, getAreaTree, getPage, isFirstChildOfGeneratedBy, nearestGeneratedByBlockLevelFo, removeChild, siblingIndex, traitGeneratedBy
 
Methods inherited from interface javax.swing.tree.TreeNode
children, getAllowsChildren, getChildCount, getIndex, getParent, isLeaf
 
Methods inherited from interface org.axsl.fo.FoContext
bpdAncestorBlockOrRa, getGraftingPoint, heightContainingBlock, ipdAncestorBlockArea, ipdAncestorBlockOrRa, ipdContainingRefArea, ipdParentArea, isFirst, isLast, tableWidth, widthContainingBlock
 

Constructor Detail

Area

protected Area()
Constructor.

Method Detail

getNearestAncestorAreaContainer

public org.axsl.area.BlockContainerRefArea getNearestAncestorAreaContainer()
Returns the nearest ancestor area that is a block container.

Returns:
The nearest ancestor area that is a block container.

generatedByExists

public boolean generatedByExists()

generatedByName

public String generatedByName()

traitEndIndent

public abstract int traitEndIndent()
Returns the end-indent trait.

Returns:
The end-indent trait.

traitStartIndent

public abstract int traitStartIndent()
Returns the start-indent trait.

Returns:
The start-indent trait.

parentAllocationWidth

public int parentAllocationWidth()
Returns the allocation width of this area's parent.

Returns:
The allocation width of this area's parent.

isFirstChildOfParent

protected boolean isFirstChildOfParent()
Indicates whether this area is its parent's first child.

Returns:
True iff this area is its parent's first child.

isLastChildOfParent

protected boolean isLastChildOfParent()
Indicates whether this area is its parent's last child.

Returns:
True iff this area is its parent's last child.

getAreaParent

public Area getAreaParent()
Returns the parent Area.

Returns:
The parent if it is an Area, or null if it is not.

pdUsedBySiblings

public abstract int pdUsedBySiblings()
Returns the total amount of the progression-dimension that has been used by siblings.

Returns:
The total amount of the progression-dimension that has been used by siblings.

brIpd

public int brIpd()

brBpd

public int brBpd()

brOriginIPDOffset

public int brOriginIPDOffset()
The difference, in millipoints, between the page-viewport-area's start-edge and this Area's border-rectangle start-edge. This assumes for now that the IP Direction is the same for all areas.

Returns:
The IPD offset of the border rectangle.

brOriginBPDOffset

public int brOriginBPDOffset()
The difference, in millipoints, between the page-viewport-area's before-edge and this Area's border-rectangle before-edge. This assumes for now that the BP Direction is the same for all areas.

Returns:
The BPD offset of the border rectangle.

brOriginX

public int brOriginX()

brOriginY

public int brOriginY()

prIpd

public int prIpd()
Returns the IPD of the PR.

Returns:
The inline-progression-dimension of the padding-rectangle for this Area.

prBpd

public int prBpd()
Returns the BPD of the PR.

Returns:
The block-progression-dimension of the padding-rectangle for this Area.

prOriginIPDOffset

public int prOriginIPDOffset()
The difference, in millipoints, between the page-viewport-area's start-edge and this Area's padding-rectangle start-edge. This assumes for now that the IP Direction is the same for all areas.

Returns:
The IPD offset of the padding rectangle.

prOriginBPDOffset

public int prOriginBPDOffset()
The difference, in millipoints, between the page-viewport-area's before-edge and this Area's padding-rectangle before-edge. This assumes for now that the BP Direction is the same for all areas.

Returns:
The BPD offset of the padding rectangle.

prOriginX

public int prOriginX()
Implementation of BackgroundArea.prOriginX().

Returns:
The padding-rectangle point-of-origin x coordinate.

prOriginY

public int prOriginY()
Implementation of BackgroundArea.prOriginY().

Returns:
The padding-rectangle point-of-origin y coordinate.

crIpd

public abstract int crIpd()
Specified by:
crIpd in interface org.axsl.area.Area

crBpd

public abstract int crBpd()
Specified by:
crBpd in interface org.axsl.area.Area

crOriginIPDOffset

public abstract int crOriginIPDOffset()
The difference, in millipoints, between the page-viewport-area's start-edge and this Area's content-rectangle start-edge. This assumes for now that the IP Direction is the same for all areas.

Returns:
The IPD offset of the content rectangle.

crOriginBPDOffset

public abstract int crOriginBPDOffset()
The difference, in millipoints, between the page-viewport-area's before-edge and this Area's content-rectangle before-edge. This assumes for now that the BP Direction is the same for all areas.

Returns:
The BPD offset of the content rectangle.

crOriginX

public int crOriginX()

crOriginY

public int crOriginY()

narIPD

public int narIPD()
Returns the IPD of the NAR.

Returns:
The inline-progression-dimension of the normal-allocation-rectangle for this Area.

narBPD

public int narBPD()
Retursn the BPD of the NAR.

Returns:
The block-progression-dimension of the normal-allocation-rectangle for this Area.

narOriginX

public int narOriginX()
See brOriginX() where point-of-origin is defined.

Returns:
The absolute cartesian X value, on the page, of the point of origin of the normal-allocation-rectangle.

narOriginY

public int narOriginY()
See brOriginX() where point-of-origin is defined.

Returns:
The absolute cartesian Y value, on the page, of the point of origin of the normal-allocation-rectangle.

larIPD

public int larIPD()
Returns the IPD of the LAR.

Returns:
The inline-progression-dimension of the large-allocation-rectangle for this Area.

larBPD

public int larBPD()
Returns the BPD of the LAR.

Returns:
The block-progression-dimension of the large-allocation-rectangle for this Area.

larOriginX

public int larOriginX()
See brOriginX() where point-of-origin is defined.

Returns:
The absolute cartesian X value, on the page, of the point of origin of the large-allocation-rectangle.

larOriginY

public int larOriginY()
See brOriginX() where point-of-origin is defined.

Returns:
The absolute cartesian Y value, on the page, of the point of origin of the large-allocation-rectangle.

isBlockArea

public boolean isBlockArea()
Indicates whether this Area is a block area.

Returns:
True if this Area is a block-area, false if it is an inline-area. Defaults to true. Inline areas should override this method.

traitSpaceBeforeOptimum

public abstract int traitSpaceBeforeOptimum()
Returns the space-before optimum trait for this area.

Returns:
The space-before optimum trait for this area.

traitSpaceAfterOptimum

public abstract int traitSpaceAfterOptimum()
Returns the space-after optimum trait for this area.

Returns:
The space-after optimum trait for this area.

traitSpaceStartOptimum

public abstract int traitSpaceStartOptimum()
Returns the space-start optimum trait for this area.

Returns:
The space-start optimum trait for this area.

traitSpaceEndOptimum

public abstract int traitSpaceEndOptimum()
Returns the space-end optimum trait for this area.

Returns:
The space-end optimum trait for this area.

getBPAxis

public org.axsl.common.value.AbsoluteAxis getBPAxis()
Tells which axis (horizontal or vertical) is the block-progression axis.

Returns:
Either AbsoluteAxis.HORIZONTAL or AbsoluteAxis.VERTICAL, or null if writing-mode is invalid.

getIPAxis

public org.axsl.common.value.AbsoluteAxis getIPAxis()
Tells which axis (horizontal or vertical) is the inline-progression axis.

Returns:
Either AbsoluteAxis.HORIZONTAL or AbsoluteAxis.VERTICAL, or null if writing-mode is invalid.

getWritingMode

public org.axsl.common.value.WritingMode getWritingMode()
Returns the writing-mode for this area.

Returns:
The writing-mode for this area.

contentStackingAxis

public abstract org.axsl.common.value.RelativeAxis contentStackingAxis()
Returns the content stacking axis for this area.

Returns:
Either RelativeAxis.BLOCK_PROGRESSION or RelativeAxis.INLINE_PROGRESSION, depending on whether the contents of this area stack in the block-progression-direction or the inline-progression-direction. The default value is that contents stack in the BPD. Classes that stack in the IPD should override this method.

contentStackingAxisAbsolute

public org.axsl.common.value.AbsoluteAxis contentStackingAxisAbsolute()
Return the absolute axis for this area.

Returns:
Either AbsoluteAxis.HORIZONTAL or AbsoluteAxis.VERTICAL, depending on the relative content stacking axis and the writing-mode.
See Also:
contentStackingAxis()

contentStackingDirectionAbsolute

public org.axsl.common.value.AbsoluteDirection contentStackingDirectionAbsolute()
Return the absolute direction for this area.

Returns:
One of AbsoluteDirection.TOP_TO_BOTTOM, AbsoluteDirection.BOTTOM_TO_TOP, AbsoluteDirection.LEFT_TO_RIGHT, or AbsoluteDirection.RIGHT_TO_LEFT, depending on the writing-mode.

pdAvailable

public abstract int pdAvailable()
Specified by:
pdAvailable in interface org.axsl.area.Area

getProgressionDimension

public abstract int getProgressionDimension()

Returns the actual total value, in millipoints, of the size of this area (not counting space-before, etc.) in its progression direction. This value does not include space-before, etc., but does include borders and padding. For block areas, the progression dimension is the block-progression-dimension. For inline areas, it is the inline-progression-dimension.

Returns:
The progressionDimension.

setProgressionDimension

public abstract void setProgressionDimension(int progressionDimension)
Sets the progression-dimension used by this Area.

Parameters:
progressionDimension - The new progression-dimension value for this Area.

setMinimumProgressionDimension

public abstract void setMinimumProgressionDimension(int minimumPD)
Set the minimum progression dimension for this Area. If the current progression dimension value is less than this value, it will be increased to this minimum. Otherwise, it is ignored.

Parameters:
minimumPD - The minimum progression dimension to set.

incrementProgressionDimension

public abstract void incrementProgressionDimension(int incrementAmount)
Change the progression-dimension used by this Area.

Parameters:
incrementAmount - The amount by which the progression-dimension should be changed for this area. Positive values increase the progression-dimension, negative values decrease it.

getOverflowArea

public abstract Area getOverflowArea(Area childRequesting)
                              throws org.axsl.area.AreaTreeException
This method is used by child Areas to ask the parent Area into which Area the child Area's overflow should be placed. Overflows start when a new LineArea cannot be create for the current BlockArea. General strategy for overflow is to recursively go up the tree until getting to any Area that knows how to solve the overflow. One general case is the page-reference-area, which should know how to create a new page.

Parameters:
childRequesting - Child Areas ask
Returns:
The younger sister Area that should be used to handle the overflow condition.
Throws:
org.axsl.area.AreaTreeException - If the Area is unable to find or create the overflow area.

traitIsReferenceArea

public boolean traitIsReferenceArea()
Indicates whether this area is a reference area.

Returns:
True iff this area is a reference area.

referenceOrientationCumulative

public short referenceOrientationCumulative()
Returns the cumulative reference orientation for this area.

Returns:
The cumulative reference orientation for this area, in degrees.

traitWhiteSpaceTreatment

public org.axsl.common.value.WhiteSpaceTreatment traitWhiteSpaceTreatment()
Returns the whitespace-treatment trait for this area.

Returns:
The whitespace-treatment trait for this area.

traitIsFirst

public boolean traitIsFirst()
Indicates whether this is the first child of the "generated by".

Returns:
True iff this is the first child of the "generated by".

traitIsLast

public boolean traitIsLast()
Indicates whether this is the last child of the "generated by".

Returns:
True iff this is the last child of the "generated by".

destinationName

public String destinationName()

isLinkRoot

public boolean isLinkRoot()

linkType

public org.axsl.common.value.LinkType linkType()

linkDestination

public String linkDestination()

crPoints

public Rectangle2D.Float crPoints()
Returns the content rectangle measured in points (1/72 of an inch).

Returns:
The content rectangle in points.

brPoints

public Rectangle2D.Float brPoints()
Returns the border rectangle measured in points (1/72 of an inch).

Returns:
The border rectangle in points.

isAbsolutelyPositioned

public abstract boolean isAbsolutelyPositioned()
Indicates whether this Area is positioned absolutely or relatively.

Returns:
True iff this Area is absolutely positioned.

isInNormalFlow

public boolean isInNormalFlow()
Indicates whether this Area is part of the normal flow. See XSL-FO 1.0, Section 7.5, where absolutely-positioned Areas are excluded from the normal flow, and do not affect the positioning of later siblings.

Returns:
True iff this Area is part of the normal flow and affects the positioning of later siblings.

shouldAdjustParentPD

public boolean shouldAdjustParentPD()
Indicates whether the parent progression dimension should be adjusted.

Returns:
True iff the parent progression dimension should be adjusted.

traitAreaClass

public AreaClass traitAreaClass()
Returns the area-class trait for this Area.

Returns:
The area-class trait for this Area.
See Also:
"XSL-FO 1.1, Section 4.2.5."

hasFencePreceding

public boolean hasFencePreceding()
Indicates whether there is an absolute fence preceding this Area for purposes of stacking constraints. This method is only relevant for block-areas as inline-areas have a more complicated fencing procedure.

Returns:
True iff this Area has a fence preceding it.
See Also:
"XSL-FO 1.1, Section 4.2.5, under 'Block-stacking constraints'."

hasFenceFollowing

public boolean hasFenceFollowing()
Indicates whether there is an absolute fence following this Area for purposes of stacking constraints. This method is only relevant for block-areas as inline-areas have a more complicated fencing procedure.

Returns:
True iff this Area has a fence following it.
See Also:
"XSL-FO 1.1, Section 4.2.5, under 'Block-stacking constraints'."

nearestArea

public Area nearestArea()
Specified by:
nearestArea in interface org.axsl.area.AreaNode
Overrides:
nearestArea in class AreaNode

traitId

public String traitId()

traitBorderStartWidth

public abstract int traitBorderStartWidth()
Returns the border-start-width trait for this area.

Returns:
The border-start-width trait for this area.

traitBorderEndWidth

public abstract int traitBorderEndWidth()
Returns the border-end-width trait for this area.

Returns:
The border-end-width trait for this area.

traitBorderBeforeWidth

public abstract int traitBorderBeforeWidth()
Returns the border-before-width trait for this area.

Returns:
The border-before-width trait for this area.

traitBorderAfterWidth

public abstract int traitBorderAfterWidth()
Returns the border-after-width trait for this area.

Returns:
The border-after-width trait for this area.

traitPaddingStart

public abstract int traitPaddingStart()
Returns the padding-start trait for this area.

Returns:
The padding-start trait for this area.

traitPaddingEnd

public abstract int traitPaddingEnd()
Returns the padding-end trait for this area.

Returns:
The padding-end trait for this area.

traitPaddingBefore

public abstract int traitPaddingBefore()
Returns the padding-before trait for this area.

Returns:
The padding-before trait for this area.

traitPaddingAfter

public abstract int traitPaddingAfter()
Returns the padding-after trait for this area.

Returns:
The padding-after trait for this area.

getFontWritingMode

public org.axsl.font.Font.WritingMode getFontWritingMode()
Returns the writing mode associated with this Area.

Returns:
The writing mode (vertical or horizontal) that is associated with this Area.


Copyright © 2017. All rights reserved.