com.jrefinery.report.targets.table
Class TableGrid

java.lang.Object
  |
  +--com.jrefinery.report.targets.table.TableGrid

public class TableGrid
extends java.lang.Object

The TableGrid is used to collect all table cells and to finally create the TableGridLayout.

The TableGrid stores TableCellData elements and collects their boundaries. The CellData-bounds are used to define the positions of the cells of the generated table.

The TableGrid has two modes of operation. In the strict layoutmode, all bounds of the cells are used to define the generated cells. The strict layout mode tries to layout the cells in a way, that the generated results nearly equals the printed layout.

If strict mode is disabled, only the origin of the TableCellData is used to define the generated cells. This reduces the table complexity, the table appears cleaner, unnecessary cell boundaries are removed. The layout of the table contents can be slightly different to the printed results.

If you plan to print the generated file, then the strict layout is for you. If you need to change the tables (edit contents f.i.), then the non-strict layout is more useful for you.

Author:
Thomas Morgner
See Also:
TableGridLayout

Constructor Summary
TableGrid(boolean strict)
          Creates a new TableGrid.
 
Method Summary
 void addData(TableCellData pos)
          Adds a TableCellData to the grid.
 void clear()
          Removes all elements from the grid and removes all previously found bounds.
 int[] getXCuts()
          Returns the horizontal boundaries of the table cells.
 int[] getYCuts()
          Returns the vertical boundaries of the table cells.
 boolean isStrict()
          Gets the strict mode flag.
 TableGridLayout performLayout()
          Create a TableGridLayout based on the contents of this table grid.
 int size()
          Returns the number of table cell data elements in this grid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableGrid

public TableGrid(boolean strict)
Creates a new TableGrid. If strict mode is enabled, all cell bounds are used to create the table grid, resulting in a more complex layout.

Parameters:
strict - the strict mode for the layout.
Method Detail

addData

public void addData(TableCellData pos)
Adds a TableCellData to the grid.

Parameters:
pos - the position that should be added to the grid.
Throws:
java.lang.NullPointerException - if the given position is null

isStrict

public boolean isStrict()
Gets the strict mode flag.

Returns:
true, if strict mode is enabled, false otherwise.

performLayout

public TableGridLayout performLayout()
Create a TableGridLayout based on the contents of this table grid.

Returns:
the new TableGridLayout.

clear

public void clear()
Removes all elements from the grid and removes all previously found bounds.


size

public int size()
Returns the number of table cell data elements in this grid.

Returns:
the number of element in the grid.

getXCuts

public int[] getXCuts()
Returns the horizontal boundaries of the table cells. The array contains the start positions of the cells.

Returns:
the horizontal start position of the table cells.

getYCuts

public int[] getYCuts()
Returns the vertical boundaries of the table cells. The array contains the start positions of the cells.

Returns:
the vertical start position of the table cells.