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 class
Fill.FillType
Enum for the type of the fillstatic class
Fill.PatternValue
Enum for the type of the fill pattern
-
Field Summary
Fields Modifier and Type Field Description String
backgroundColor
static String
DEFAULTCOLOR
String
foregroundColor
int
indexedColor
Fill.PatternValue
patternFill
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Fill
copy()
Method to copy the current object to a new oneString
getBackgroundColor()
Gets the Background color of the fill.String
getForegroundColor()
Gets the foreground color of the fill.int
getIndexedColor()
Gets the indexed color (Default is 64)Fill.PatternValue
getPatternFill()
Gets the pattern type of the fill (Default is none)static String
getPatternName(Fill.PatternValue pattern)
Gets the pattern name from the enumint
hashCode()
Override method to calculate the hash of this componentvoid
setBackgroundColor(String backgroundColor)
Sets the background color of the fill.void
setColor(String value, Fill.FillType fillType)
Sets the color and the depending fill typevoid
setForegroundColor(String foregroundColor)
Sets the foreground color of the fill.void
setIndexedColor(int indexedColor)
Sets the indexed color (Default is 64)void
setPatternFill(Fill.PatternValue patternFill)
Sets the pattern type of the fill (Default is none)String
toString()
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:
copy
in classAbstractStyle
- Returns:
- Copy of the current object without the internal ID
-
-