Package com.itextpdf.layout.renderer
Class GridView
- java.lang.Object
-
- com.itextpdf.layout.renderer.GridView
-
class GridView extends java.lang.Object
This class represents a view on a grid, which returns cells one by one in a specified order. Also it allows to place a cell on a grid in this specific order and resizes the grid if needed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
GridView.Cursor
Represents a placement cursor.(package private) static class
GridView.Pos
Represents position on a grid.
-
Field Summary
Fields Modifier and Type Field Description private int
bottomMargin
private GridView.Cursor
cursor
private Grid
grid
private boolean
hasNext
private Grid.GridOrder
iterationOrder
private boolean
restrictXGrow
private boolean
restrictYGrow
private int
rightMargin
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) boolean
fit(int width, int height)
Try to fit cell at the current position.boolean
hasNext()
(package private) void
increaseDefaultAxis()
(package private) void
increaseDefaultCursor(GridView.Pos cellSizes)
Increase cursor in current flow axis(package private) boolean
isFixed()
Determines if current grid view can be iterated.GridView.Pos
next()
(package private) GridView.Pos
reset(int y, int x, int rightMargin, int bottomMargin)
Resets grid view and sets it up for processing new element If sparse algorithm is used then x and y positions on a grid are not reset.(package private) void
resetCursorIfIntersectingCellIsPlaced()
Reset cursor to the start of a grid if placed a cell, which intersects current flow axis.
-
-
-
Field Detail
-
grid
private final Grid grid
-
iterationOrder
private final Grid.GridOrder iterationOrder
-
cursor
private final GridView.Cursor cursor
-
restrictYGrow
private boolean restrictYGrow
-
restrictXGrow
private boolean restrictXGrow
-
hasNext
private boolean hasNext
-
rightMargin
private int rightMargin
-
bottomMargin
private int bottomMargin
-
-
Method Detail
-
hasNext
public boolean hasNext()
-
next
public GridView.Pos next()
-
reset
GridView.Pos reset(int y, int x, int rightMargin, int bottomMargin)
Resets grid view and sets it up for processing new element If sparse algorithm is used then x and y positions on a grid are not reset.- Parameters:
y
- left upper corner y position of an element on the gridx
- left upper corner x position of an element on the gridrightMargin
- specifies how many cells not to process at the right end of a gridbottomMargin
- specifies how many cells not to process at the bottom end of a grid- Returns:
- first element position
-
fit
boolean fit(int width, int height)
Try to fit cell at the current position. If cell is fit, then update current flow cursor axis by width/height of a laid out cell.- Parameters:
width
- width of the cellheight
- height of the cell- Returns:
- true if cell is fit, false otherwise
-
resetCursorIfIntersectingCellIsPlaced
void resetCursorIfIntersectingCellIsPlaced()
Reset cursor to the start of a grid if placed a cell, which intersects current flow axis. This is needed because such cells should be placed out of order and it's expected that they are go first while constructing the grid.
-
increaseDefaultCursor
void increaseDefaultCursor(GridView.Pos cellSizes)
Increase cursor in current flow axis- Parameters:
cellSizes
- cell width and height values
-
increaseDefaultAxis
void increaseDefaultAxis()
-
isFixed
boolean isFixed()
Determines if current grid view can be iterated.- Returns:
true
if fixedfalse
otherwise
-
-