Class GridView
java.lang.Object
com.itextpdf.layout.renderer.GridView
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 ClassesModifier and TypeClassDescription(package private) static classRepresents a placement cursor.(package private) static classRepresents position on a grid. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate final GridView.Cursorprivate final Gridprivate booleanprivate final Grid.GridOrderprivate booleanprivate booleanprivate int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) booleanfit(int width, int height) Try to fit cell at the current position.booleanhasNext()(package private) void(package private) voidincreaseDefaultCursor(GridView.Pos cellSizes) Increase cursor in current flow axis(package private) booleanisFixed()Determines if current grid view can be iterated.next()(package private) GridView.Posreset(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) voidReset cursor to the start of a grid if placed a cell, which intersects current flow axis.
-
Field Details
-
grid
-
iterationOrder
-
cursor
-
restrictYGrow
private boolean restrictYGrow -
restrictXGrow
private boolean restrictXGrow -
hasNext
private boolean hasNext -
rightMargin
private int rightMargin -
bottomMargin
private int bottomMargin
-
-
Constructor Details
-
GridView
-
-
Method Details
-
hasNext
public boolean hasNext() -
next
-
reset
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
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:
trueif fixedfalseotherwise
-