org.apache.fop.fo.flow.table

Class GridUnit

Known Direct Subclasses:
EmptyGridUnit, PrimaryGridUnit

public class GridUnit
extends java.lang.Object

This class represents one grid unit inside a table.

Field Summary

static int
FIRST_IN_PART
Indicates that the grid unit is in the first row of the table part (header, footer, body).
static 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).
protected TableCell
cell
Table cell which occupies this grid unit
protected CollapsingBorderModel
collapsingBorderModel

Constructor Summary

GridUnit(Table table, int colSpanIndex, int rowSpanIndex)
Creates a new grid unit.
GridUnit(TableCell cell, int colSpanIndex, int rowSpanIndex)
Creates a new grid unit.

Method Summary

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()
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()
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?
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.
String
toString()

Field Details

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).
Field Value:
0

KEEP_WITH_NEXT_PENDING

public static final int KEEP_WITH_NEXT_PENDING
Indicates that the primary grid unit has a pending keep-with-next.
Field Value:
2

KEEP_WITH_PREVIOUS_PENDING

public static final int KEEP_WITH_PREVIOUS_PENDING
Indicates that the primary grid unit has a pending keep-with-previous.
Field Value:
3

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).
Field Value:
1

cell

protected TableCell cell
Table cell which occupies this grid unit

collapsingBorderModel

protected CollapsingBorderModel collapsingBorderModel

Constructor Details

GridUnit

protected GridUnit(Table table,
                   int colSpanIndex,
                   int rowSpanIndex)
Creates a new grid unit.
Parameters:
table - the containing table
colSpanIndex - index of this grid unit in the span, in column direction
rowSpanIndex - 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 unit
colSpanIndex - index of this grid unit in the span, in column direction
rowSpanIndex - index of this grid unit in the span, in row direction

Method Details

getBorderAfter

public CommonBorderPaddingBackground.BorderInfo getBorderAfter(int which)
Returns the resolved border-after of this grid unit, in the collapsing-border model.
Returns:
the corresponding border

getBorderBefore

public CommonBorderPaddingBackground.BorderInfo getBorderBefore(int which)
Returns the resolved border-before 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

getBorderStart

public CommonBorderPaddingBackground.BorderInfo getBorderStart()
Returns the resolved border-start of this grid unit, in the collapsing-border model.
Returns:
the corresponding border

getCell

public TableCell getCell()

getColSpanIndex

public int getColSpanIndex()
Returns:
the index of the grid unit inside a cell in column direction

getFlag

public boolean getFlag(int which)
Returns a flag for this GridUnit.
Parameters:
which - the requested flag
Returns:
the value of the flag

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.

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

getRowSpanIndex

public int getRowSpanIndex()
Returns:
the index of the grid unit inside a cell in row direction

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

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

setBordersFromCell

protected void setBordersFromCell()
Prepares the borders of this grid unit for upcoming resolution, in the collapsing model.

setFlag

public void setFlag(int which)
Sets the given flag on this grid unit.
Parameters:
which - the flag to set

setFlag

public void setFlag(int which,
                    boolean value)
Sets a flag on a GridUnit.
Parameters:
which - the flag to set
value - the new value for the flag

toString

public String toString()

Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.