public final class SpanHelper extends Object
Example table:
+----------+----------+----------+ | 1,2 | 1,1 | +----------+----------+----------+ | 1,1 | 1,2 | +----------+----------+----------+ | 1,1 | 1,1 | 1,1 | +----------+----------+----------+
Usage:
spanHelper.reset(); spanHelper.addRow(); spanHelper.addCell(1, 2); spanHelper.getNextColumn(); // --> 2 spanHelper.getNextRow(); // --> 1 spanHelper.addCell(1, 1); spanHelper.addRow(); spanHelper.addCell(1, 1); spanHelper.addCell(1, 2); spanHelper.getNextColumn(); // --> 3 spanHelper.getNextRow(); // --> 2 spanHelper.addRow(); spanHelper.addCell(1, 1); spanHelper.addCell(1, 1); spanHelper.addCell(1, 1);
Constructor and Description |
---|
SpanHelper() |
Modifier and Type | Method and Description |
---|---|
void |
addCell(int rowSpan,
int colSpan)
Adds a cell to current table layout.
|
void |
addCell(int rowSpan,
int colSpan,
int startCol)
Adds a cell to current table layout.
|
void |
addRow()
Adds a row to current table layout.
|
int |
getNextColumn()
Returns next column in current table layout.
|
int |
getNextRow()
Returns next row in current table layout.
|
void |
reset()
Allows the same SpanHelper to be reused for another table layout.
|
public void reset()
public void addRow()
public void addCell(int rowSpan, int colSpan)
rowSpan
- number of rows spanned by the cellcolSpan
- number of columns spanned by the cellpublic void addCell(int rowSpan, int colSpan, int startCol)
rowSpan
- number of rows spanned by the cellcolSpan
- number of columns spanned by the cellstartCol
- start column of the cell. If less than getNextColumn()
, startCol is set to the value returned by
getNextColumn()public int getNextRow()
public int getNextColumn()