Package io.keikai.model.impl
Class TableImpl
- java.lang.Object
-
- io.keikai.model.impl.AbstractTableAdv
-
- io.keikai.model.impl.TableImpl
-
- All Implemented Interfaces:
LinkedModelObject
,STable
,Serializable
,Table
public class TableImpl extends AbstractTableAdv implements LinkedModelObject
- Since:
- 3.8.0
- Author:
- henri
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TableImpl.DummyTable
-
Field Summary
-
Fields inherited from interface org.apache.poi.ss.usermodel.Table
isStructuredReference
-
-
Constructor Summary
Constructors Constructor Description TableImpl(AbstractBookAdv book, String name, String displayName, SheetRegion region, int headerRowCount, int totalsRowCount, STableStyleInfo info)
TableImpl(AbstractBookAdv book, String name, String displayName, SheetRegion region, int headerRowCount, int totalsRowCount, STableStyleInfo info, boolean totalsRowShown)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addColumn(STableColumn column)
void
checkOrphan()
boolean
contains(CellReference cell)
checks if the given cell is part of the table.SAutoFilter
createAutoFilter()
Creates a new auto filter for this table the old one will be drop directly.void
deleteAutoFilter()
Delete current autofilter if it hasvoid
deleteCols(int col1, int col2)
void
deleteRows(int row1, int row2)
void
destroy()
Destroy / release this model object, for example all the dependency, parent linking.void
enableAutoFilter(boolean enable)
int
findColumnIndex(String columnHeader)
Returns the index of a given named column in the table (names are case insensitive in XSSF).SheetRegion
getAllRegion()
SAutoFilter
getAutoFilter()
Gets the auto filter information if there is.SBook
getBook()
SCellStyle
getCellStyle(int row, int col)
STableColumn
getColumnAt(int colIdx)
List<STableColumn>
getColumns()
SheetRegion
getColumnsRegion(String columnName1, String columnName2)
SheetRegion
getDataRegion()
String
getDisplayName()
int
getEndColIndex()
Get the bottom-right column index on the sheetint
getEndRowIndex()
Get the bottom-right row indexint
getHeaderRowCount()
SheetRegion
getHeadersRegion()
SheetRegion
getItemRegion(TablePtg.Item item, int rowIdx)
String
getName()
Get the name of the table.String
getSheetName()
Returns the sheet name that the table belongs to.int
getStartColIndex()
Get the top-left column index relative to the sheetint
getStartRowIndex()
Get the top-left row index on the sheetTableStyleInfo
getStyle()
String
getStyleName()
STableStyleInfo
getTableStyleInfo()
SheetRegion
getThisRowRegion(int rowIdx)
SheetRegion
getTotalsRegion()
int
getTotalsRowCount()
void
insertCols(int col1, int col2, boolean insertLeft)
void
insertRows(int row1, int row2)
boolean
isHasTotalsRow()
Note: This is misleading.void
refreshFilter()
void
refreshStyle()
void
setDisplayName(String name)
void
setHeaderRowCount(int count)
void
setName(String newname)
void
setTableStyle(STableStyleInfo style)
void
setTotalsRowCount(int count)
boolean
shiftCols(int diff)
boolean
shiftRows(int diff)
-
-
-
Constructor Detail
-
TableImpl
public TableImpl(AbstractBookAdv book, String name, String displayName, SheetRegion region, int headerRowCount, int totalsRowCount, STableStyleInfo info)
-
TableImpl
public TableImpl(AbstractBookAdv book, String name, String displayName, SheetRegion region, int headerRowCount, int totalsRowCount, STableStyleInfo info, boolean totalsRowShown)
-
-
Method Detail
-
getColumns
public List<STableColumn> getColumns()
- Specified by:
getColumns
in interfaceSTable
-
addColumn
public void addColumn(STableColumn column)
-
getTableStyleInfo
public STableStyleInfo getTableStyleInfo()
- Specified by:
getTableStyleInfo
in interfaceSTable
-
setTableStyle
public void setTableStyle(STableStyleInfo style)
-
getTotalsRowCount
public int getTotalsRowCount()
- Specified by:
getTotalsRowCount
in interfaceSTable
- Specified by:
getTotalsRowCount
in interfaceTable
- Returns:
- 0 for no totals rows, 1 for totals row shown. Values > 1 are not currently used by Excel up through 2016, and the OOXML spec doesn't define how they would be implemented.
-
getHeaderRowCount
public int getHeaderRowCount()
- Specified by:
getHeaderRowCount
in interfaceSTable
- Specified by:
getHeaderRowCount
in interfaceTable
- Returns:
- 0 for no header rows, 1 for table headers shown. Values > 1 might be used by Excel for pivot tables?
-
setTotalsRowCount
public void setTotalsRowCount(int count)
- Specified by:
setTotalsRowCount
in interfaceSTable
-
setHeaderRowCount
public void setHeaderRowCount(int count)
- Specified by:
setHeaderRowCount
in interfaceSTable
-
getDisplayName
public String getDisplayName()
- Specified by:
getDisplayName
in interfaceSTable
-
setDisplayName
public void setDisplayName(String name)
- Specified by:
setDisplayName
in interfaceSTable
-
getDataRegion
public SheetRegion getDataRegion()
- Specified by:
getDataRegion
in interfaceSTable
-
getColumnsRegion
public SheetRegion getColumnsRegion(String columnName1, String columnName2)
- Specified by:
getColumnsRegion
in interfaceSTable
-
getHeadersRegion
public SheetRegion getHeadersRegion()
- Specified by:
getHeadersRegion
in interfaceSTable
-
getTotalsRegion
public SheetRegion getTotalsRegion()
- Specified by:
getTotalsRegion
in interfaceSTable
-
getThisRowRegion
public SheetRegion getThisRowRegion(int rowIdx)
- Specified by:
getThisRowRegion
in interfaceSTable
-
getItemRegion
public SheetRegion getItemRegion(TablePtg.Item item, int rowIdx)
- Specified by:
getItemRegion
in interfaceSTable
-
destroy
public void destroy()
Description copied from interface:LinkedModelObject
Destroy / release this model object, for example all the dependency, parent linking. this method has to be called before remove this linking from parent object- Specified by:
destroy
in interfaceLinkedModelObject
-
checkOrphan
public void checkOrphan()
- Specified by:
checkOrphan
in interfaceLinkedModelObject
-
getColumnAt
public STableColumn getColumnAt(int colIdx)
- Specified by:
getColumnAt
in interfaceSTable
-
getCellStyle
public SCellStyle getCellStyle(int row, int col)
- Specified by:
getCellStyle
in classAbstractTableAdv
-
deleteRows
public void deleteRows(int row1, int row2)
- Specified by:
deleteRows
in classAbstractTableAdv
-
deleteCols
public void deleteCols(int col1, int col2)
- Specified by:
deleteCols
in classAbstractTableAdv
-
shiftCols
public boolean shiftCols(int diff)
- Specified by:
shiftCols
in classAbstractTableAdv
-
shiftRows
public boolean shiftRows(int diff)
- Specified by:
shiftRows
in classAbstractTableAdv
-
insertRows
public void insertRows(int row1, int row2)
- Specified by:
insertRows
in classAbstractTableAdv
-
insertCols
public void insertCols(int col1, int col2, boolean insertLeft)
- Specified by:
insertCols
in classAbstractTableAdv
-
enableAutoFilter
public void enableAutoFilter(boolean enable)
- Specified by:
enableAutoFilter
in interfaceSTable
-
getAutoFilter
public SAutoFilter getAutoFilter()
Description copied from interface:STable
Gets the auto filter information if there is.- Specified by:
getAutoFilter
in interfaceSTable
- Returns:
- the auto filter, or null if not found
-
createAutoFilter
public SAutoFilter createAutoFilter()
Description copied from interface:STable
Creates a new auto filter for this table the old one will be drop directly.- Specified by:
createAutoFilter
in interfaceSTable
- Returns:
- the new auto filter.
-
deleteAutoFilter
public void deleteAutoFilter()
Description copied from interface:STable
Delete current autofilter if it has- Specified by:
deleteAutoFilter
in interfaceSTable
-
refreshFilter
public void refreshFilter()
- Specified by:
refreshFilter
in classAbstractTableAdv
-
refreshStyle
public void refreshStyle()
- Specified by:
refreshStyle
in classAbstractTableAdv
-
getStyle
public TableStyleInfo getStyle()
-
contains
public boolean contains(CellReference cell)
Description copied from interface:Table
checks if the given cell is part of the table. Includes checking that they are on the same sheet.
-
getAllRegion
public SheetRegion getAllRegion()
- Specified by:
getAllRegion
in interfaceSTable
-
getStartColIndex
public int getStartColIndex()
Description copied from interface:Table
Get the top-left column index relative to the sheet- Specified by:
getStartColIndex
in interfaceTable
- Returns:
- table start column index on sheet
-
getStartRowIndex
public int getStartRowIndex()
Description copied from interface:Table
Get the top-left row index on the sheet- Specified by:
getStartRowIndex
in interfaceTable
- Returns:
- table start row index on sheet
-
getEndColIndex
public int getEndColIndex()
Description copied from interface:Table
Get the bottom-right column index on the sheet- Specified by:
getEndColIndex
in interfaceTable
- Returns:
- table end column index on sheet
-
getEndRowIndex
public int getEndRowIndex()
Description copied from interface:Table
Get the bottom-right row index- Specified by:
getEndRowIndex
in interfaceTable
- Returns:
- table end row index on sheet
-
getStyleName
public String getStyleName()
- Specified by:
getStyleName
in interfaceTable
- Returns:
- name of the table style, if there is one. May be a built-in name or user-defined.
-
findColumnIndex
public int findColumnIndex(String columnHeader)
Description copied from interface:Table
Returns the index of a given named column in the table (names are case insensitive in XSSF). Note this list is lazily loaded and cached for performance. Changes to the underlying table structure are not reflected in later calls unlessXSSFTable.updateHeaders()
is called to reset the cache.- Specified by:
findColumnIndex
in interfaceTable
- Parameters:
columnHeader
- the column header name to get the table column index of- Returns:
- column index corresponding to
columnHeader
-
getSheetName
public String getSheetName()
Description copied from interface:Table
Returns the sheet name that the table belongs to.- Specified by:
getSheetName
in interfaceTable
- Returns:
- sheet name
-
isHasTotalsRow
public boolean isHasTotalsRow()
Description copied from interface:Table
Note: This is misleading. The OOXML spec indicates this is true if the totals row has ever been shown, not whether or not it is currently displayed. UseTable.getTotalsRowCount()
> 0 to decide whether or not the totals row is visible.- Specified by:
isHasTotalsRow
in interfaceTable
- Returns:
- true if a totals row has ever been shown for this table
- See Also:
Table.getTotalsRowCount()
-
-