Package org.apache.fop.fo.flow.table
Class GridUnit
- java.lang.Object
-
- org.apache.fop.fo.flow.table.GridUnit
-
- Direct Known Subclasses:
EmptyGridUnit
,PrimaryGridUnit
public class GridUnit extends java.lang.Object
This class represents one grid unit inside a table.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) ConditionalBorder
borderAfter
the border-after specification(package private) ConditionalBorder
borderBefore
the border-before specification(package private) BorderSpecification
borderEnd
the border-end specification(package private) BorderSpecification
borderStart
the border-start specificationprotected TableCell
cell
Table cell which occupies this grid unitprotected CollapsingBorderModel
collapsingBorderModel
The border model helper associated with the tableprivate int
colSpanIndex
index of grid unit within cell in column directionstatic int
FIRST_IN_PART
Indicates that the grid unit is in the first row of the table part (header, footer, body).private byte
flags
flags for the grid unitstatic int
KEEP_WITH_NEXT_PENDING
Indicates that the primary grid unit has a pending keep-with-next.static int
KEEP_WITH_PREVIOUS_PENDING
Indicates that the primary grid unit has a pending keep-with-previous.static int
LAST_IN_PART
Indicates that the grid unit is in the last row of the table part (header, footer, body).private PrimaryGridUnit
primary
Primary grid unitprivate TableRow
row
Table row occupied by this grid unit (may be null).private int
rowSpanIndex
index of grid unit within cell in row direction
-
Constructor Summary
Constructors Modifier Constructor Description private
GridUnit(int colSpanIndex, int rowSpanIndex)
(package private)
GridUnit(PrimaryGridUnit primary, int colSpanIndex, int rowSpanIndex)
Creates a new grid unit.protected
GridUnit(TableCell cell, int colSpanIndex, int rowSpanIndex)
Creates a new grid unit.protected
GridUnit(Table table, int colSpanIndex, int rowSpanIndex)
Creates a new grid unit.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CommonBorderPaddingBackground.BorderInfo
getBorderAfter(int which)
Returns the resolved border-after of this grid unit, in the collapsing-border model.CommonBorderPaddingBackground.BorderInfo
getBorderBefore(int which)
Returns the resolved border-before of this grid unit, in the collapsing-border model.CommonBorderPaddingBackground.BorderInfo
getBorderEnd()
Returns the resolved border-end of this grid unit, in the collapsing-border model.CommonBorderPaddingBackground.BorderInfo
getBorderStart()
Returns the resolved border-start of this grid unit, in the collapsing-border model.TableCell
getCell()
Returns the table cell associated with this grid unit.int
getColSpanIndex()
boolean
getFlag(int which)
Returns a flag for this GridUnit.PrimaryGridUnit
getPrimary()
Returns the before-start grid unit of the cell containing this grid unit.TableRow
getRow()
Returns the fo:table-row element (if any) this grid unit belongs to.int
getRowSpanIndex()
(package private) void
integrateBorderSegment(int side, BorderSpecification segment)
For the given side, integrates in the conflict resolution the given border segment.(package private) void
integrateBorderSegment(int side, TableFObj parent)
For the given side, integrates in the conflict resolution the border segment of the given parent element.(package private) void
integrateBorderSegment(int side, TableFObj parent, boolean withNormal, boolean withLeadingTrailing, boolean withRest)
For the given side, integrates in the conflict resolution the border segment of the given parent element.(package private) void
integrateCompetingBorder(int side, ConditionalBorder competitor, boolean withNormal, boolean withLeadingTrailing, boolean withRest)
boolean
isEmpty()
Does this grid unit belong to an empty cell?boolean
isLastGridUnitColSpan()
boolean
isLastGridUnitRowSpan()
boolean
isPrimary()
Is this grid unit the before-start grid unit of the cell?(package private) void
resolveBorder(GridUnit other, int side)
Resolve collapsing borders for the given cell.private void
setBorders(Table table)
protected void
setBordersFromCell()
Prepares the borders of this grid unit for upcoming resolution, in the collapsing model.void
setFlag(int which)
Sets the given flag on this grid unit.void
setFlag(int which, boolean value)
Sets a flag on a GridUnit.(package private) void
setRow(TableRow row)
java.lang.String
toString()
-
-
-
Field Detail
-
FIRST_IN_PART
public static final int FIRST_IN_PART
Indicates that the grid unit is in the first row of the table part (header, footer, body).- See Also:
- Constant Field Values
-
LAST_IN_PART
public static final int LAST_IN_PART
Indicates that the grid unit is in the last row of the table part (header, footer, body).- See Also:
- Constant Field Values
-
KEEP_WITH_NEXT_PENDING
public static final int KEEP_WITH_NEXT_PENDING
Indicates that the primary grid unit has a pending keep-with-next.- See Also:
- Constant Field Values
-
KEEP_WITH_PREVIOUS_PENDING
public static final int KEEP_WITH_PREVIOUS_PENDING
Indicates that the primary grid unit has a pending keep-with-previous.- See Also:
- Constant Field Values
-
primary
private PrimaryGridUnit primary
Primary grid unit
-
cell
protected TableCell cell
Table cell which occupies this grid unit
-
row
private TableRow row
Table row occupied by this grid unit (may be null).
-
colSpanIndex
private int colSpanIndex
index of grid unit within cell in column direction
-
rowSpanIndex
private int rowSpanIndex
index of grid unit within cell in row direction
-
flags
private byte flags
flags for the grid unit
-
borderBefore
ConditionalBorder borderBefore
the border-before specification
-
borderAfter
ConditionalBorder borderAfter
the border-after specification
-
borderStart
BorderSpecification borderStart
the border-start specification
-
borderEnd
BorderSpecification borderEnd
the border-end specification
-
collapsingBorderModel
protected CollapsingBorderModel collapsingBorderModel
The border model helper associated with the table
-
-
Constructor Detail
-
GridUnit
protected GridUnit(Table table, int colSpanIndex, int rowSpanIndex)
Creates a new grid unit.- Parameters:
table
- the containing tablecolSpanIndex
- index of this grid unit in the span, in column directionrowSpanIndex
- index of this grid unit in the span, in row direction
-
GridUnit
protected GridUnit(TableCell cell, int colSpanIndex, int rowSpanIndex)
Creates a new grid unit.- Parameters:
cell
- table cell which occupies this grid unitcolSpanIndex
- index of this grid unit in the span, in column directionrowSpanIndex
- index of this grid unit in the span, in row direction
-
GridUnit
GridUnit(PrimaryGridUnit primary, int colSpanIndex, int rowSpanIndex)
Creates a new grid unit.- Parameters:
primary
- the before-start grid unit of the cell containing this grid unitcolSpanIndex
- index of this grid unit in the span, in column directionrowSpanIndex
- index of this grid unit in the span, in row direction
-
GridUnit
private GridUnit(int colSpanIndex, int rowSpanIndex)
-
-
Method Detail
-
setBorders
private void setBorders(Table table)
-
setBordersFromCell
protected void setBordersFromCell()
Prepares the borders of this grid unit for upcoming resolution, in the collapsing model.
-
getCell
public TableCell getCell()
Returns the table cell associated with this grid unit.- Returns:
- the table cell
-
getRow
public TableRow getRow()
Returns the fo:table-row element (if any) this grid unit belongs to.- Returns:
- the row containing this grid unit, or null if there is no fo:table-row element in the corresponding table-part
-
setRow
void setRow(TableRow row)
-
getPrimary
public PrimaryGridUnit getPrimary()
Returns the before-start grid unit of the cell containing this grid unit.- 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?- Returns:
- true if this grid unit is the before-start grid unit of the cell
-
isEmpty
public boolean isEmpty()
Does this grid unit belong to an empty cell?- Returns:
- true if this grid unit belongs to an empty cell
-
isLastGridUnitColSpan
public boolean isLastGridUnitColSpan()
- Returns:
- true if the grid unit is the last in column spanning direction
-
isLastGridUnitRowSpan
public boolean isLastGridUnitRowSpan()
- Returns:
- true if the grid unit is the last in row spanning direction
-
getRowSpanIndex
public int getRowSpanIndex()
- Returns:
- the index of the grid unit inside a cell in row direction
-
getColSpanIndex
public int getColSpanIndex()
- Returns:
- the index of the grid unit inside a cell in column direction
-
getBorderBefore
public CommonBorderPaddingBackground.BorderInfo getBorderBefore(int which)
Returns the resolved border-before of this grid unit, in the collapsing-border model.- Parameters:
which
- one ofConditionalBorder.NORMAL
,ConditionalBorder.LEADING_TRAILING
orConditionalBorder.REST
- Returns:
- the corresponding border
-
getBorderAfter
public CommonBorderPaddingBackground.BorderInfo getBorderAfter(int which)
Returns the resolved border-after of this grid unit, in the collapsing-border model.- Parameters:
which
- one ofConditionalBorder.NORMAL
,ConditionalBorder.LEADING_TRAILING
orConditionalBorder.REST
- Returns:
- the corresponding border
-
getBorderStart
public CommonBorderPaddingBackground.BorderInfo getBorderStart()
Returns the resolved border-start of this grid unit, in the collapsing-border model.- Returns:
- the corresponding border
-
getBorderEnd
public CommonBorderPaddingBackground.BorderInfo getBorderEnd()
Returns the resolved border-end of this grid unit, in the collapsing-border model.- Returns:
- the corresponding border
-
resolveBorder
void resolveBorder(GridUnit other, int side)
Resolve collapsing borders for the given cell. Used in case of the collapsing border model.- Parameters:
other
- neighbouring grid unitside
- the side to resolve (one of CommonBorderPaddingBackground.BEFORE|AFTER|START|END)
-
integrateBorderSegment
void integrateBorderSegment(int side, TableFObj parent, boolean withNormal, boolean withLeadingTrailing, boolean withRest)
For the given side, integrates in the conflict resolution the border segment of the given parent element.- Parameters:
side
- the side to consider (either CommonBorderPaddingBackground.BEFORE or AFTER)parent
- a table element whose corresponding border coincides on the given side
-
integrateBorderSegment
void integrateBorderSegment(int side, TableFObj parent)
For the given side, integrates in the conflict resolution the border segment of the given parent element.- Parameters:
side
- the side to consider (one of CommonBorderPaddingBackground.BEFORE|AFTER|START|END)parent
- a table element whose corresponding border coincides on the given side
-
integrateBorderSegment
void integrateBorderSegment(int side, BorderSpecification segment)
For the given side, integrates in the conflict resolution the given border segment.- Parameters:
side
- the side to consider (one of CommonBorderPaddingBackground.START|END)segment
- a border specification to integrate at the given side
-
integrateCompetingBorder
void integrateCompetingBorder(int side, ConditionalBorder competitor, boolean withNormal, boolean withLeadingTrailing, boolean withRest)
-
getFlag
public boolean getFlag(int which)
Returns a flag for this GridUnit.- Parameters:
which
- the requested flag- Returns:
- the value of the flag
-
setFlag
public void setFlag(int which, boolean value)
Sets a flag on a GridUnit.- Parameters:
which
- the flag to setvalue
- the new value for the flag
-
setFlag
public void setFlag(int which)
Sets the given flag on this grid unit.- Parameters:
which
- the flag to set
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-