Class SheetLayout
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.modules.output.table.base.SheetLayout
-
- All Implemented Interfaces:
Cloneable
,SlimSheetLayout
public class SheetLayout extends Object implements SlimSheetLayout, Cloneable
The sheet layout is used to build the background map and to collect the x- and y-cell-borders.
-
-
Constructor Summary
Constructors Constructor Description SheetLayout(boolean strict, boolean ellipseAsRectangle)
Creates a new TableGrid-object.SheetLayout(OutputProcessorMetaData metaData)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(RenderBox element, long offset, long headerSize, long maxHeight)
Adds the bounds of the given TableCellData to the grid.void
addRenderableContent(RenderableReplacedContentBox element, long offset, long headerSize, long maxHeight)
void
clear()
void
clearVerticalInfo()
SheetLayout
clone()
SheetLayout
derive()
void
ensureXMapping(long coordinate, Boolean aux)
void
ensureYMapping(long coordinate, Boolean aux)
long
getCellWidth(int startCell)
long
getCellWidth(int startCell, int endCell)
Computes the height of the given row.int
getColSpan(int x1, long endPosition)
int
getColumnCount()
The current number of columns.long
getMaxHeight()
long
getMaxWidth()
int
getRowCount()
The current number of rows.long
getRowHeight(int row)
Computes the height of the given row.long
getRowHeight(int startRow, int endRow)
int
getRowSpan(int y1, long endPosition)
TableRectangle
getTableBounds(long x, long y, long width, long height, TableRectangle rect)
Returns the position of the given element within the table.TableRectangle
getTableBounds(StrictBounds bounds, TableRectangle rect)
Returns the position of the given element within the table.TableRectangle
getTableBoundsWithCache(long x, long y, long width, long height, TableRectangle rect)
long
getXPosition(int col)
long
getYPosition(int row)
boolean
isEmpty()
boolean
isStrict()
Gets the strict mode flag.void
pageCompleted()
A Callback method to inform the sheet layout, that the current page is complete, and no more content will be added.protected void
removeAuxilaryBounds()
-
-
-
Constructor Detail
-
SheetLayout
public SheetLayout(boolean strict, boolean ellipseAsRectangle)
Creates a new TableGrid-object. 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.ellipseAsRectangle
- a flag that defines whether ellipse-objects are translated into rectangles and therefore create backgrounds.
-
SheetLayout
public SheetLayout(OutputProcessorMetaData metaData)
-
-
Method Detail
-
derive
public SheetLayout derive()
-
clone
public SheetLayout clone()
-
add
public boolean add(RenderBox element, long offset, long headerSize, long maxHeight)
Adds the bounds of the given TableCellData to the grid. The bounds given must be the same as the bounds of the element, or the layouting might produce surprising results. This method will do nothing, if the element has a width and height of zero and does not define any anchors.- Parameters:
element
- the position that should be added to the grid (might be null).offset
- the vertical shift which adjusts the visual position of the content.headerSize
- the vertical shift which adjusts the visual position of the content.- Returns:
- true, if the box has not changed and can be safely skipped.
- Throws:
NullPointerException
- if the bounds are null
-
addRenderableContent
public void addRenderableContent(RenderableReplacedContentBox element, long offset, long headerSize, long maxHeight)
-
ensureXMapping
public void ensureXMapping(long coordinate, Boolean aux)
-
ensureYMapping
public void ensureYMapping(long coordinate, Boolean aux)
-
isStrict
public boolean isStrict()
Gets the strict mode flag.- Returns:
- true, if strict mode is enabled, false otherwise.
-
isEmpty
public boolean isEmpty()
-
getTableBounds
public TableRectangle getTableBounds(long x, long y, long width, long height, TableRectangle rect)
Returns the position of the given element within the table. The TableRectangle contains row and cell indices, no layout coordinates.- Parameters:
x
- the element bounds for which the table bounds should be found.y
- the element bounds for which the table bounds should be found.width
- the element bounds for which the table bounds should be found.height
- the element bounds for which the table bounds should be found.rect
- the returned rectangle or null, if a new instance should be created- Returns:
- the filled table rectangle.
-
getTableBoundsWithCache
public TableRectangle getTableBoundsWithCache(long x, long y, long width, long height, TableRectangle rect)
-
getColSpan
public int getColSpan(int x1, long endPosition)
-
getRowSpan
public int getRowSpan(int y1, long endPosition)
-
getTableBounds
public TableRectangle getTableBounds(StrictBounds bounds, TableRectangle rect)
Returns the position of the given element within the table. The TableRectangle contains row and cell indices, no layout coordinates.- Specified by:
getTableBounds
in interfaceSlimSheetLayout
- Parameters:
bounds
- the element bounds for which the table bounds should be found.rect
- the returned rectangle or null, if a new instance should be created- Returns:
- the filled table rectangle.
-
pageCompleted
public void pageCompleted()
A Callback method to inform the sheet layout, that the current page is complete, and no more content will be added.
-
removeAuxilaryBounds
protected void removeAuxilaryBounds()
-
getRowHeight
public long getRowHeight(int row)
Computes the height of the given row.- Specified by:
getRowHeight
in interfaceSlimSheetLayout
- Parameters:
row
- the row, for which the height should be computed.- Returns:
- the height of the row.
- Throws:
IndexOutOfBoundsException
- if the row is invalid.
-
getMaxHeight
public long getMaxHeight()
-
getMaxWidth
public long getMaxWidth()
- Specified by:
getMaxWidth
in interfaceSlimSheetLayout
-
getCellWidth
public long getCellWidth(int startCell)
- Specified by:
getCellWidth
in interfaceSlimSheetLayout
-
getCellWidth
public long getCellWidth(int startCell, int endCell)
Computes the height of the given row.- Specified by:
getCellWidth
in interfaceSlimSheetLayout
- Parameters:
startCell
- the first cell in the rangeendCell
- the last cell included in the cell range- Returns:
- the height of the row.
- Throws:
IndexOutOfBoundsException
- if the row is invalid.
-
getRowHeight
public long getRowHeight(int startRow, int endRow)
-
getColumnCount
public int getColumnCount()
The current number of columns. Of course, this value begins to be reliable, once the number of columns is known (that is at the end of the layouting process).- Specified by:
getColumnCount
in interfaceSlimSheetLayout
- Returns:
- the number columns.
-
getRowCount
public int getRowCount()
The current number of rows. Of course, this value begins to be reliable, once the number of rows is known (that is at the end of the layouting process).- Returns:
- the number columns.
-
getXPosition
public long getXPosition(int col)
- Specified by:
getXPosition
in interfaceSlimSheetLayout
-
getYPosition
public long getYPosition(int row)
- Specified by:
getYPosition
in interfaceSlimSheetLayout
-
clear
public void clear()
-
clearVerticalInfo
public void clearVerticalInfo()
-
-