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
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)and
ColorUtil.format(String, int)to do the formatting work on a color
value.
- See Also:
-
ColorUtilColorPropertyType
-
Field Summary
Fields inherited from class org.eclipse.birt.report.model.api.ComplexValueHandle
memberContext, propDefnFields inherited from class org.eclipse.birt.report.model.api.ElementDetailHandle
elementHandle -
Constructor Summary
ConstructorsConstructorDescriptionColorHandle(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
Modifier and TypeMethodDescriptionReturns a list containing all the names of both standard(CSS) colors or user defined colors.Returns a list containing standard(CSS) color names.Returns a CSS-compatible color value.intgetRGB()Returns the color value as an integer RGB value.voidsetRGB(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, setValueMethods inherited from class org.eclipse.birt.report.model.api.ValueHandle
getReferenceMethods inherited from class org.eclipse.birt.report.model.api.ElementDetailHandle
getDesign, getElement, getElementHandle, getModule
-
Constructor Details
-
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 Details
-
getRGB
public int getRGB()Returns the color value as an integer RGB value. Return-1if color value is not set( value isnull) or thevalueis not a valid internal value for a color.- Returns:
- the color value as an integer RGB value
- See Also:
-
ColorPropertyType.toInteger(Module, Object)
-
setRGB
Sets a color with a given integer RGB value.- Parameters:
rgbValue- rgb color value.- Throws:
SemanticException- if the rgb value is invalid.
-
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
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
Returns a list containing standard(CSS) color names. The names are localized.- Returns:
- a list of localized CSS color names.
-