Class SpreadsheetTable

  • All Implemented Interfaces:
    Serializable
    Direct Known Subclasses:
    SpreadsheetFilterTable

    public class SpreadsheetTable
    extends Object
    implements Serializable
    Represents a "table" inside a spreadsheet. A table is a region ( CellRangeAddress), that has PopupButton on the column header cells of the region. In this context the column header cells refer to the cells on the first row of the region.
    Author:
    Vaadin Ltd.
    See Also:
    Serialized Form
    • Field Detail

      • popupButtons

        protected final Map<org.apache.poi.ss.util.CellReference,​PopupButton> popupButtons
    • Constructor Detail

      • SpreadsheetTable

        public SpreadsheetTable​(Spreadsheet spreadsheet,
                                org.apache.poi.ss.util.CellRangeAddress tableRegion)
        Creates a new table for the given spreadsheet component, its active sheet (returned by Spreadsheet.getActiveSheet()) and the given region. Adds pop-up buttons for table headers (cells in the first row).
        Parameters:
        spreadsheet - Target spreadsheet
        tableRegion - Cell range to build the table in
      • SpreadsheetTable

        public SpreadsheetTable​(Spreadsheet spreadsheet,
                                org.apache.poi.ss.usermodel.Sheet sheet,
                                org.apache.poi.ss.util.CellRangeAddress fullTableRegion)
        Creates a new table for the given spreadsheet component, sheet and region. If the component is currently displaying the sheet that the table belongs to, pop-up buttons are added to table headers (first row cells).
        Parameters:
        spreadsheet - Target spreadsheet
        sheet - Target sheet within the spreadsheet
        fullTableRegion - Cell range to build the table in
    • Method Detail

      • reload

        public void reload()
        Reload the table's pop-up buttons, if spreadsheet component is currently presenting the sheet this table belongs to.

        If there are no pop-up buttons stored, when clear() has been called, the pop-up buttons are recreated. Otherwise they are just added to the spreadsheet component again.

      • clear

        public void clear()
        Clears all the table's pop-up buttons and their pop-up content.
      • isTableSheetCurrentlyActive

        public boolean isTableSheetCurrentlyActive()
        Returns true if the spreadsheet component is currently displaying the sheet that this table belongs to.
        Returns:
        true if the sheet this table belongs to is active
      • initPopupButtons

        protected void initPopupButtons()
        Initializes the pop-up buttons of this table.
      • getSheet

        public org.apache.poi.ss.usermodel.Sheet getSheet()
        Gets the Sheet this table belongs to.
        Returns:
        Sheet this table belongs to
      • getSpreadsheet

        public Spreadsheet getSpreadsheet()
        Gets the Spreadsheet component this table belongs to.
        Returns:
        Spreadsheet this table belongs to
      • getFullTableRegion

        public org.apache.poi.ss.util.CellRangeAddress getFullTableRegion()
        Gets the full table region, CellRangeAddress for this table.
        Returns:
        Table region
      • getPopupButton

        public PopupButton getPopupButton​(int col)
        Gets the PopupButton for the given column. If given column is outside of the table region, null will be returned.
        Parameters:
        col - Column index, 0-based
        Returns:
        the PopupButton contained in the header column of this table.
      • getPopupButton

        public PopupButton getPopupButton​(org.apache.poi.ss.util.CellReference filterCellReference)
        Gets the PopupButton for the header cell pointed by CellReference. If given reference is not a header cell for this table, or is outside of the table region, null will be returned.
        Parameters:
        filterCellReference - header cell reference
        Returns:
        Pop-up button from the given cell, or null if not found
      • getPopupButtons

        public Collection<PopupButton> getPopupButtons()
        Returns all of the PopupButtons for this table.
        Returns:
        the pop-up buttons for this table in no specific order.