Class LayoutTable
- java.lang.Object
-
- org.eclipse.birt.report.model.api.elements.table.LayoutTable
-
public class LayoutTable extends java.lang.ObjectThe table model for the content layout.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classLayoutTable.OverlappedAreaRepresents an overlapped area of the cell element in the table.
-
Field Summary
Fields Modifier and Type Field Description protected intnextCellIdThe unique index for each cell.protected org.eclipse.birt.report.model.elements.TableItemtableThe table element that the layout belongs to.
-
Constructor Summary
Constructors Constructor Description LayoutTable(org.eclipse.birt.report.model.elements.TableItem table, org.eclipse.birt.report.model.core.Module module)Constructs a table with the given numbers of rows and columns.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddOverlappedCell(org.eclipse.birt.report.model.elements.Cell cell, LayoutSlot slot, int rowPosn, int colPosn, int rowSpanOffset, int colSpanOffset)Update an overlapped area of a cell element into the list.CellHandlegetCell(int rowPosn, int colPosn)Returns the cell at the given position.CellHandlegetCell(int slotId, int rowId, int colId)Return a cell element with the given poistion.CellHandlegetCell(int groupLevel, int slotId, int rowId, int colId)Return a cell element with the given poistion.intgetColumnCount()Returns the column count in the table.intgetColumnPos(int groupLevel, int slotId, int rowId, org.eclipse.birt.report.model.elements.Cell cell)Return the column position for a given cell.intgetColumnPos(int slotId, int rowId, org.eclipse.birt.report.model.elements.Cell cell)Return the column position for a given cell.LayoutSlotgetDetail()Returns the detail slot.LayoutSlotgetFooter()Returns the footer slot.protected intgetGroupCount()Returns the count of the group in the table.protected org.eclipse.birt.report.model.api.elements.table.LayoutGroupBandgetGroupFooters()Returns the group footer slot.protected org.eclipse.birt.report.model.api.elements.table.LayoutGroupBandgetGroupHeaders()Returns the group header slot.LayoutSlotgetHeader()Returns the header slot.LayoutGroupgetLayoutGroup(int groupLevel)Returns the layout group with the given group level.LayoutSlotgetLayoutSlot(int slotId)Returns the slot with the given slot index.LayoutSlotgetLayoutSlot(int groupLevel, int slotId)Returns the slot with the given slot index and the group level.java.lang.StringgetLayoutString()Returns the string that shows the layout.protected org.eclipse.birt.report.model.core.ModulegetModule()Returns the module where the table element belongs to.protected intgetNextCellId()Returns the next available cell index.RowHandlegetRow(int rowPosn)Return the row handle with the given row position.TableHandlegetTable()Returns the handle of the table that the layout belongs to.protected booleanhasOverlappedArea()Checks whether the table has overlapped areas.
-
-
-
Method Detail
-
getTable
public TableHandle getTable()
Returns the handle of the table that the layout belongs to.- Returns:
- the table handle
-
getColumnCount
public int getColumnCount()
Returns the column count in the table.- Returns:
- the column count in the table.
-
getCell
public CellHandle getCell(int slotId, int rowId, int colId)
Return a cell element with the given poistion. Uses this method to find cells in Table Header, Detail and Footer slots.- Parameters:
slotId- the slot index,rowId- the 1-based row indexcolId- the 1-based column index- Returns:
- the cell element. If no cell on the position, return
null.
-
getCell
public CellHandle getCell(int groupLevel, int slotId, int rowId, int colId)
Return a cell element with the given poistion. Uses this method to find cells in Table Header, Detail and Footer slots.- Parameters:
groupLevel- the 1-based group levelslotId- the slot index,rowId- the 1-based row indexcolId- the 1-based column index- Returns:
- the cell element. If no cell on the position, return
null.
-
getRow
public RowHandle getRow(int rowPosn)
Return the row handle with the given row position. TherowPosnis regardless of the slot.- Parameters:
rowPosn- the 1-based row position- Returns:
- the row handle
-
getCell
public CellHandle getCell(int rowPosn, int colPosn)
Returns the cell at the given position. The table is viewed as be constructed by a set of flattened rows. Each row has a set of cells. Please note that the returnCellHandleis an element that occupies the given position in the layout rendering.For example, if a cell occupies the position (1, 1) and (1, 2), return
CellHandles with parameters (1, 1) and (1, 2) are same.- Parameters:
rowPosn- the 1-based row positioncolPosn- the 1-based column position- Returns:
- the cell handle at the given position
-
getColumnPos
public int getColumnPos(int slotId, int rowId, org.eclipse.birt.report.model.elements.Cell cell)Return the column position for a given cell. Uses this method to find cells in Table Header, Detail and Footer slots.- Parameters:
slotId- the index of the slot where the cell residesrowId- the 0-based row indexcell- the cell element to find- Returns:
- the 1-based column position
-
getColumnPos
public int getColumnPos(int groupLevel, int slotId, int rowId, org.eclipse.birt.report.model.elements.Cell cell)Return the column position for a given cell. Uses this method to find cells in Group Header and Footer slots.- Parameters:
groupLevel- the group levelslotId- the index of the slot where the cell residesrowId- the 0-based row indexcell- the cell element to find- Returns:
- the 1-based column position
-
getLayoutSlot
public LayoutSlot getLayoutSlot(int slotId)
Returns the slot with the given slot index.- Parameters:
slotId- the slot index- Returns:
- the layout slot.
-
getLayoutSlot
public LayoutSlot getLayoutSlot(int groupLevel, int slotId)
Returns the slot with the given slot index and the group level.- Parameters:
groupLevel- the 1-based group levelslotId- the slot index- Returns:
- the layout slot.
-
getHeader
public LayoutSlot getHeader()
Returns the header slot.- Returns:
- the header slot
-
getDetail
public LayoutSlot getDetail()
Returns the detail slot.- Returns:
- the detail slot
-
getFooter
public LayoutSlot getFooter()
Returns the footer slot.- Returns:
- the footer slot
-
getLayoutGroup
public LayoutGroup getLayoutGroup(int groupLevel)
Returns the layout group with the given group level.- Parameters:
groupLevel- the 1-based group level- Returns:
- the layout group
-
getGroupCount
protected int getGroupCount()
Returns the count of the group in the table.- Returns:
- the count of the group
-
getGroupHeaders
protected org.eclipse.birt.report.model.api.elements.table.LayoutGroupBand getGroupHeaders()
Returns the group header slot.- Returns:
- the group header slot
-
getGroupFooters
protected org.eclipse.birt.report.model.api.elements.table.LayoutGroupBand getGroupFooters()
Returns the group footer slot.- Returns:
- the group footer slot
-
getLayoutString
public java.lang.String getLayoutString()
Returns the string that shows the layout. Mainly for the debug.- Returns:
- the string that shows the layout
-
getNextCellId
protected int getNextCellId()
Returns the next available cell index.- Returns:
- the next available cell index.
-
getModule
protected org.eclipse.birt.report.model.core.Module getModule()
Returns the module where the table element belongs to.- Returns:
- the module
-
addOverlappedCell
protected void addOverlappedCell(org.eclipse.birt.report.model.elements.Cell cell, LayoutSlot slot, int rowPosn, int colPosn, int rowSpanOffset, int colSpanOffset)Update an overlapped area of a cell element into the list. The overlapped area is the area occupied by aLayoutCell.- Parameters:
cell- the cell elementslot- the layout slot where the cell residesrowPosn- the 1-based row position in the slostcolPosn- the 1-based column position in the slostrowSpanOffset- the row span offset of the overlapped areacolSpanOffset- the column span offset of the overlapped area
-
hasOverlappedArea
protected boolean hasOverlappedArea()
Checks whether the table has overlapped areas.- Returns:
trueif not have. Otherwisefalse.
-
-