Class LayoutSlot
- java.lang.Object
-
- org.eclipse.birt.report.model.api.elements.table.LayoutSlot
-
public class LayoutSlot extends java.lang.Object
A slot in the table. A slot is a container in which multiple rows can reside.
-
-
Field Summary
Fields Modifier and Type Field Description protected LayoutTable
tableContainer
The table in which the slot resides.
-
Constructor Summary
Constructors Modifier Constructor Description protected
LayoutSlot(LayoutTable table, int colBufferSize)
Constructs aSlot
with the given column number.protected
LayoutSlot(LayoutTable table, int groupId, int colBufferSize)
Constructs aSlot
with the given column number and the group level.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
addCell(int cellPos, int rowSpan, int colSpan, org.eclipse.birt.report.model.elements.Cell content, boolean isEffectualDrop)
Occupies spaces in the slot with the given cell information if applicable.protected int
addCell(int cellPos, int rowSpan, int colSpan, org.eclipse.birt.report.model.elements.Cell content, boolean isEffectualDrop, int cellId)
Occupies spaces in the slot with the given cell information if applicable.protected void
addDropSpannedCells(int cellId, int colId, int colSpan, int rowSpanOffset, org.eclipse.birt.report.model.elements.Cell content)
Occupies cells within spacecolId
andcolId + colSpan - 1
.protected java.util.List
checkOverlappedLayoutCells(int rowId, int colId, int rowSpan, int colSpan)
Checks whether cells in the given area have been occupied.protected void
ensureSize(int newRowCount, int newColumnCount)
Makes the slot has enough space with the given row size and the column size.protected int
getColumnCount()
Gets the column count of the slot.protected int
getColumnPos(int rowId, org.eclipse.birt.report.model.elements.Cell cell)
Returns 1-based the column position with the given row index and the cell element.protected LayoutRow
getCurrentLayoutRow()
Returns the current row worked on.TableGroupHandle
getGroup()
Returns the handle of the group that contains this slot if applicable.protected int
getGroupLevel()
Returns the group level of the slot if this slot is a Group Header or Group Footer slot.LayoutCell
getLayoutCell(int rowId, int colId)
Return the layout cell with the given row and column index.protected LayoutCell
getLayoutCell(int rowId, CellHandle cell)
Return the layout cell with the given row and column index.protected LayoutRow
getLayoutRow(int rowId)
Returns the row with the give index.java.lang.String
getLayoutString()
Returns the string that shows the layout.int
getRowCount()
Returns the row count in the slot.SlotHandle
getSlot()
Returns the slot handle of the layout slot.int
getSlotId()
Returns the id of the slot.java.util.Iterator
layoutRowsIterator()
ReturnsLayoutRow
s in the row.protected void
newLayoutRow(org.eclipse.birt.report.model.elements.TableRow row)
Creates a row in the slot.java.util.Iterator
rowsIterator()
Returns handles ofRow
s in the row.
-
-
-
Field Detail
-
tableContainer
protected LayoutTable tableContainer
The table in which the slot resides.
-
-
Constructor Detail
-
LayoutSlot
protected LayoutSlot(LayoutTable table, int colBufferSize)
Constructs aSlot
with the given column number.- Parameters:
table
- the layout tablecolBufferSize
- the column count
-
LayoutSlot
protected LayoutSlot(LayoutTable table, int groupId, int colBufferSize)
Constructs aSlot
with the given column number and the group level.- Parameters:
table
- the layout tablegroupId
- the group level if the slot is Group Header or Group FootercolBufferSize
- the column count
-
-
Method Detail
-
addCell
protected int addCell(int cellPos, int rowSpan, int colSpan, org.eclipse.birt.report.model.elements.Cell content, boolean isEffectualDrop, int cellId)
Occupies spaces in the slot with the given cell information if applicable.- Parameters:
cellPos
- column index of the cell.rowSpan
- row span of the cellcolSpan
- col span of the cellcontent
- cell contentisEffectualDrop
-true
if the drop is effectual. Otherwisefalse
.cellId
- the unique id of a cell in a table. If it is less or equal than 0, assign a new id.- Returns:
- the unique cell id
-
addCell
protected int addCell(int cellPos, int rowSpan, int colSpan, org.eclipse.birt.report.model.elements.Cell content, boolean isEffectualDrop)
Occupies spaces in the slot with the given cell information if applicable.- Parameters:
cellPos
- column index of the cell.rowSpan
- row span of the cellcolSpan
- col span of the cellcontent
- cell contentisEffectualDrop
-true
if the drop is effectual. Otherwisefalse
.- Returns:
- the unique cell id
-
checkOverlappedLayoutCells
protected java.util.List checkOverlappedLayoutCells(int rowId, int colId, int rowSpan, int colSpan)
Checks whether cells in the given area have been occupied.- Parameters:
rowId
- the row indexcolId
- the column indexrowSpan
- the row spancolSpan
- the column span- Returns:
- a list containing
LayoutCells
s that are overlapped with the check area.
-
addDropSpannedCells
protected void addDropSpannedCells(int cellId, int colId, int colSpan, int rowSpanOffset, org.eclipse.birt.report.model.elements.Cell content)
Occupies cells within spacecolId
andcolId + colSpan - 1
.- Parameters:
cellId
- the unique cell idcolId
- the 0-based column positioncolSpan
- the column spanrowSpanOffset
- the offset of the column spancontent
- the cell element
-
ensureSize
protected void ensureSize(int newRowCount, int newColumnCount)
Makes the slot has enough space with the given row size and the column size.- Parameters:
newRowCount
- the new row sizenewColumnCount
- the new column size
-
newLayoutRow
protected void newLayoutRow(org.eclipse.birt.report.model.elements.TableRow row)
Creates a row in the slot.- Parameters:
row
- the row element
-
getColumnCount
protected int getColumnCount()
Gets the column count of the slot.- Returns:
- he column count of the slot.
-
getLayoutRow
protected LayoutRow getLayoutRow(int rowId)
Returns the row with the give index.- Parameters:
rowId
- the 0-based row index- Returns:
- the row
-
getCurrentLayoutRow
protected LayoutRow getCurrentLayoutRow()
Returns the current row worked on.- Returns:
- the current row
-
getGroupLevel
protected int getGroupLevel()
Returns the group level of the slot if this slot is a Group Header or Group Footer slot.- Returns:
- the 1-based group level. The 0 indicates the slot is not in the group.
-
getRowCount
public int getRowCount()
Returns the row count in the slot.- Returns:
- the row count in the slot
-
getColumnPos
protected int getColumnPos(int rowId, org.eclipse.birt.report.model.elements.Cell cell)
Returns 1-based the column position with the given row index and the cell element.- Parameters:
rowId
- the row indexcell
- the cell to search- Returns:
- 1-based the column position
-
getLayoutCell
public LayoutCell getLayoutCell(int rowId, int colId)
Return the layout cell with the given row and column index.- Parameters:
rowId
- the 0-based row indexcolId
- the 0-based column index- Returns:
- the layout cell with the given position
-
getLayoutCell
protected LayoutCell getLayoutCell(int rowId, CellHandle cell)
Return the layout cell with the given row and column index.- Parameters:
rowId
- the 0-based row indexcell
- the cell element handle- Returns:
- the layout cell with the given position
-
getLayoutString
public java.lang.String getLayoutString()
Returns the string that shows the layout. Mainly for the debug.- Returns:
- the string that shows the layout
-
getSlot
public SlotHandle getSlot()
Returns the slot handle of the layout slot.- Returns:
- the slot handle of the layout slot
-
getGroup
public TableGroupHandle getGroup()
Returns the handle of the group that contains this slot if applicable.- Returns:
- the handle of the group
-
getSlotId
public int getSlotId()
Returns the id of the slot. The return value can be one of the following:TableItem.HEADER_SLOT
TableItem.DETAIL_SLOT
TableItem.FOOTER_SLOT
TableGroup.HEADER_SLOT
TableGroup.FOOTER_SLOT
- Returns:
- the id of the slot
-
layoutRowsIterator
public java.util.Iterator layoutRowsIterator()
ReturnsLayoutRow
s in the row. Note that modifications on the return iterator do not affect the table layout.- Returns:
- an iterator containing
LayoutRow
s.
-
rowsIterator
public java.util.Iterator rowsIterator()
Returns handles ofRow
s in the row. Note that modifications on the return iterator do not affect the table layout.- Returns:
- an iterator containing
RowHandle
s.
-
-