org.eclipse.birt.report.model.api
Class ColorHandle

java.lang.Object
  extended by org.eclipse.birt.report.model.api.ElementDetailHandle
      extended by org.eclipse.birt.report.model.api.ValueHandle
          extended by org.eclipse.birt.report.model.api.ComplexValueHandle
              extended by 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:

 
 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:
ColorUtil, ColorPropertyType

Field Summary
 
Fields inherited from class org.eclipse.birt.report.model.api.ComplexValueHandle
memberRef, propDefn
 
Fields inherited from class org.eclipse.birt.report.model.api.ElementDetailHandle
elementHandle
 
Constructor Summary
ColorHandle(DesignElementHandle element, org.eclipse.birt.report.model.metadata.ElementPropertyDefn thePropDefn)
          Constructs a color handle for a element property.
ColorHandle(DesignElementHandle element, org.eclipse.birt.report.model.core.MemberRef memberRef)
          Constructs a color handle for a member in a structure.
 
Method Summary
 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
getDefn, getDisplayValue, getPropertyDefn, getReference, getStringValue, getValue, isSet, setStringValue, setValue
 
Methods inherited from class org.eclipse.birt.report.model.api.ElementDetailHandle
getDesign, getElement, getElementHandle, getModule
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorHandle

public ColorHandle(DesignElementHandle element,
                   org.eclipse.birt.report.model.core.MemberRef memberRef)
Constructs a color handle for a member in a structure. This member must be a color type.

Parameters:
element - the design element handle
memberRef - the memberRef 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 is null) or the value 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.


Copyright © 2008 Actuate Corp. All rights reserved.