Package ch.rabanti.picoxlsx4j.style
Class Style
- java.lang.Object
-
- ch.rabanti.picoxlsx4j.style.AbstractStyle
-
- ch.rabanti.picoxlsx4j.style.Style
-
- All Implemented Interfaces:
Comparable<AbstractStyle>
public class Style extends AbstractStyle
Class representing a style which consists of several components- Author:
- Raphael Stoeckli
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Style
append(AbstractStyle styleToAppend)
Appends the specified style parts to the current one.AbstractStyle
copy()
Method to copy the current object to a new oneStyle
copyStyle()
Copies the current object as casted styleBorder
getBorder()
Gets the border component of the styleCellXf
getCellXf()
Gets the cellXf component of the styleFill
getFill()
Gets the fill component of the styleFont
getFont()
Gets the font component of the styleString
getName()
Gets the name of the style.NumberFormat
getNumberFormat()
Gets the number format component of the styleint
hashCode()
Override method to calculate the hash of this componentboolean
isInternalStyle()
Gets whether the style is system internalvoid
setBorder(Border borderRef)
Sets the border component of the stylevoid
setCellXf(CellXf cellXfRef)
Sets the cellXf component of the stylevoid
setFill(Fill fillRef)
Sets the fill component of the stylevoid
setFont(Font fontRef)
Sets the font component of the stylevoid
setName(String name)
Sets the name of the style.void
setNumberFormat(NumberFormat numberFormatRef)
Sets the number format component of the stylevoid
setStyleManagerReference(StyleManager styleManagerReference)
Sets the reference of the style managerString
toString()
Override toString method-
Methods inherited from class ch.rabanti.picoxlsx4j.style.AbstractStyle
compareTo, equals, getInternalID, setInternalID
-
-
-
-
Constructor Detail
-
Style
public Style()
Default constructor
-
Style
public Style(String name)
Constructor with parameters- Parameters:
name
- Name of the style
-
Style
public Style(String name, int forcedOrder, boolean internal)
Constructor with parameters (internal use)- Parameters:
name
- Name of the styleforcedOrder
- Number of the style for sorting purpose. Style will be placed to this position (internal use only)internal
- If true, the style is marked as internal
-
-
Method Detail
-
getBorder
public Border getBorder()
Gets the border component of the style- Returns:
- Border of the style
-
getCellXf
public CellXf getCellXf()
Gets the cellXf component of the style- Returns:
- CellXf of the style
-
getFill
public Fill getFill()
Gets the fill component of the style- Returns:
- Fill of the style
-
getFont
public Font getFont()
Gets the font component of the style- Returns:
- Font of the style
-
getNumberFormat
public NumberFormat getNumberFormat()
Gets the number format component of the style- Returns:
- Number format of the style
-
setBorder
public void setBorder(Border borderRef)
Sets the border component of the style- Parameters:
borderRef
- Border of the style
-
setCellXf
public void setCellXf(CellXf cellXfRef)
Sets the cellXf component of the style- Parameters:
cellXfRef
- CellXf of the style
-
setFill
public void setFill(Fill fillRef)
Sets the fill component of the style- Parameters:
fillRef
- Fill of the style
-
setFont
public void setFont(Font fontRef)
Sets the font component of the style- Parameters:
fontRef
- Font of the style
-
setNumberFormat
public void setNumberFormat(NumberFormat numberFormatRef)
Sets the number format component of the style- Parameters:
numberFormatRef
- Number format of the style
-
setStyleManagerReference
public void setStyleManagerReference(StyleManager styleManagerReference)
Sets the reference of the style manager- Parameters:
styleManagerReference
- Reference to the corresponding style manager object
-
getName
public String getName()
Gets the name of the style.- Returns:
- Name
-
setName
public void setName(String name)
Sets the name of the style. If not defined, the automatically calculated hash will be used as name- Parameters:
name
- Name
-
isInternalStyle
public boolean isInternalStyle()
Gets whether the style is system internal- Returns:
- If true, the style is an internal style. Such styles are not meant to be altered
-
append
public Style append(AbstractStyle styleToAppend)
Appends the specified style parts to the current one. The parts can be instances of sub-classes like Border or CellXf or a Style instance. Only the altered properties of the specified style or style part that differs from a new / untouched style instance will be appended. This enables method chaining- Parameters:
styleToAppend
- The style to append or a sub-class of Style- Returns:
- Current style with appended style parts
-
toString
public String toString()
Override toString method
-
hashCode
public int hashCode()
Override method to calculate the hash of this component
-
copy
public AbstractStyle copy()
Method to copy the current object to a new one- Specified by:
copy
in classAbstractStyle
- Returns:
- Copy of the current object without the internal ID
-
copyStyle
public Style copyStyle()
Copies the current object as casted style- Returns:
- Copy of the current object without the internal ID
-
-