Package com.basiscomponents.db.export
Class SheetConfiguration
- java.lang.Object
-
- com.basiscomponents.db.export.SheetConfiguration
-
public class SheetConfiguration extends Object
Encapsulates the configurable attributes for an XLSX export
-
-
Constructor Summary
Constructors Constructor Description SheetConfiguration()
SheetConfiguration(ReportDetails reportDetails, float fontSize)
initializes the sheet configuration
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addColumn(String header)
Appends a new column to the back of the list of columnsvoid
addColumn(String header, int width)
Appends a new column to the back of the list of columnsvoid
addColumn(String header, int width, String fieldName)
Appends a new column to the back of the list of columnsvoid
addColumn(String header, ColumnConfigurationBuilder colConfigBuilder)
Appends a new column to the back of the list of columnsvoid
clearColumns()
Removes all columnsColumnConfiguration
getColumn(int index)
Retrieves the column at the given positionList<ColumnConfiguration>
getColumnConfigurations()
Gets the column configurationList<String>
getColumnNamesOrdered()
Gets the list of column names maintaining intended orderorg.apache.poi.ss.usermodel.Sheet
getConfiguredSheet(org.apache.poi.ss.usermodel.Sheet sheet)
Applies configurations to sheetfloat
getFontSize()
Gets the font sizeReportDetails
getReportDetails()
Gets the report detailsString
getSheetName()
returns the sheet name configured for excel sheetsvoid
insertColumn(String header, int index)
Inserts a new column in position to the list of columnsvoid
insertColumn(String header, int width, int index)
Inserts a new column in position to the list of columnsvoid
insertColumn(String header, int width, String fieldName, int index)
Creates a new column and inserts it into given position abstracted away from exposed methodsvoid
insertColumn(String header, ColumnConfigurationBuilder colConfigBuilder, int index)
Inserts a new column in position to the list of columnsvoid
removeColumn(int index)
Removes the column at the given positionvoid
setFontSize(float fontSize)
Sets the font sizevoid
setReportDetails(ReportDetails reportDetails)
Sets the report detailsvoid
setSheetName(String sheetName)
sets the Sheet Name for Excel Sheet Pages
-
-
-
Constructor Detail
-
SheetConfiguration
public SheetConfiguration()
-
SheetConfiguration
public SheetConfiguration(ReportDetails reportDetails, float fontSize)
initializes the sheet configuration- Parameters:
reportDetails
- ReportDetails class object that contains all the needed information to export a result set from barista to pdffontSize
- the sheet configuration's font size
-
-
Method Detail
-
addColumn
public void addColumn(String header) throws Exception
Appends a new column to the back of the list of columns- Parameters:
header
- : label of the new column to be added- Throws:
Exception
- in case any parameter found invalid
-
addColumn
public void addColumn(String header, int width) throws Exception
Appends a new column to the back of the list of columns- Parameters:
header
- : label of the new column to be addedwidth
- : width of the new column in number of characters- Throws:
Exception
- in case any parameter found invalid
-
addColumn
public void addColumn(String header, ColumnConfigurationBuilder colConfigBuilder) throws Exception
Appends a new column to the back of the list of columns- Parameters:
header
- : label of the new column to be addedcolConfigBuilder
- : ColumnConfigurationBuilder object containing column customizations- Throws:
Exception
- in case any parameter found invalid
-
insertColumn
public void insertColumn(String header, int index) throws Exception
Inserts a new column in position to the list of columns- Parameters:
header
- : label of the new column to be addedindex
- : position of the new column with 0-based indexing- Throws:
Exception
- in case any parameter found invalid
-
insertColumn
public void insertColumn(String header, int width, int index) throws Exception
Inserts a new column in position to the list of columns- Parameters:
header
- : label of the new column to be addedindex
- : position of the new column with 0-based indexingwidth
- : width of the new column in number of characters- Throws:
Exception
- in case any parameter found invalid
-
insertColumn
public void insertColumn(String header, ColumnConfigurationBuilder colConfigBuilder, int index) throws Exception
Inserts a new column in position to the list of columns- Parameters:
header
- : label of the new column to be addedcolConfigBuilder
- : ColumnConfigurationBuilder object containing column customizationsindex
- : position of the new column with 0-based indexing- Throws:
Exception
- in case of invalid index or any parameter found invalid
-
removeColumn
public void removeColumn(int index) throws IndexOutOfBoundsException
Removes the column at the given position- Parameters:
index
- : position of the new column with 0-based indexing- Throws:
IndexOutOfBoundsException
- in case of invalid index
-
clearColumns
public void clearColumns()
Removes all columns
-
getColumn
public ColumnConfiguration getColumn(int index) throws IndexOutOfBoundsException
Retrieves the column at the given position- Parameters:
index
- : position of the new column with 0-based indexing- Returns:
- ColumnConfiguration
- Throws:
IndexOutOfBoundsException
- in case of invalid index
-
getColumnNamesOrdered
public List<String> getColumnNamesOrdered()
Gets the list of column names maintaining intended order- Returns:
- List of String containing column names
-
getConfiguredSheet
public org.apache.poi.ss.usermodel.Sheet getConfiguredSheet(org.apache.poi.ss.usermodel.Sheet sheet)
Applies configurations to sheet- Parameters:
sheet
- : provided Sheet object to configure- Returns:
- configured Sheet object
-
getSheetName
public String getSheetName()
returns the sheet name configured for excel sheets- Returns:
- sheet name
-
setSheetName
public void setSheetName(String sheetName)
sets the Sheet Name for Excel Sheet Pages- Parameters:
sheetName
- : the name
-
getColumnConfigurations
public List<ColumnConfiguration> getColumnConfigurations()
Gets the column configuration- Returns:
- returns the column configuration
-
insertColumn
public void insertColumn(String header, int width, String fieldName, int index) throws Exception
Creates a new column and inserts it into given position abstracted away from exposed methods- Parameters:
header
- label of the new column to be addedwidth
- the column widthfieldName
- the column's field nameindex
- position of the new column with 0-based indexing- Throws:
Exception
- in case of invalid index or any parameter found invalid
-
addColumn
public void addColumn(String header, int width, String fieldName) throws Exception
Appends a new column to the back of the list of columns- Parameters:
header
- label of the new column to be addedwidth
- the column widthfieldName
- the column's field name- Throws:
Exception
- in case of invalid index or any parameter found invalid
-
setReportDetails
public void setReportDetails(ReportDetails reportDetails)
Sets the report details- Parameters:
reportDetails
- the report details class object
-
getReportDetails
public ReportDetails getReportDetails()
Gets the report details- Returns:
- returns the report details
-
setFontSize
public void setFontSize(float fontSize)
Sets the font size- Parameters:
fontSize
- the font size
-
getFontSize
public float getFontSize()
Gets the font size- Returns:
- returns the font size
-
-