diff options
author | PJ Fanning <fanningpj@apache.org> | 2021-12-21 15:55:01 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2021-12-21 15:55:01 +0000 |
commit | 0b871a08c5031f9953f7e9a6e8dabfecb2f5cb70 (patch) | |
tree | 2d568e12dcd75aaba25b608fbc61eae100234911 | |
parent | a2dbbd774862a1a9d8469f99cebcaeb1697e415e (diff) | |
download | poi-0b871a08c5031f9953f7e9a6e8dabfecb2f5cb70.tar.gz poi-0b871a08c5031f9953f7e9a6e8dabfecb2f5cb70.zip |
add more XSSFColor constructors
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1896249 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFColor.java | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFColor.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFColor.java index 327099acb2..904dba2eed 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFColor.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFColor.java @@ -22,7 +22,6 @@ import org.apache.poi.ss.usermodel.Color; import org.apache.poi.ss.usermodel.ExtendedColor; import org.apache.poi.ss.usermodel.IndexedColors; import org.apache.poi.util.Internal; -import org.apache.poi.util.Removal; import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor; /** @@ -34,21 +33,37 @@ public class XSSFColor extends ExtendedColor { /** * @param color The ooxml color object to use - * @param map The IndexedColorMap to use instead of the default one + * @param map The IndexedColorMap to use instead of the default one (can be null) * @return null if color is null, new instance otherwise */ public static XSSFColor from(CTColor color, IndexedColorMap map) { return color == null ? null : new XSSFColor(color, map); } + /** + * @param color The ooxml color object to use + * @return null if color is null, new instance otherwise + * @since POI 5.2.0 + */ + public static XSSFColor from(CTColor color) { + return color == null ? null : new XSSFColor(color, null); + } + private XSSFColor(CTColor color, IndexedColorMap map) { this.ctColor = color; this.indexedColorMap = map; } /** + * @since POI 5.2.0 + */ + public XSSFColor() { + this(CTColor.Factory.newInstance(), null); + } + + /** * new color with the given indexed color map - * @param colorMap The IndexedColorMap to use instead of the default one + * @param colorMap The IndexedColorMap to use instead of the default one (can be null) */ public XSSFColor(IndexedColorMap colorMap) { this(CTColor.Factory.newInstance(), colorMap); @@ -57,7 +72,7 @@ public class XSSFColor extends ExtendedColor { /** * TEST ONLY * @param clr awt Color - * @param map The IndexedColorMap to use instead of the default one + * @param map The IndexedColorMap to use instead of the default one (can be null) */ public XSSFColor(java.awt.Color clr, IndexedColorMap map) { this(map); @@ -65,9 +80,8 @@ public class XSSFColor extends ExtendedColor { } /** - * * @param rgb The RGB-byte-values for the Color - * @param colorMap The IndexedColorMap to use instead of the default one + * @param colorMap The IndexedColorMap to use instead of the default one (can be null) */ public XSSFColor(byte[] rgb, IndexedColorMap colorMap) { this(CTColor.Factory.newInstance(), colorMap); @@ -75,6 +89,14 @@ public class XSSFColor extends ExtendedColor { } /** + * @param rgb The RGB-byte-values for the Color + * @since POI 5.2.0 + */ + public XSSFColor(byte[] rgb) { + this(rgb, null); + } + + /** * @param indexedColor color index (Enum named for default colors) * @param colorMap The IndexedColorMap to use instead of the default one */ @@ -90,6 +112,7 @@ public class XSSFColor extends ExtendedColor { public boolean isAuto() { return ctColor.getAuto(); } + /** * @param auto true if the ctColor is automatic and system ctColor dependent. */ |