Class 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 a Slot with the given column number.
      protected LayoutSlot​(LayoutTable table, int groupId, int colBufferSize)
      Constructs a Slot 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 space colId and colId + 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()
      Returns LayoutRows 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 of Rows in the row.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • tableContainer

        protected LayoutTable tableContainer
        The table in which the slot resides.
    • Constructor Detail

      • LayoutSlot

        protected LayoutSlot​(LayoutTable table,
                             int colBufferSize)
        Constructs a Slot with the given column number.
        Parameters:
        table - the layout table
        colBufferSize - the column count
      • LayoutSlot

        protected LayoutSlot​(LayoutTable table,
                             int groupId,
                             int colBufferSize)
        Constructs a Slot with the given column number and the group level.
        Parameters:
        table - the layout table
        groupId - the group level if the slot is Group Header or Group Footer
        colBufferSize - 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 cell
        colSpan - col span of the cell
        content - cell content
        isEffectualDrop - true if the drop is effectual. Otherwise false.
        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 cell
        colSpan - col span of the cell
        content - cell content
        isEffectualDrop - true if the drop is effectual. Otherwise false.
        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 index
        colId - the column index
        rowSpan - the row span
        colSpan - the column span
        Returns:
        a list containing LayoutCellss 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 space colId and colId + colSpan - 1.
        Parameters:
        cellId - the unique cell id
        colId - the 0-based column position
        colSpan - the column span
        rowSpanOffset - the offset of the column span
        content - 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 size
        newColumnCount - 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 index
        cell - 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 index
        colId - 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 index
        cell - 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()
        Returns LayoutRows in the row. Note that modifications on the return iterator do not affect the table layout.
        Returns:
        an iterator containing LayoutRows.
      • rowsIterator

        public java.util.Iterator rowsIterator()
        Returns handles of Rows in the row. Note that modifications on the return iterator do not affect the table layout.
        Returns:
        an iterator containing RowHandles.