mirror of https://github.com/apache/poi.git
add more XSSFColor constructors
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1896249 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a2dbbd7748
commit
0b871a08c5
|
@ -22,7 +22,6 @@ import org.apache.poi.ss.usermodel.Color;
|
||||||
import org.apache.poi.ss.usermodel.ExtendedColor;
|
import org.apache.poi.ss.usermodel.ExtendedColor;
|
||||||
import org.apache.poi.ss.usermodel.IndexedColors;
|
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||||
import org.apache.poi.util.Internal;
|
import org.apache.poi.util.Internal;
|
||||||
import org.apache.poi.util.Removal;
|
|
||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor;
|
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 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
|
* @return null if color is null, new instance otherwise
|
||||||
*/
|
*/
|
||||||
public static XSSFColor from(CTColor color, IndexedColorMap map) {
|
public static XSSFColor from(CTColor color, IndexedColorMap map) {
|
||||||
return color == null ? null : new XSSFColor(color, 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) {
|
private XSSFColor(CTColor color, IndexedColorMap map) {
|
||||||
this.ctColor = color;
|
this.ctColor = color;
|
||||||
this.indexedColorMap = map;
|
this.indexedColorMap = map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since POI 5.2.0
|
||||||
|
*/
|
||||||
|
public XSSFColor() {
|
||||||
|
this(CTColor.Factory.newInstance(), null);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* new color with the given indexed color map
|
* 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) {
|
public XSSFColor(IndexedColorMap colorMap) {
|
||||||
this(CTColor.Factory.newInstance(), colorMap);
|
this(CTColor.Factory.newInstance(), colorMap);
|
||||||
|
@ -57,7 +72,7 @@ public class XSSFColor extends ExtendedColor {
|
||||||
/**
|
/**
|
||||||
* TEST ONLY
|
* TEST ONLY
|
||||||
* @param clr awt Color
|
* @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) {
|
public XSSFColor(java.awt.Color clr, IndexedColorMap map) {
|
||||||
this(map);
|
this(map);
|
||||||
|
@ -65,15 +80,22 @@ public class XSSFColor extends ExtendedColor {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param rgb The RGB-byte-values for the Color
|
* @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) {
|
public XSSFColor(byte[] rgb, IndexedColorMap colorMap) {
|
||||||
this(CTColor.Factory.newInstance(), colorMap);
|
this(CTColor.Factory.newInstance(), colorMap);
|
||||||
ctColor.setRgb(rgb);
|
ctColor.setRgb(rgb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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 indexedColor color index (Enum named for default colors)
|
||||||
* @param colorMap The IndexedColorMap to use instead of the default one
|
* @param colorMap The IndexedColorMap to use instead of the default one
|
||||||
|
@ -90,6 +112,7 @@ public class XSSFColor extends ExtendedColor {
|
||||||
public boolean isAuto() {
|
public boolean isAuto() {
|
||||||
return ctColor.getAuto();
|
return ctColor.getAuto();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param auto true if the ctColor is automatic and system ctColor dependent.
|
* @param auto true if the ctColor is automatic and system ctColor dependent.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue