Package overit.geocall.basic.ui.xlsx
Class XlsxDocument
java.lang.Object
overit.geocall.platform.ui.UINode
overit.geocall.basic.ui.xlsx.XlsxComponent
overit.geocall.basic.ui.xlsx.XlsxContainer
overit.geocall.basic.ui.xlsx.XlsxDocument
- All Implemented Interfaces:
Serializable,Identified
This class extends
This class represent the Excel document where are added in the XLSheet. It needs to represent a DBView for each sheet in an Excel file.
XlsxContainer and implements Identified.This class represent the Excel document where are added in the XLSheet. It needs to represent a DBView for each sheet in an Excel file.
- See Also:
-
Field Summary
Fields inherited from class overit.geocall.basic.ui.xlsx.XlsxComponent
_align, _cellFormat, _cellFormatClass, _font, _format, _valign, _warning -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets anXlsxComponentfrom a registry name passed by parameter.Returns theIdentityassociated to the componentorg.apache.poi.xssf.usermodel.XSSFCellStylegetOrCreateCellStyle(String styleName, @NotNull Supplier<org.apache.poi.xssf.usermodel.XSSFCellStyle> cellStyleSupplier) Gets an existing cell style from the cache or creates a new one using the provided supplier.Returns the parent node of this UINodeGets the document's Registry.getRoot()Returns the root of the user interface component definition tree of this UINodevoidsetDataView(Object dbs) Sets the DataView into the active sheet.voidsetDataView(Object dbv, String tableName) Sets the DataView into a specific table in the active sheet.voidSets the encrypt algorithm to use to encrypth the password.voidSets the document's password that will be encrypted. .voidsetIdentity(Identity identity) Sets theIdentityto the componentvoidSets the password for the document.voidSets the label to the active sheet.voidSets the titel to the active sheet.voidSets the ZIP64 mode for the XLSX file generation.voidwriteTo(OutputStream out, InputStream template, String encoding) Creates the Excel document writing in the WebRsource Out and utilizing the Excel template from the WebRsource template.voidwriteTo(OutputStream out, String encoding) Creates the Excel document writing in the OutputStream Out.voidwriteTo(WebResource wr) Creates the Excel document writing in the WebRsource wr.voidwriteTo(WebResource out, WebResource template, String encoding) Creates the Excel document writing in the WebRsource Out and utilizing the Excel template from the WebRsource template.Methods inherited from class overit.geocall.basic.ui.xlsx.XlsxComponent
getAlign, getBgColor, getBoolean, getBorder, getBorder, getBorder, getBorderColor, getBorderStyle, getCellFormat, getCellStyle, getChildIterator, getChildSize, getColor, getColor, getComment, getDefault, getDocument, getFont, getFontSize, getKey, getLabel, getName, getRegistryName, getSheet, getStyleName, getVAlign, getWarning, hasFontSize, initCellFormat, initChilds, isBold, isEnabled, isForcedBoldState, isForcedFontSize, isHidden, isLocked, isShrinkToFit, isWrap, onInit, setALIGN, setBGCOLOR, setBOLD, setBorder, setBORDER, setBorderColor, setBORDERCOLORRGB, setBorderStyle, setBORDERSTYLE, setCellFormat, setCELLFORMATCLASS, setCellStyle, setCOLOR, setCOMMENT, setDEFAULT, setENABLED, setFONT, setFONTSIZE, setFORMAT, setHIDDEN, setKEY, setLabel, setLABEL, setLOCKED, setNAME, setREGISTRYNAME, setSheet, setSHRINKTOFIT, setSTYLENAME, setUseBGColor, setUSEBGCOLOR, setUSEDECIMALSPERCENTAGE, setUseHeadColor, setUSEHEADCOLOR, setVALIGN, setWRAP, useBGColor, useDecimalsPercentage, useHeaderColorMethods inherited from class overit.geocall.platform.ui.UINode
addChild, addChildText, getChildren, getNodeId, getSchema, setNodeId, setParent, setSchema
-
Constructor Details
-
XlsxDocument
public XlsxDocument()
-
-
Method Details
-
getOrCreateCellStyle
public org.apache.poi.xssf.usermodel.XSSFCellStyle getOrCreateCellStyle(String styleName, @NotNull @NotNull Supplier<org.apache.poi.xssf.usermodel.XSSFCellStyle> cellStyleSupplier) Gets an existing cell style from the cache or creates a new one using the provided supplier. This method implements the core caching mechanism for Excel cell styles, providing significant performance improvements when generating large XLSX documents with repeated formatting patterns.Caching Strategy:
- Cache Hit: If a style with the given name exists in the cache, returns the cached instance
- Cache Miss: If no cached style exists, invokes the supplier to create a new style and caches it
- No Caching: If styleName is null, blank, or empty, bypasses cache and directly invokes supplier
Example Usage:
// In a formatting class XSSFCellStyle headerStyle = document.getOrCreateCellStyle("table_header", () -> createHeaderStyle(sheet, component)); // With variant naming XSSFCellStyle evenRowStyle = document.getOrCreateCellStyle("data_row_even", () -> createDataRowStyle(sheet, component, false));- Parameters:
styleName- The unique name for the cell style used as cache key. If null, blank, or empty, caching is bypassed and the supplier is invoked directly. Should be descriptive and consistent across similar formatting scenarios.cellStyleSupplier- ASupplierthat creates a newXSSFCellStylewhen invoked. This supplier is called only when the style is not found in the cache or when caching is bypassed. Must not be null and should return a valid style.- Returns:
- An
XSSFCellStyleinstance, either retrieved from cache or newly created by the supplier. The returned style is ready for use and will be cached for future requests with the same name. - Throws:
NullPointerException- if cellStyleSupplier is null
-
setIdentity
Description copied from interface:IdentifiedSets theIdentityto the component- Specified by:
setIdentityin interfaceIdentified- Overrides:
setIdentityin classXlsxComponent- Parameters:
identity- The Identity that must be associated to the component
-
getIdentity
Description copied from interface:IdentifiedReturns theIdentityassociated to the component- Specified by:
getIdentityin interfaceIdentified- Overrides:
getIdentityin classXlsxComponent- Returns:
- The Identity of the user currently logged in the application
-
setPASSWORD
Sets the password for the document.- Parameters:
s- The password to set.
-
setENCRYPTIONPASSWORD
Sets the document's password that will be encrypted. .- Parameters:
s- The password to set.
-
setENCRYPTIONALGORITHM
Sets the encrypt algorithm to use to encrypth the password.- Parameters:
s- Possible algoritm are:- rc4
- crypto
- xor
- default
-
setZIP64MODE
Sets the ZIP64 mode for the XLSX file generation.ZIP64 is an extension to the ZIP format that allows files larger than 4GB. This method configures how ZIP64 extensions are applied when creating XLSX files.
- Parameters:
s- the ZIP64 mode as a string (case-insensitive). Valid values are:- "ALWAYS" - Always use ZIP64 extensions for all entries, regardless of size. This may cause compatibility issues with some external readers (e.g., DuckDB, older Excel versions).
- "ALWAYSWITHCOMPATIBILITY" - Always use ZIP64 with additional compatibility measures.
- "NEVER" - Never use ZIP64 extensions. Files larger than 4GB will fail.
- Any other value (default) - Use ZIP64 only when needed (AsNeeded mode). This is the recommended setting for maximum compatibility.
- See Also:
-
getParent
Description copied from class:UINodeReturns the parent node of this UINode -
getRoot
Description copied from class:UINodeReturns the root of the user interface component definition tree of this UINode -
getComponentFromRegistry
Gets anXlsxComponentfrom a registry name passed by parameter.- Parameters:
name- The registry name that identify theXlsxComponent- Returns:
- The
XlsxComponentfrom a registry name passed by parameter.
-
getRegistry
Gets the document's Registry.- Returns:
- The registry of the document.
-
writeTo
Creates the Excel document writing in the WebRsource Out and utilizing the Excel template from the WebRsource template.- Parameters:
out- Where to create the reporttemplate- It cannot be nullencoding- It can be null only if the format is CP1252
-
writeTo
Creates the Excel document writing in the WebRsource wr.- Parameters:
wr- Where to create the report
-
writeTo
Creates the Excel document writing in the OutputStream Out.- Parameters:
out- Where to create the reportencoding- It can be null only if the format is CP1252
-
writeTo
Creates the Excel document writing in the WebRsource Out and utilizing the Excel template from the WebRsource template.- Parameters:
out- Where to create the reporttemplate- It cannot be nullencoding- It can be null only if the format is CP1252
-
setSheetLabel
Sets the label to the active sheet.- Parameters:
s- The label to set.
-
setTitle
Sets the titel to the active sheet.- Parameters:
s- The title to set.
-
setDataView
Sets the DataView into the active sheet.- Parameters:
dbs- The DataView to set.
-
setDataView
Sets the DataView into a specific table in the active sheet.- Parameters:
dbv- The DataView to set.tableName- The table in which insert the Data View.
-