Package ch.rabanti.picoxlsx4j.style
Class Fill
- java.lang.Object
-
- ch.rabanti.picoxlsx4j.style.AbstractStyle
-
- ch.rabanti.picoxlsx4j.style.Fill
-
- All Implemented Interfaces:
Comparable<AbstractStyle>
public class Fill extends AbstractStyle
Class representing a Fill (background) entry. The Fill entry is used to define background colors and fill patterns- Author:
- Raphael Stoeckli
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFill.FillTypeEnum for the type of the fillstatic classFill.PatternValueEnum for the type of the fill pattern
-
Field Summary
Fields Modifier and Type Field Description StringbackgroundColorstatic StringDEFAULTCOLORStringforegroundColorintindexedColorFill.PatternValuepatternFill
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Fillcopy()Method to copy the current object to a new oneStringgetBackgroundColor()Gets the Background color of the fill.StringgetForegroundColor()Gets the foreground color of the fill.intgetIndexedColor()Gets the indexed color (Default is 64)Fill.PatternValuegetPatternFill()Gets the pattern type of the fill (Default is none)static StringgetPatternName(Fill.PatternValue pattern)Gets the pattern name from the enuminthashCode()Override method to calculate the hash of this componentvoidsetBackgroundColor(String backgroundColor)Sets the background color of the fill.voidsetColor(String value, Fill.FillType fillType)Sets the color and the depending fill typevoidsetForegroundColor(String foregroundColor)Sets the foreground color of the fill.voidsetIndexedColor(int indexedColor)Sets the indexed color (Default is 64)voidsetPatternFill(Fill.PatternValue patternFill)Sets the pattern type of the fill (Default is none)StringtoString()Override toString method-
Methods inherited from class ch.rabanti.picoxlsx4j.style.AbstractStyle
compareTo, equals, getInternalID, setInternalID
-
-
-
-
Field Detail
-
DEFAULTCOLOR
public static final String DEFAULTCOLOR
- See Also:
- Constant Field Values
-
indexedColor
public int indexedColor
-
patternFill
public Fill.PatternValue patternFill
-
foregroundColor
public String foregroundColor
-
backgroundColor
public String backgroundColor
-
-
Constructor Detail
-
Fill
public Fill()
Default constructor
-
Fill
public Fill(String foreground, String background)
Constructor with foreground and background color- Parameters:
foreground- Foreground color of the fillbackground- Background color of the fill
-
Fill
public Fill(String value, Fill.FillType fillType)
Constructor with color value and fill type- Parameters:
value- Color valuefillType- Fill type (fill or pattern)
-
-
Method Detail
-
getPatternName
public static String getPatternName(Fill.PatternValue pattern)
Gets the pattern name from the enum- Parameters:
pattern- Enum to process- Returns:
- The valid value of the pattern as String
-
getIndexedColor
public int getIndexedColor()
Gets the indexed color (Default is 64)- Returns:
- Indexed color
-
setIndexedColor
public void setIndexedColor(int indexedColor)
Sets the indexed color (Default is 64)- Parameters:
indexedColor- Indexed color
-
getPatternFill
public Fill.PatternValue getPatternFill()
Gets the pattern type of the fill (Default is none)- Returns:
- Pattern type of the fill
-
setPatternFill
public void setPatternFill(Fill.PatternValue patternFill)
Sets the pattern type of the fill (Default is none)- Parameters:
patternFill- Pattern type of the fill
-
getForegroundColor
public String getForegroundColor()
Gets the foreground color of the fill. The value is expressed as hex string with the format AARRGGBB. AA (Alpha) is usually FF- Returns:
- Foreground color of the fill
-
setForegroundColor
public void setForegroundColor(String foregroundColor)
Sets the foreground color of the fill. The value is expressed as hex string with the format AARRGGBB. AA (Alpha) is usually FF- Parameters:
foregroundColor- Foreground color of the fill
-
getBackgroundColor
public String getBackgroundColor()
Gets the Background color of the fill. The value is expressed as hex string with the format AARRGGBB. AA (Alpha) is usually FF- Returns:
- Background color of the fill
-
setBackgroundColor
public void setBackgroundColor(String backgroundColor)
Sets the background color of the fill. The value is expressed as hex string with the format AARRGGBB. AA (Alpha) is usually FF- Parameters:
backgroundColor- Background color of the fill
-
setColor
public void setColor(String value, Fill.FillType fillType)
Sets the color and the depending fill type- Parameters:
value- Color valuefillType- Fill type (fill or pattern)
-
toString
public String toString()
Override toString method
-
copy
public Fill copy()
Method to copy the current object to a new one- Specified by:
copyin classAbstractStyle- Returns:
- Copy of the current object without the internal ID
-
-