Class XlsxComponent

java.lang.Object
overit.geocall.platform.ui.UINode
overit.geocall.basic.ui.xlsx.XlsxComponent
All Implemented Interfaces:
Serializable, Identified
Direct Known Subclasses:
XlsxCell, XlsxContainer, XlsxImage, XlsxSheet, XlsxText

public class XlsxComponent extends UINode implements Identified
This class extends UINode and implements Identified.
This class is a based implementation of the generic Xlsx component.
See Also:
  • Field Details

    • _cellFormat

      protected IXlsxFormat _cellFormat
    • _cellFormatClass

      protected String _cellFormatClass
    • _font

      protected String _font
    • _warning

      protected String _warning
    • _align

      protected org.apache.poi.ss.usermodel.HorizontalAlignment _align
    • _valign

      protected org.apache.poi.ss.usermodel.VerticalAlignment _valign
    • _format

      protected String _format
  • Constructor Details

    • XlsxComponent

      public XlsxComponent()
  • Method Details

    • setSTYLENAME

      public void setSTYLENAME(String styleName)
      Sets the style name for this Excel component, used for cell style caching optimization.

      The style name serves as a cache key, enabling efficient reuse of XSSFCellStyle objects across multiple cells with identical formatting properties. This significantly improves performance and reduces memory usage when generating large Excel documents.

      Usage Guidelines:

      • Use descriptive names that reflect the formatting purpose (e.g., "header", "data_cell", "total_row")
      • Ensure consistent naming across components with identical styling
      • Avoid dynamic or unique names that would prevent cache reuse
      • Consider hierarchical naming for related styles (e.g., "table_header", "table_data")
      Parameters:
      styleName - The name to associate with this component's cell style.
      See Also:
    • getStyleName

      public String getStyleName()
      Gets the style name associated with this Excel component for cell style caching.

      The style name is used as a cache key, enabling efficient reuse of XSSFCellStyle objects. This optimization is particularly beneficial for large Excel documents with many cells sharing similar formatting.

      Returns:
      The style name for this component, or null if no explicit style name was set.
    • setSHRINKTOFIT

      public void setSHRINKTOFIT(String s)
      Sets if you want that the cell will be automatically resize based on the width of their content or not.
      Parameters:
      s - 'true' or '1' if you want to automatically shrink to fit, 'false' or '0' otherwise.
    • isShrinkToFit

      public boolean isShrinkToFit()
      Gets if the column/cells are autoamtically shrink to fit.
      Returns:
      true if the column/cells are automatically shrink to fit, false otherwise.
    • setUSEDECIMALSPERCENTAGE

      public void setUSEDECIMALSPERCENTAGE(String s)
    • useDecimalsPercentage

      public boolean useDecimalsPercentage()
    • setBOLD

      public void setBOLD(String s)
      Sets the bold text format to the instance.
      Parameters:
      s - 'true' or '1' to set the bold text format, 'false' or '0' otherwise.
    • isBold

      public boolean isBold()
      Gets if the used text format is bold or not.
      Returns:
      true if the used text format is bold, false otherwise.
    • isForcedBoldState

      public boolean isForcedBoldState()
      Gets if the used state text format is forced bold or not.
      Returns:
      true if the used state text format is forced bold, false otherwise.
    • setCellStyle

      public void setCellStyle(org.apache.poi.xssf.usermodel.XSSFCellStyle cs)
      Sets the XSSFCellStyle for the cells.
      Parameters:
      cs - The XSSFCellStyle to set.
    • getCellStyle

      public org.apache.poi.xssf.usermodel.XSSFCellStyle getCellStyle()
      Gets the XSSFCellStyle actually used for the cells.
      Returns:
      The XSSFCellStyle actually used for the cells.
    • setFORMAT

      public void setFORMAT(String s)
      Sets the number type format of the cell.
      Parameters:
      s - Allow format are:
      • '%' - Percent float format.
      • 'i' - Integer format.
      • 'f' - Float format.
      • 'e' - Accounting red float format.
      • default - Account float format.
    • initCellFormat

      protected void initCellFormat()
    • setIdentity

      public void setIdentity(Identity identity)
      Description copied from interface: Identified
      Sets the Identity to the component
      Specified by:
      setIdentity in interface Identified
      Parameters:
      identity - The Identity that must be associated to the component
    • getIdentity

      public Identity getIdentity()
      Description copied from interface: Identified
      Returns the Identity associated to the component
      Specified by:
      getIdentity in interface Identified
      Returns:
      The Identity of the user currently logged in the application
    • setSheet

      public void setSheet(org.apache.poi.ss.usermodel.Sheet s)
      Sets the active Sheet.
      Parameters:
      s - The Sheet to set.
    • getSheet

      public org.apache.poi.ss.usermodel.Sheet getSheet()
      Gets the active Sheet.
      Returns:
      The acrtve Sheet.
    • setNAME

      public void setNAME(String s)
      Sets the name for the instance.
      Parameters:
      s - The name to set.
    • getName

      public String getName()
      Gets the name of tbe instance.
      Returns:
      The name of the instance.
    • setREGISTRYNAME

      public void setREGISTRYNAME(String s)
      Sets the registry name for the instance.
      Parameters:
      s - The registry name to set.
    • getRegistryName

      public String getRegistryName()
      Gets the registry name of tbe instance.
      Returns:
      The registry name of the instance.
    • setCOMMENT

      public void setCOMMENT(String s)
      Sets the comment for the instance.
      Parameters:
      s - The comment to set.
    • getComment

      public String getComment()
      Gets the comment of tbe instance.
      Returns:
      The comment of the instance.
    • setLABEL

      public void setLABEL(String s)
      Sets the label for the instance.
      Parameters:
      s - The label to set.
    • getLabel

      public String getLabel()
      Gets the label of the instance.
      Returns:
      The label of the instance.
    • setDEFAULT

      public void setDEFAULT(String o)
      Sets the default value for the instance.
      Parameters:
      o - The dafault value to set.
    • getDefault

      public Object getDefault()
      Gets the default value of the instance.
      Returns:
      The default value of the instance.
    • setUSEBGCOLOR

      public void setUSEBGCOLOR(String s)
      Sets if you want to use bg format color.
      Parameters:
      s - 'true' or '1' to use the bg format color, 'false' or '0' otherwise.
    • setUseBGColor

      public void setUseBGColor(boolean use)
      Sets if you want to use bg format color.
      Parameters:
      use - true to use the bg format color,false otherwise.
    • useBGColor

      public boolean useBGColor()
      Gets if is used the bg format color or not.
      Returns:
      true if the used color format is bg, false otherwise.
    • setUSEHEADCOLOR

      public void setUSEHEADCOLOR(String s)
      Sets if you want to use format color for the header.
      Parameters:
      s - 'true' or '1' to use the format color for the header, 'false' or '0' otherwise.
    • setUseHeadColor

      public void setUseHeadColor(boolean use)
      Sets if you want to use format color for the header.
      Parameters:
      use - true to use the format color for the header,false otherwise.
    • useHeaderColor

      public boolean useHeaderColor()
      Gets if is used the format color for the header or not.
      Returns:
      true to use format color for the header,false otherwise.
    • setHIDDEN

      public void setHIDDEN(String s)
      Sets the hidden property for the instance.
      Parameters:
      s - 'true' or '1' to set the instance to hidden, 'false' or '0' otherwise.
    • isHidden

      public boolean isHidden()
      Gets if the instance is hidden or not.
      Returns:
      true if the instance is hidden, false otherwise.
    • setENABLED

      public void setENABLED(String s)
      Sets the enable property for the instance.
      Parameters:
      s - 'true' or '1' to set the enabled property fort the instance, 'false' or '0' otherwise.
    • isEnabled

      public boolean isEnabled()
      Gets if the instance is enabled or not.
      Returns:
      true if the instance is enabled, false otherwise.
    • setLOCKED

      public void setLOCKED(String s)
      Sets if the component is locked or not.
      Parameters:
      s - 'true' or '1' if the component must be locked 'false' or '0' otherwise.
    • isLocked

      public boolean isLocked()
      Gets if the component is locked or not.
      Returns:
      true if the component is locked false otherwise.
    • setWRAP

      public void setWRAP(String s)
      Sets if the component is wrapped or not.
      Parameters:
      s - 'true' or '1' if you want to wrap the component, 'false' or '0' otherwise.
    • isWrap

      public boolean isWrap()
      Gets if the the component is wrapped or not.
      Returns:
      true if the component is wrapped, false otherwise.
    • setFONTSIZE

      public void setFONTSIZE(String s)
      Sets the font size.
      Parameters:
      s - The size to set.
    • getFontSize

      public short getFontSize()
      Gets the font size used.
      If ther's no font size used the return value will be 10.
      Returns:
      The font size used.
    • hasFontSize

      protected boolean hasFontSize()
    • isForcedFontSize

      public boolean isForcedFontSize()
      Gets if used forced font size.
      Returns:
      true if it's used forced font size, false otherwise.
    • setKEY

      public void setKEY(String s)
      Sets if the component represent a key, and sets its color to red if it is.
      Parameters:
      s - 'true' or '1' if the component must be a key 'false' or '0' otherwise.
    • getKey

      public boolean getKey()
      Gets if the component represent a key.
      Returns:
      true if the component is a key false otherwise.
    • setCOLOR

      public void setCOLOR(String s)
      Sets the cell background color.
      Parameters:
      s - The background color to set.
    • getColor

      public org.apache.poi.xssf.usermodel.XSSFColor getColor()
      Gets the XSSFColor of the component.
      Returns:
      The XSSFColor of the component.
    • getColor

      protected org.apache.poi.xssf.usermodel.XSSFColor getColor(String s)
    • setBGCOLOR

      public void setBGCOLOR(String s)
      Sets the cell background bg color.
      Parameters:
      s - The background bg color to set.
    • getBgColor

      public org.apache.poi.xssf.usermodel.XSSFColor getBgColor()
      Gets the bg XSSFColor of the component.
      Returns:
      The bg XSSFColor of the component.
    • getFont

      public String getFont()
      Gets the used font.
      Returns:
      The used font.
    • setFONT

      public void setFONT(String s)
      Sets the font to use.
      Parameters:
      s - The font to use.
    • setCELLFORMATCLASS

      public void setCELLFORMATCLASS(String s)
      Sets the format class to the cell.
      Parameters:
      s - The format to set on the cell.
    • getCellFormat

      public IXlsxFormat getCellFormat()
      Gets the used IXlsxFormat of the cell.
      Returns:
      The IXlsxFormat cell.
    • setCellFormat

      public void setCellFormat(IXlsxFormat cellFormat)
    • getAlign

      public org.apache.poi.ss.usermodel.HorizontalAlignment getAlign()
      Gets the horizontal align type of the component.
      Returns:
      The HorizontalAlignment type of the component.
    • setALIGN

      public void setALIGN(String s)
      Sets the horizontal align type for the component.
      Parameters:
      s - Allow alignement are:
      • 'C' - Center alignement.
      • F' - Fill alignement.
      • 'J' - Justify alignement.
      • 'L' - Left alignement.
      • 'R' - Right alignement.
      • default - General alignement.
    • getVAlign

      public org.apache.poi.ss.usermodel.VerticalAlignment getVAlign()
      Gets the vertical align type of the component.
      Returns:
      The VerticalAlignment type of the component.
    • setVALIGN

      public void setVALIGN(String s)
      Sets the vertical align type for the component.
      Parameters:
      s - Allow vertical alignement are:
      • 'C' - Center vertical alignement.
      • B' - Bottom vertical alignement.
      • 'J' - Justify vertical alignement.
      • 'T' - Top vertical alignement.
      • default - Default vertical alignement.
    • setBorder

      public void setBorder(String b)
      Sets the border to the component.
      Parameters:
      b - The border to set.
    • getBorder

      public String getBorder()
      Gets the active border of the component.
      Returns:
      The active border of the component.
    • setBorderColor

      public void setBorderColor(org.apache.poi.xssf.usermodel.XSSFColor borderColor)
      Sets color to the border of the component.
      Parameters:
      borderColor - The XSSFColor to set on border.
    • getBorderColor

      public org.apache.poi.xssf.usermodel.XSSFColor getBorderColor()
      Gets the border color of the component.
      Returns:
      The XSSFColor border color.
    • setBorderStyle

      public void setBorderStyle(org.apache.poi.ss.usermodel.BorderStyle borderStyle)
      Sets style to the border of the component.
      Parameters:
      borderStyle - The BorderStyle to set on border.
    • getBorderStyle

      public org.apache.poi.ss.usermodel.BorderStyle getBorderStyle()
      Gets the border style of the component.
      Returns:
      The BorderStyle of the component.
    • setBORDERSTYLE

      public void setBORDERSTYLE(String borderStyle)
      This method allows to set the style of the borders. The default style is BorderStyle.THIN.
      Parameters:
      borderStyle - The type of the style to use. The possible string are those allowed by the BorderStyle class.
    • setBORDERCOLORRGB

      public void setBORDERCOLORRGB(String rgbColor)
      This method allows to set the color of the borders. The default color is black.
      Parameters:
      rgbColor - The hexadecimal string representing the RGB color. It must be started with '#' character.
    • getBorder

      public static org.apache.poi.xssf.usermodel.XSSFCellStyle getBorder(org.apache.poi.xssf.usermodel.XSSFCellStyle cs, String border)
    • getBorder

      public static org.apache.poi.xssf.usermodel.XSSFCellStyle getBorder(org.apache.poi.xssf.usermodel.XSSFCellStyle cs, String border, org.apache.poi.ss.usermodel.BorderStyle borderStyle, org.apache.poi.xssf.usermodel.XSSFColor borderColor)
      Gets the border type, the BorderStyle and the border XSSFColor and set them on a XSSFCellStyle.
      Parameters:
      cs - The XSSFCellStyle in which sets all border attribute.
      border - The border type ("borderAll" or "borderBottom", or "borderTop" ecc).
      borderStyle - The border style.
      borderColor - The border color.
      Returns:
      The XSSFCellStyle in which sets all border attribute
    • setBORDER

      public void setBORDER(String s)
      This method allows to set the borders of the cells. You can use the methods setBORDERSTYLE(java.lang.String) and setBORDERCOLORRGB(java.lang.String) to set the style and color of the borders. The default style of the borders is BorderStyle.THIN. The default color is black.
      Parameters:
      s - The string to set the sides of the borders. The accepted values are:
      • "A": all sides
      • "T": top side
      • "B": bottom side
      • "L": left side
      • "R": right side
      It is possible set only one side or all sides.
    • getWarning

      public String getWarning()
      Gets the warning message.
      Returns:
      The warning message.
    • getChildIterator

      public Iterator getChildIterator()
      Gets the child Iterator.
      Returns:
      The Child Iterator.
    • getChildSize

      public int getChildSize()
      Gets the children's size.
      Returns:
      The children's size.
    • onInit

      public void onInit(XlsxContainer parent)
      Initialize the component and its children into the document
      Parameters:
      parent - The XlsxContainer parent.
    • getDocument

      public XlsxDocument getDocument()
      Gets the root document.
      Returns:
      The root of the XlsxDocument.
    • initChilds

      public void initChilds(XlsxContainer parent)
      Initialise the component's children.
      Parameters:
      parent - The parent XlsxContainer of the component.
    • getBoolean

      public static boolean getBoolean(String s, boolean def)
      This method is used to convert a boolean string value into a real boolean value.
      'true' and '1' are converted into true,'false' and '0' are converted into false
      Parameters:
      s - The string to convert.
      def - The default velue to return if the String s is null.
      Returns:
      The boolean value converted.
    • setLabel

      public void setLabel(String s)