fop 0.92beta

org.apache.fop.layoutmgr.table
Class GridUnit

java.lang.Object
  |
  +--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_BODY
          Indicates that the grid unit is in the first row (context: body).
static int FIRST_IN_TABLE
          Indicates that the grid unit is in the first row (context: 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_BODY
          Indicates that the grid unit is in the last row (context: body).
static int LAST_IN_TABLE
          Indicates that the grid unit is in the last row (context: table).
 
Constructor Summary
protected GridUnit(PrimaryGridUnit primary, TableCell cell, TableColumn column, int startCol, int colSpanIndex)
           
  GridUnit(PrimaryGridUnit primary, TableColumn column, int startCol, int colSpanIndex)
           
  GridUnit(TableCell cell, TableColumn column, int startCol, int colSpanIndex)
           
 
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()
           
 TableRow getRow()
           
 int getRowSpanIndex()
           
 int getStartCol()
           
 Table getTable()
           
 boolean hasBorders()
           
 boolean isEmpty()
           
 boolean isLastGridUnitColSpan()
           
 boolean isLastGridUnitRowSpan()
           
 boolean isPrimary()
           
 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.

IN_LAST_COLUMN

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

FIRST_IN_TABLE

public static final int FIRST_IN_TABLE
Indicates that the grid unit is in the first row (context: table).

FIRST_IN_BODY

public static final int FIRST_IN_BODY
Indicates that the grid unit is in the first row (context: body).

LAST_IN_BODY

public static final int LAST_IN_BODY
Indicates that the grid unit is in the last row (context: body).

LAST_IN_TABLE

public static final int LAST_IN_TABLE
Indicates that the grid unit is in the last row (context: table).

KEEP_WITH_NEXT_PENDING

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

KEEP_WITH_PREVIOUS_PENDING

public static final int KEEP_WITH_PREVIOUS_PENDING
Indicates that the primary grid unit has a pending keep-with-previous.
Constructor Detail

GridUnit

public GridUnit(TableCell cell,
                TableColumn column,
                int startCol,
                int colSpanIndex)

GridUnit

public GridUnit(PrimaryGridUnit primary,
                TableColumn column,
                int startCol,
                int colSpanIndex)

GridUnit

protected GridUnit(PrimaryGridUnit primary,
                   TableCell cell,
                   TableColumn column,
                   int startCol,
                   int colSpanIndex)
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 primary grid unit if this is a spanned grid unit

isPrimary

public boolean isPrimary()

isEmpty

public boolean isEmpty()

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 column 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.92beta

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