org.foray.pioneer
Class FONodePL

java.lang.Object
  extended by org.foray.pioneer.FONodePL
Direct Known Subclasses:
FObjPL, FOTextPL, NoLayoutPL

public abstract class FONodePL
extends Object

Abstract Pioneer Layout superclass for all Fo instances.


Field Summary
static int BREAK_AFTER
          value of progress after break-after.
static int START
          value of progress before layout begins.
 
Constructor Summary
FONodePL(org.axsl.fo.Fo realFObj, PioneerLS layout)
          Constructor.
 
Method Summary
protected  org.axsl.area.LineArea activeLineArea(org.axsl.area.AreaNode areaNode)
          Finds the LineArea into which items nominally to be laid out in area should actually be laid out.
protected  Status addNonTextContent(org.axsl.area.LineArea inputLineArea, org.axsl.fo.fo.GraftingPoint graftingPoint)
          Add this object's non-text line content to a line.
protected  int addNonTextItemToLine(org.axsl.area.LineArea lineArea, org.axsl.fo.FoLineNonText nonText, org.axsl.fo.FoContext foContext)
          Adds a non-text item to the line.
protected  int addTextItemToLine(org.axsl.area.LineArea lineArea, org.axsl.fo.FoLineText lineText, int start, int end, org.axsl.fo.fo.GraftingPoint graftingPoint)
          Adds a text item to the line.
abstract  org.axsl.fo.Fo getFONode()
          Returns the FO Tree node that is being laid out by this layout item.
 PioneerLS getLayout()
          Returns the layout strategy.
protected  FONodePL getLayoutProxy(org.axsl.fo.Fo node)
          Returns the layout proxy for a given FO Tree node.
 org.apache.commons.logging.Log getLogger()
          Returns the logger.
 int getProgress()
          Returns the progress value for this node.
 List<Integer> getProgressSnapshot(List<Integer> snapshot)
          At the start of a new span area layout may be partway through a nested FO, and balancing requires rollback to this known point.
abstract  Status layout(org.axsl.area.AreaNode areaNode, org.axsl.fo.fo.GraftingPoint graftingPoint)
          Each FONodePL subclass implements this method on a manner appropriate for its content.
 void resetProgress()
          Resets the progress of the layout for the item to "START".
 void rollback(List<Integer> snapshot)
          When balancing occurs, the flow layout() method restarts at the point specified by the current progress snapshot, which is retrieved and restored using this method.
 void setProgress(int progress)
          Sets the progress indicator.
protected  Status standardLayout(org.axsl.area.AreaNode areaNode, org.axsl.fo.fo.GraftingPoint graftingPoint)
          A standard layout that can be used by subclasses that have no real layout work themselves, but need to make sure their children are laid out.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

START

public static final int START
value of progress before layout begins.

See Also:
Constant Field Values

BREAK_AFTER

public static final int BREAK_AFTER
value of progress after break-after.

See Also:
Constant Field Values
Constructor Detail

FONodePL

public FONodePL(org.axsl.fo.Fo realFObj,
                PioneerLS layout)
Constructor.

Parameters:
realFObj - The FO Tree object which is being laid out.
layout - The ancestor layout system.
Method Detail

resetProgress

public void resetProgress()
Resets the progress of the layout for the item to "START".


getProgressSnapshot

public List<Integer> getProgressSnapshot(List<Integer> snapshot)
At the start of a new span area layout may be partway through a nested FO, and balancing requires rollback to this known point. The snapshot records exactly where layout is at.

Parameters:
snapshot - a ArrayList of progress indicators (Integer)
Returns:
the updated ArrayList of progress indicators (Integers)

rollback

public void rollback(List<Integer> snapshot)
When balancing occurs, the flow layout() method restarts at the point specified by the current progress snapshot, which is retrieved and restored using this method.

Parameters:
snapshot - the ArrayList of saved progress indicators (Integers)

getProgress

public int getProgress()
Returns the progress value for this node.

Returns:
Returns the progress value.

setProgress

public void setProgress(int progress)
Sets the progress indicator.

Parameters:
progress - The progress indicator to be stored.

getLayoutProxy

protected FONodePL getLayoutProxy(org.axsl.fo.Fo node)
Returns the layout proxy for a given FO Tree node.

Parameters:
node - The node for which the layout proxy is needed.
Returns:
The layout proxy for node

