com.jrefinery.report.targets.table
Class TableGridPosition

java.lang.Object
  extended bycom.jrefinery.report.targets.table.TableGridPosition

public final class TableGridPosition
extends java.lang.Object

The TableGridPosition is used to bind the layouted table position to an TableCellData object.

Author:
Thomas Morgner

Constructor Summary
TableGridPosition(TableCellData element, int col, int row, int colSpan, int rowSpan)
          Creates a new TableGridPosition with the given element as bulk load.
 
Method Summary
 boolean contains(TableGridPosition pos)
          Tests, whether a given table grid position is fully contained in the position.
 java.awt.geom.Rectangle2D getBounds()
          Returns the bounds of the contained element.
 int getCol()
          Returns the column of this cell.
 int getColSpan()
          Returns the colspan for the cell.
 TableCellData getElement()
          Returns the TableCellData element stored in this grid position.
 int getRow()
          Returns the row of this cell.
 int getRowSpan()
          Returns the rowspan for the cell.
 boolean isInvalidCell()
          Tests, wether the layoutmanager declared this cell as invalid.
 boolean isOrigin(int x, int y)
          Tests, whether the given coordinates are the origin of this table grid position.
 void setInvalidCell(boolean invalidCell)
          Defines the invalid cell state.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TableGridPosition

public TableGridPosition(TableCellData element,
                         int col,
                         int row,
                         int colSpan,
                         int rowSpan)
Creates a new TableGridPosition with the given element as bulk load.

Parameters:
element - the encapsulated element.
col - the x position within the layouted grid
row - the y position within the layouted grid
colSpan - the width in columns within the layouted grid
rowSpan - the height in rows within the layouted grid
Method Detail

getElement

public TableCellData getElement()
Returns the TableCellData element stored in this grid position.

Returns:
the element contained in the grid position.

getColSpan

public int getColSpan()
Returns the colspan for the cell.

Returns:
the cell colspan.

getRowSpan

public int getRowSpan()
Returns the rowspan for the cell.

Returns:
the cell rowspan.

getCol

public int getCol()
Returns the column of this cell.

Returns:
the column of the cell within the grid.

getRow

public int getRow()
Returns the row of this cell.

Returns:
the row of the cell within the grid.

getBounds

public java.awt.geom.Rectangle2D getBounds()
Returns the bounds of the contained element.

Returns:
the bounds of the contained element.

contains

public boolean contains(TableGridPosition pos)
Tests, whether a given table grid position is fully contained in the position.

Parameters:
pos - the compared position
Returns:
true, if the position is contained in this cells area, false otherwise.

isOrigin

public boolean isOrigin(int x,
                        int y)
Tests, whether the given coordinates are the origin of this table grid position.

Parameters:
x - the compared column
y - the compated row
Returns:
true, if row and column are the same as this grid positions row and column.

toString

public java.lang.String toString()
Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object.

Returns:
a string representation of the object.

isInvalidCell

public boolean isInvalidCell()
Tests, wether the layoutmanager declared this cell as invalid. Invalid cells tried to use grid cells which were already occupied.

Returns:
true, if the cell is invalid and is contained in the grid for informational reasons.

setInvalidCell

public void setInvalidCell(boolean invalidCell)
Defines the invalid cell state.

Parameters:
invalidCell - true, if this cell should be invalid, false otherwise.