You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by fa...@apache.org on 2021/12/21 15:55:02 UTC
svn commit: r1896249 - /poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFColor.java
Author: fanningpj
Date: Tue Dec 21 15:55:01 2021
New Revision: 1896249
URL: http://svn.apache.org/viewvc?rev=1896249&view=rev
Log:
add more XSSFColor constructors
Modified:
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFColor.java
Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFColor.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFColor.java?rev=1896249&r1=1896248&r2=1896249&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFColor.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFColor.java Tue Dec 21 15:55:01 2021
@@ -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 ExtendedC
/**
* @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 ExtendedC
/**
* 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 ExtendedC
}
/**
- *
* @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 ExtendedC
}
/**
+ * @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 ExtendedC
public boolean isAuto() {
return ctColor.getAuto();
}
+
/**
* @param auto true if the ctColor is automatic and system ctColor dependent.
*/
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org