Package org.apache.fop.fo.flow.table
Class PrimaryGridUnit
- java.lang.Object
-
- org.apache.fop.fo.flow.table.GridUnit
-
- org.apache.fop.fo.flow.table.PrimaryGridUnit
-
public class PrimaryGridUnit extends GridUnit
This class represents a primary grid unit of a spanned cell. This is the "before-start" (top-left, usually) grid unit of the span.
-
-
Field Summary
Fields Modifier and Type Field Description private int
breakAfter
private int
breakBefore
private TableCellLayoutManager
cellLM
Cell layout manager.private int
colIndex
Index of the column where this cell starts.private int
contentLength
The calculated size of the cell's content.private java.util.List
elements
List of Knuth elements representing the contents of the cell.private int
halfBorderSeparationBPD
private boolean
isSeparateBorderModel
private Keep
keepWithNext
private Keep
keepWithPrevious
private int
rowIndex
Index of the row where this cell starts.private java.util.List<GridUnit[]>
rows
Links to the spanned grid units.-
Fields inherited from class org.apache.fop.fo.flow.table.GridUnit
borderAfter, borderBefore, borderEnd, borderStart, cell, collapsingBorderModel, FIRST_IN_PART, KEEP_WITH_NEXT_PENDING, KEEP_WITH_PREVIOUS_PENDING, LAST_IN_PART
-
-
Constructor Summary
Constructors Constructor Description PrimaryGridUnit(TableCell cell, int colIndex)
Creates a new primary grid unit.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRow(GridUnit[] row)
Add a row.void
createCellLM()
Creates a cellLM for the corresponding table-cell.int
getAfterBorderWidth(int which)
Returns the width of the before-after for the last row-span of this cell.int
getAfterBorderWidth(int rowIndex, int which)
Returns the width of the before-after for the given row-span of this cell.int
getBeforeAfterBorderWidth()
Returns the widths of the border-before and -after for this cell.int
getBeforeBorderWidth(int rowIndex, int which)
Returns the width of the before-border for the given row-span of this cell.int
getBreakAfter()
Returns the class of the before after for the last child element of this cell.int
getBreakBefore()
Returns the class of the before break for the first child element of this cell.TableCellLayoutManager
getCellLM()
Get cell's layout manager.int
getColIndex()
Returns the index of the column this grid unit belongs to.int
getContentLength()
java.util.List
getElements()
Obtain the Knuth elements.Keep
getKeepWithNext()
Returns the strength of the keep constraint if the last child block (or its descendants) of this cell has keep-with-next.Keep
getKeepWithPrevious()
Returns the strength of the keep constraint if the first child block (or its descendants) of this cell has keep-with-previous.PrimaryGridUnit
getPrimary()
Returns the before-start grid unit of the cell containing this grid unit.int
getRowIndex()
Returns the index of the row this grid unit belongs to.java.util.List<GridUnit[]>
getRows()
Returns the grid units belonging to the same span as this one.int[]
getStartEndBorderWidths()
Returns the widths of the start- and end-borders of the span this grid unit belongs to.TablePart
getTablePart()
Returns the fo:table-header/footer/body element containing this cell.boolean
hasSpanning()
boolean
isPrimary()
Is this grid unit the before-start grid unit of the cell?void
setBreakAfter(int breakAfter)
Don't use, reserved for TableCellLM.void
setBreakBefore(int breakBefore)
Don't use, reserved for TableCellLM.void
setElements(java.util.List elements)
Sets the Knuth elements for the table cell containing this grid unit.void
setKeepWithNext(Keep keep)
Don't use, reserved for TableCellLM.void
setKeepWithPrevious(Keep keep)
Don't use, reserved for TableCellLM.(package private) void
setRowIndex(int rowIndex)
java.lang.String
toString()
-
Methods inherited from class org.apache.fop.fo.flow.table.GridUnit
getBorderAfter, getBorderBefore, getBorderEnd, getBorderStart, getCell, getColSpanIndex, getFlag, getRow, getRowSpanIndex, integrateBorderSegment, integrateBorderSegment, integrateBorderSegment, integrateCompetingBorder, isEmpty, isLastGridUnitColSpan, isLastGridUnitRowSpan, resolveBorder, setBordersFromCell, setFlag, setFlag, setRow
-
-
-
-
Field Detail
-
cellLM
private TableCellLayoutManager cellLM
Cell layout manager.
-
elements
private java.util.List elements
List of Knuth elements representing the contents of the cell.
-
rowIndex
private int rowIndex
Index of the row where this cell starts.
-
colIndex
private int colIndex
Index of the column where this cell starts.
-
rows
private java.util.List<GridUnit[]> rows
Links to the spanned grid units. (List of GridUnit arrays, one array represents a row)
-
contentLength
private int contentLength
The calculated size of the cell's content. (cached value)
-
isSeparateBorderModel
private boolean isSeparateBorderModel
-
halfBorderSeparationBPD
private int halfBorderSeparationBPD
-
keepWithPrevious
private Keep keepWithPrevious
-
keepWithNext
private Keep keepWithNext
-
breakBefore
private int breakBefore
-
breakAfter
private int breakAfter
-
-
Constructor Detail
-
PrimaryGridUnit
PrimaryGridUnit(TableCell cell, int colIndex)
Creates a new primary grid unit.- Parameters:
cell
- table cell which occupies this grid unitcolIndex
- index of the column this grid unit belongs to, zero-based
-
-
Method Detail
-
getTablePart
public TablePart getTablePart()
Returns the fo:table-header/footer/body element containing this cell.- Returns:
- the enclosing table part
-
getCellLM
public TableCellLayoutManager getCellLM()
Get cell's layout manager.- Returns:
- the cell's layout manager
-
getPrimary
public PrimaryGridUnit getPrimary()
Returns the before-start grid unit of the cell containing this grid unit.- Overrides:
getPrimary
in classGridUnit
- Returns:
- the before-start grid unit of the cell containing this grid unit.
-
isPrimary
public boolean isPrimary()
Is this grid unit the before-start grid unit of the cell?
-
setElements
public void setElements(java.util.List elements)
Sets the Knuth elements for the table cell containing this grid unit.- Parameters:
elements
- a list of ListElement (?)
-
getElements
public java.util.List getElements()
Obtain the Knuth elements.- Returns:
- a list of Knuth elements
-
getBeforeAfterBorderWidth
public int getBeforeAfterBorderWidth()
Returns the widths of the border-before and -after for this cell. In the separate border model the border-separation is included. In the collapsing model only half of them is counted, since the other halves belong to the neighbouring cells; also, the returned value is the maximum of the segments of each applicable grid unit.- Returns:
- the sum of the before and after border widths
-
getBeforeBorderWidth
public int getBeforeBorderWidth(int rowIndex, int which)
Returns the width of the before-border for the given row-span of this cell. In the separate border model half of the border-separation is included. In the collapsing model only half of the border is counted, since the other half belongs to the preceding cell; also, the returned value is the maximum of the segments of each applicable grid unit.- Parameters:
rowIndex
- index of the span for which the border must be computed, 0-basedwhich
- one ofConditionalBorder.NORMAL
,ConditionalBorder.LEADING_TRAILING
orConditionalBorder.REST
- Returns:
- the before border width
-
getAfterBorderWidth
public int getAfterBorderWidth(int rowIndex, int which)
Returns the width of the before-after for the given row-span of this cell. In the separate border model half of the border-separation is included. In the collapsing model only half of the border is counted, since the other half belongs to the following cell; also, the returned value is the maximum of the segments of each applicable grid unit.- Parameters:
rowIndex
- index of the span for which the border must be computed, 0-basedwhich
- one ofConditionalBorder.NORMAL
,ConditionalBorder.LEADING_TRAILING
orConditionalBorder.REST
- Returns:
- the after border width
-
getAfterBorderWidth
public int getAfterBorderWidth(int which)
Returns the width of the before-after for the last row-span of this cell. SeegetAfterBorderWidth(int, int)
.- Parameters:
which
- one ofConditionalBorder.NORMAL
,ConditionalBorder.LEADING_TRAILING
orConditionalBorder.REST
- Returns:
- the after border width
-
getContentLength
public int getContentLength()
- Returns:
- the length of the cell content
-
getRows
public java.util.List<GridUnit[]> getRows()
Returns the grid units belonging to the same span as this one.- Returns:
- a list of GridUnit[], each array corresponds to a row
-
addRow
public void addRow(GridUnit[] row)
Add a row.- Parameters:
row
- the row to be added
-
setRowIndex
void setRowIndex(int rowIndex)
-
getRowIndex
public int getRowIndex()
Returns the index of the row this grid unit belongs to. This is the index, in the enclosing table part, of the first row spanned by the cell. Note that if the table has several table-body children, then the index grows continuously across them; they are considered to form one single part, the "body of the table".- Returns:
- the index of the row this grid unit belongs to, 0-based.
-
getColIndex
public int getColIndex()
Returns the index of the column this grid unit belongs to.- Returns:
- the column index, 0-based
-
getStartEndBorderWidths
public int[] getStartEndBorderWidths()
Returns the widths of the start- and end-borders of the span this grid unit belongs to.- Returns:
- a two-element array containing the widths of the start-border then the end-border
-
hasSpanning
public boolean hasSpanning()
- Returns:
- true if this cell spans over more than one grid unit.
-
createCellLM
public void createCellLM()
Creates a cellLM for the corresponding table-cell. A new one must be created for each new static-content (TODO).
-
getKeepWithPrevious
public Keep getKeepWithPrevious()
Returns the strength of the keep constraint if the first child block (or its descendants) of this cell has keep-with-previous.- Returns:
- the keep-with-previous strength
-
setKeepWithPrevious
public void setKeepWithPrevious(Keep keep)
Don't use, reserved for TableCellLM. TODO- Parameters:
keep
- the keep strength
-
getKeepWithNext
public Keep getKeepWithNext()
Returns the strength of the keep constraint if the last child block (or its descendants) of this cell has keep-with-next.- Returns:
- the keep-with-next strength
-
setKeepWithNext
public void setKeepWithNext(Keep keep)
Don't use, reserved for TableCellLM. TODO- Parameters:
keep
- the keep strength
-
getBreakBefore
public int getBreakBefore()
Returns the class of the before break for the first child element of this cell.- Returns:
- one of
Constants.EN_AUTO
,Constants.EN_COLUMN
,Constants.EN_PAGE
,Constants.EN_EVEN_PAGE
,Constants.EN_ODD_PAGE
-
setBreakBefore
public void setBreakBefore(int breakBefore)
Don't use, reserved for TableCellLM. TODO- Parameters:
breakBefore
- the breakBefore to set
-
getBreakAfter
public int getBreakAfter()
Returns the class of the before after for the last child element of this cell.- Returns:
- one of
Constants.EN_AUTO
,Constants.EN_COLUMN
,Constants.EN_PAGE
,Constants.EN_EVEN_PAGE
,Constants.EN_ODD_PAGE
-
setBreakAfter
public void setBreakAfter(int breakAfter)
Don't use, reserved for TableCellLM. TODO- Parameters:
breakAfter
- the breakAfter to set
-
-