Class SpreadsheetTable
java.lang.Object
com.vaadin.flow.component.spreadsheet.SpreadsheetTable
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
SpreadsheetFilterTable
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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<org.apache.poi.ss.util.CellReference,PopupButton> -
Constructor Summary
ConstructorsConstructorDescriptionSpreadsheetTable(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.SpreadsheetTable(Spreadsheet spreadsheet, org.apache.poi.ss.usermodel.Sheet sheet, org.apache.poi.ss.util.CellRangeAddress fullTableRegion, org.openxmlformats.schemas.spreadsheetml.x2006.main.CTAutoFilter ctWorksheetAutoFilter, org.apache.poi.xssf.usermodel.XSSFTable xssfTable) Creates a new table for the given spreadsheet component, sheet and region while referencing the backing xssfTable or ctWorksheetAutoFilter.SpreadsheetTable(Spreadsheet spreadsheet, org.apache.poi.ss.util.CellRangeAddress tableRegion) Creates a new table for the given spreadsheet component, its active sheet (returned bySpreadsheet.getActiveSheet()) and the given region. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears all the table's pop-up buttons and their pop-up content.org.openxmlformats.schemas.spreadsheetml.x2006.main.CTAutoFilterorg.apache.poi.ss.util.CellRangeAddressGets the full table region,CellRangeAddressfor this table.getPopupButton(int col) Gets thePopupButtonfor the given column.getPopupButton(org.apache.poi.ss.util.CellReference filterCellReference) Gets thePopupButtonfor the header cell pointed byCellReference.Returns all of thePopupButtons for this table.org.apache.poi.ss.usermodel.SheetgetSheet()Gets theSheetthis table belongs to.Gets theSpreadsheetcomponent this table belongs to.org.apache.poi.xssf.usermodel.XSSFTableprotected voidInitializes the pop-up buttons of this table.booleanReturns true if the spreadsheet component is currently displaying the sheet that this table belongs to.voidreload()Reload the table's pop-up buttons, if spreadsheet component is currently presenting the sheet this table belongs to.protected voidsetCtWorksheetAutoFilter(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTAutoFilter ctWorksheetAutoFilter) Sets the CTAutoFilter object that represents this table in the underlying POI model.protected voidsetXssfTable(org.apache.poi.xssf.usermodel.XSSFTable xssfTable) Sets the XSSFTable object that represents this table in the underlying POI model.
-
Field Details
-
popupButtons
-
-
Constructor Details
-
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 bySpreadsheet.getActiveSheet()) and the given region. Adds pop-up buttons for table headers (cells in the first row).- Parameters:
spreadsheet- Target spreadsheettableRegion- 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 spreadsheetsheet- Target sheet within the spreadsheetfullTableRegion- 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, org.openxmlformats.schemas.spreadsheetml.x2006.main.CTAutoFilter ctWorksheetAutoFilter, org.apache.poi.xssf.usermodel.XSSFTable xssfTable) Creates a new table for the given spreadsheet component, sheet and region while referencing the backing xssfTable or ctWorksheetAutoFilter. 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 spreadsheetsheet- Target sheet within the spreadsheetfullTableRegion- Cell range to build the table inctWorksheetAutoFilter- Set this to not-null if this table is backed by a XSSFSheet.getCTWorksheet().getAutoFilter()xssfTable- Set this to not-null if this table is backed by a XSSFTable
-
-
Method Details
-
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 theSheetthis table belongs to.- Returns:
- Sheet this table belongs to
-
getSpreadsheet
Gets theSpreadsheetcomponent this table belongs to.- Returns:
- Spreadsheet this table belongs to
-
getFullTableRegion
public org.apache.poi.ss.util.CellRangeAddress getFullTableRegion()Gets the full table region,CellRangeAddressfor this table.- Returns:
- Table region
-
getPopupButton
Gets thePopupButtonfor the given column. If given column is outside of the table region,nullwill be returned.- Parameters:
col- Column index, 0-based- Returns:
- the
PopupButtoncontained in the header column of this table.
-
getPopupButton
Gets thePopupButtonfor the header cell pointed byCellReference. If given reference is not a header cell for this table, or is outside of the table region,nullwill be returned.- Parameters:
filterCellReference- header cell reference- Returns:
- Pop-up button from the given cell, or null if not found
-
getPopupButtons
Returns all of thePopupButtons for this table.- Returns:
- the pop-up buttons for this table in no specific order.
-
setCtWorksheetAutoFilter
protected void setCtWorksheetAutoFilter(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTAutoFilter ctWorksheetAutoFilter) Sets the CTAutoFilter object that represents this table in the underlying POI model.- Parameters:
ctWorksheetAutoFilter- Referenced autofilter.
-
getCtWorksheetAutoFilter
public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTAutoFilter getCtWorksheetAutoFilter()- Returns:
- Returns the CTAutoFilter object that represents this table in the underlying POI model. Can be null if this table is not backed by a Worksheet CTAutoFilter.
-
setXssfTable
protected void setXssfTable(org.apache.poi.xssf.usermodel.XSSFTable xssfTable) Sets the XSSFTable object that represents this table in the underlying POI model.- Parameters:
xssfTable- Referenced table.
-
getXssfTable
public org.apache.poi.xssf.usermodel.XSSFTable getXssfTable()- Returns:
- Returns the XSSFTable object that represents this table in the underlying POI model. Can be null if this table is not backed by a XSSFTable.
-