layout

public abstract Status layout(org.axsl.area.AreaNode areaNode,
                              org.axsl.fo.fo.GraftingPoint graftingPoint)
                       throws org.axsl.area.AreaTreeException
Each FONodePL subclass implements this method on a manner appropriate for its content.

Parameters:
areaNode - The Area in which the contents to be laid out by this should be placed. For example, for TableCellPL layout method, area should be a TableRowContainer. During the layout process, at least one TableCellArea should be created, which is then passed to layout for the children of the TableCell now being laid out.
graftingPoint - The RetrieveMarker instance, if any, into which this content will be laid out.
Returns:
An integer representing the status of this layout. When laying out FOText, this marks the index to the last character that was successfully laid out plus one, that is, it marks the next character to be laid out. For FObj subclasses, this indicates the index to the last child that was successfully laid out plus one, that is, it marks the next child that should be laid out.
Throws:
org.axsl.area.AreaTreeException - For errors during layout.

standardLayout

protected Status standardLayout(org.axsl.area.AreaNode areaNode,
                                org.axsl.fo.fo.GraftingPoint graftingPoint)
                         throws org.axsl.area.AreaTreeException
A standard layout that can be used by subclasses that have no real layout work themselves, but need to make sure their children are laid out.

Parameters:
areaNode - The area into which layout should occur.
graftingPoint - The ancestor retrieve-marker, if any.
Returns:
The status of the layout.
Throws:
org.axsl.area.AreaTreeException - For errors during layout.

getLogger

public org.apache.commons.logging.Log getLogger()
Returns the logger.

Returns:
The logger.

addTextItemToLine

protected int addTextItemToLine(org.axsl.area.LineArea lineArea,
                                org.axsl.fo.FoLineText lineText,
                                int start,
                                int end,
                                org.axsl.fo.fo.GraftingPoint graftingPoint)
                         throws org.axsl.area.AreaTreeException
Adds a text item to the line.

Parameters:
lineArea - The line into which the text should be added.
lineText - The text input which should be added to the line.
start - The index into the lineText char[] indicating the first char to be included.
end - The index into the lineText char[] indicating the last char to be included.
graftingPoint - The grafting point, if any, to which this object is directly grafted.
Returns:
The index into the text (char []) to the first character that was not successfully added to the line.
Throws:
org.axsl.area.AreaTreeException - For errors during layout.

addNonTextItemToLine

protected int addNonTextItemToLine(org.axsl.area.LineArea lineArea,
                                   org.axsl.fo.FoLineNonText nonText,
                                   org.axsl.fo.FoContext foContext)
                            throws org.axsl.area.AreaTreeException
Adds a non-text item to the line.

Parameters:
lineArea - The line into which the text should be added.
nonText - The non-text input which should be added to the line.
foContext - An object that knows how to resolve FO Tree context issues.
Returns:
For non-text items, returns 1 for success or 0 if the item did not fit onto the current line.
Throws:
org.axsl.area.AreaTreeException - For errors during layout.

addNonTextContent

protected Status addNonTextContent(org.axsl.area.LineArea inputLineArea,
                                   org.axsl.fo.fo.GraftingPoint graftingPoint)
                            throws org.axsl.area.AreaTreeException
Add this object's non-text line content to a line.

Parameters:
inputLineArea - The line to which the content should be added.
graftingPoint - The grafting point, if any, to which this object is directly grafted.
Returns:
The status of the layout attempt.
Throws:
org.axsl.area.AreaTreeException - For errors during layout.

activeLineArea

protected org.axsl.area.LineArea activeLineArea(org.axsl.area.AreaNode areaNode)
                                         throws org.axsl.area.AreaTreeException
Finds the LineArea into which items nominally to be laid out in area should actually be laid out.

Parameters:
areaNode - The area node whose LineArea is being sought.
Returns:
The current LineArea of the block that area is in.
Throws:
org.axsl.area.AreaTreeException - If area is not a NormalBlockArea and is not contained within a NormalBlockArea.

getFONode

public abstract org.axsl.fo.Fo getFONode()
Returns the FO Tree node that is being laid out by this layout item.

Returns:
The FO Tree node that is being laid out.

getLayout

public PioneerLS getLayout()
Returns the layout strategy.

Returns:
Returns the layout.


Copyright © 2017. All rights reserved.