fop 0.94

org.apache.fop.layoutmgr.table
Class GridUnit

java.lang.Object
  extended by org.apache.fop.layoutmgr.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
static int FIRST_IN_PART
          Indicates that the grid unit is in the first row of the table part (header, footer, body).
static int FIRST_IN_TABLE
          Indicates that the grid unit is in the first row of the table.
static int IN_FIRST_COLUMN
          Indicates that the grid unit is in the first column.
static int IN_LAST_COLUMN
          Indicates that the grid unit is in the last column.
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).
static int LAST_IN_TABLE
          Indicates that the grid unit is in the last row of the table.
 
Constructor Summary
protected GridUnit(PrimaryGridUnit primary, TableCell cell, TableColumn column, int startCol, int colSpanIndex)
          Creates a new grid unit.
  GridUnit(PrimaryGridUnit primary, TableColumn column, int startCol, int colSpanIndex)
          Creates a new grid unit.
  GridUnit(TableCell cell, TableColumn column, int startCol, int colSpanIndex)
          Creates a new grid unit.
 
Method Summary
 void assignBorderForSeparateBorderModel()
          Assigns the borders from the given cell to this cell info.
 GridUnit createNextRowSpanningGridUnit()
           
 TableBody getBody()
           
 CommonBorderPaddingBackground getBorders()
           
 TableCell getCell()
           
 int getColSpanIndex()
           
 TableColumn getColumn()
           
 boolean getFlag(int which)
          Returns a flag for this GridUnit.
 CommonBorderPaddingBackground.BorderInfo getOriginalBorderInfoForCell(int side)
          Returns a BorderInfo instance for a side of the currently applicable cell before border resolution (i.e. the value from the FO).
 PrimaryGridUnit getPrimary()
          Returns the before-start grid unit of the cell containing this grid unit.
 TableRow getRow()
           
 int getRowSpanIndex()
           
 int getStartCol()
           
 Table getTable()
           
 boolean hasBorders()
           
 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?
 void resolveBorder(GridUnit other, int side)
          Resolve collapsing borders for the given cell.
 void resolveBorder(GridUnit other, int side, int resFlags)
          Resolve collapsing borders for the given cell.
 void setFlag(int which, boolean value)
          Sets a flag on a GridUnit.
 void setRow(TableRow row)
          Sets the table-row FO, if applicable.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

IN_FIRST_COLUMN

public static final int IN_FIRST_COLUMN
Indicates that the grid unit is in the first column.

See Also:
Constant Field Values

IN_LAST_COLUMN

public static final int IN_LAST_COLUMN
Indicates that the grid unit is in the last column.

See Also:
Constant Field Values

FIRST_IN_TABLE

public static final int FIRST_IN_TABLE
Indicates that the grid unit is in the first row of the table.

See Also:
Constant Field Values

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

LAST_IN_TABLE

public static final int LAST_IN_TABLE
Indicates that the grid unit is in the last row of the table.

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
Constructor Detail

GridUnit

public GridUnit(TableCell cell,
                TableColumn column,
                int startCol,
                int colSpanIndex)
Creates a new grid unit.

Parameters:
cell - table cell which occupies this grid unit
column - table column this grid unit belongs to
startCol - index of the column this grid unit belongs to
colSpanIndex - index of this grid unit in the span, in column direction

GridUnit

public GridUnit(PrimaryGridUnit primary,
                TableColumn column,
                int startCol,
                int colSpanIndex)
Creates a new grid unit.

Parameters:
primary - the before-start grid unit of the cell containing this grid unit
column - table column this grid unit belongs to
startCol - index of the column this grid unit belongs to
colSpanIndex - index of this grid unit in the span, in column direction

GridUnit

protected GridUnit(PrimaryGridUnit primary,
                   TableCell cell,
                   TableColumn column,
                   int startCol,
                   int colSpanIndex)
Creates a new grid unit.

Parameters:
primary - the before-start grid unit of the cell containing this grid unit
cell - table cell which occupies this grid unit
column - table column this grid unit belongs to
startCol - index of the column this grid unit belongs to
colSpanIndex - index of this grid unit in the span, in column direction
Method Detail

getCell

public TableCell getCell()

getColumn

public TableColumn getColumn()

getRow

public TableRow getRow()

setRow

public void setRow(TableRow row)
Sets the table-row FO, if applicable.

Parameters:
row - the table-row FO

getBody

public TableBody getBody()

getTable

public Table getTable()

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

getStartCol

public int getStartCol()

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

getOriginalBorderInfoForCell

public CommonBorderPaddingBackground.BorderInfo getOriginalBorderInfoForCell(int side)
Returns a BorderInfo instance for a side of the currently applicable cell before border resolution (i.e. the value from the FO). A return value of null indicates an empty cell. See CollapsingBorderModel(EyeCatching) where this method is used.

Parameters:
side - for which side to return the BorderInfo
Returns:
the requested BorderInfo instance or null if the grid unit is an empty cell

getBorders

public CommonBorderPaddingBackground getBorders()
Returns:
the resolved normal borders for this grid unit

hasBorders

public boolean hasBorders()
Returns:
true if the grid unit has any borders.

assignBorderForSeparateBorderModel

public void assignBorderForSeparateBorderModel()
Assigns the borders from the given cell to this cell info. Used in case of separate border model.


resolveBorder

public 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 unit if any
side - the side to resolve (one of CommonBorderPaddingBackground.BEFORE|AFTER|START|END)

resolveBorder

public void resolveBorder(GridUnit other,
                          int side,
                          int resFlags)
Resolve collapsing borders for the given cell. Used in case of the collapsing border model.

Parameters:
other - neighbouring grid unit if any
side - the side to resolve (one of CommonBorderPaddingBackground.BEFORE|AFTER|START|END)
resFlags - flags for the border resolution

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 set
value - the new value for the flag

createNextRowSpanningGridUnit

public GridUnit createNextRowSpanningGridUnit()
Returns:
the grid unit just below this grid unit if the cell is spanning.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

fop 0.94

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