Class ColorHandle
- java.lang.Object
-
- org.eclipse.birt.report.model.api.ElementDetailHandle
-
- org.eclipse.birt.report.model.api.ValueHandle
-
- org.eclipse.birt.report.model.api.ComplexValueHandle
-
- org.eclipse.birt.report.model.api.ColorHandle
-
public class ColorHandle extends ComplexValueHandle
Handle to work with a color property. Works with element properties and structure members.The application generally does not create color handles directly. It uses the method in other handle to get a color handle like:
A color property may be in the following format:
- A hexadecimal number in Java or HTML format: "#rrggbb", "#rgb" or "0xRRGGBB"
- A decimal number: "16711680"
- A CSS color name: "Red", "Green".
- A localized CSS color name.
- CSS absolute or relative format: {rgb(r,g,b)} or {rgb(r%,g%,b%)}
- A custom defined color.
ColorHandle colorHandle = styleHandle.getColor();
Use
ColorUtil.format(int, int)
andColorUtil.format(String, int)
to do the formatting work on a color value.- See Also:
ColorUtil
,ColorPropertyType
-
-
Field Summary
-
Fields inherited from class org.eclipse.birt.report.model.api.ComplexValueHandle
memberContext, propDefn
-
Fields inherited from class org.eclipse.birt.report.model.api.ElementDetailHandle
elementHandle
-
-
Constructor Summary
Constructors Constructor Description ColorHandle(DesignElementHandle element, org.eclipse.birt.report.model.core.MemberRef context)
Deprecated.ColorHandle(DesignElementHandle element, org.eclipse.birt.report.model.core.StructureContext context)
Constructs a color handle for a member in a structure.ColorHandle(DesignElementHandle element, org.eclipse.birt.report.model.metadata.ElementPropertyDefn thePropDefn)
Constructs a color handle for a element property.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List
getColors()
Returns a list containing all the names of both standard(CSS) colors or user defined colors.java.util.List
getCSSColors()
Returns a list containing standard(CSS) color names.java.lang.String
getCssValue()
Returns a CSS-compatible color value.int
getRGB()
Returns the color value as an integer RGB value.void
setRGB(int rgbValue)
Sets a color with a given integer RGB value.-
Methods inherited from class org.eclipse.birt.report.model.api.ComplexValueHandle
getContext, getDefn, getDisplayValue, getPropertyDefn, getRawValue, getStringValue, getValue, isSet, setStringValue, setValue
-
Methods inherited from class org.eclipse.birt.report.model.api.ValueHandle
getReference
-
Methods inherited from class org.eclipse.birt.report.model.api.ElementDetailHandle
getDesign, getElement, getElementHandle, getModule
-
-
-
-
Constructor Detail
-
ColorHandle
public ColorHandle(DesignElementHandle element, org.eclipse.birt.report.model.core.StructureContext context)
Constructs a color handle for a member in a structure. This member must be a color type.- Parameters:
element
- the design element handlecontext
- the context for the member property
-
ColorHandle
@Deprecated public ColorHandle(DesignElementHandle element, org.eclipse.birt.report.model.core.MemberRef context)
Deprecated.Constructs a color handle for a member in a structure. This member must be a color type.- Parameters:
element
- the design element handlecontext
- the context for the member property
-
ColorHandle
public ColorHandle(DesignElementHandle element, org.eclipse.birt.report.model.metadata.ElementPropertyDefn thePropDefn)
Constructs a color handle for a element property. This property must be a color type.- Parameters:
element
- handle to the element that defined the property.thePropDefn
- definition of the color property.
-
-
Method Detail
-
getRGB
public int getRGB()
Returns the color value as an integer RGB value. Return-1
if color value is not set( value isnull
) or thevalue
is not a valid internal value for a color.- Returns:
- the color value as an integer RGB value
- See Also:
ColorPropertyType.toInteger(Module, Object)
-
setRGB
public void setRGB(int rgbValue) throws SemanticException
Sets a color with a given integer RGB value.- Parameters:
rgbValue
- rgb color value.- Throws:
SemanticException
- if the rgb value is invalid.
-
getCssValue
public java.lang.String getCssValue()
Returns a CSS-compatible color value. It is a CSS-defined color name like "red", or a CSS absolute RGB value like RGB(255,0,0).- Returns:
- a CSS-compatible color value
- See Also:
ColorPropertyType#toCSSCompatibleColor(ReportDesign, Object)
-
getColors
public java.util.List getColors()
Returns a list containing all the names of both standard(CSS) colors or user defined colors. The color names are localized.- Returns:
- a list of localized color names, including both standard(CSS) colors and user defined colors.
-
getCSSColors
public java.util.List getCSSColors()
Returns a list containing standard(CSS) color names. The names are localized.- Returns:
- a list of localized CSS color names.
-
-