Package org.eclipse.birt.report.model.api

# Class CustomColorHandle

java.lang.Object
org.eclipse.birt.report.model.api.ElementDetailHandle
org.eclipse.birt.report.model.api.ValueHandle
org.eclipse.birt.report.model.api.StructureHandle
org.eclipse.birt.report.model.api.CustomColorHandle

public class CustomColorHandle extends StructureHandle
Represents the handle of custom color. The developer can define a set of custom color names as part of the design. The developer can then reference these names within properties.

Every custom color has three parts: a display name, an internal name and a color value.

Name
  a custom color has a unique and required name, so the user can use the color name to identify a custom color.
color
  The color value of the color, it is preserved as the user typed in.
Resource Key
  a custom color has an optional display name ID to localize the display name.

The color value can contain any of the valid color representations:

- INT_FORMAT: An integer with a valid RGB color value.
- HTML_FORMAT: ( #RRGGBB or #RGB )
- JAVA_FORMAT: ( 0xRRGGBB )
- CSS_ABSOLUTE_FORMAT: ( RGB(r,g,b) )
- CSS_RELATIVE_FORMAT: ( RGB(r%,g%,b%) )

If the color value is in one of the format, then it is meaningful to retrieve it as integer RGB value. Otherwise the color value is treat just as what the user has entered, and can not be converted into an RGB value.

Use `ColorUtil.format(int, int)`and `ColorUtil.format(String, int)`to do the formatting work on a color value.

See Also:
  - `ColorUtil`

## Field Summary

### Fields inherited from class org.eclipse.birt.report.model.api.StructureHandle

`structContext`

### Fields inherited from class org.eclipse.birt.report.model.api.ElementDetailHandle

`elementHandle`

## Constructor Summary

Constructors
Constructor
Description
`CustomColorHandle(SimpleValueHandle valueHandle, int index)`
Constructs the handle of custom color.

## Method Summary

Modifier and Type
Method
Description
`String`
`getColor()`
Returns the color value as what the user has input.
`String`
`getDisplayName()`
Returns the internal display name.
`String`
`getDisplayNameID()`
Returns the resource key for display name.
`String`
`getName()`
Returns the custom color name.
`String`
`getQualifiedName()`
Returns the qualified name of this element.
`int`
`getRGB()`
Returns the color value as an integer RGB value.
`void`
`setColor(String colorValue)`
Sets the color value.
`void`
`setDisplayName(String displayName)`
Sets the display name.
`void`
`setDisplayNameID(String displayNameID)`
Sets the resource key for display name.
`void`
`setName(String name)`
Sets the custom color name.

### Methods inherited from class org.eclipse.birt.report.model.api.StructureHandle

`drop, getContext, getDefn, getExpressionProperty, getExternalizedValue, getExternalizedValue, getIntProperty, getMember, getProperty, getPropertyDefn, getStringProperty, getStructure, isDesignTime, isLocal, iterator, setDesignTime, setExpressionProperty, setProperty, setPropertySilently`

### 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`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### CustomColorHandle

public CustomColorHandle(SimpleValueHandle valueHandle, int index)
Constructs the handle of custom color.

Parameters:
  `valueHandle` - the value handle for custom color list of one property
  `index` - the position of this custom color in the list

## Method Details

### getDisplayName

public String getDisplayName()
Returns the internal display name.

Returns:
  the internal display name

### setDisplayName

public void setDisplayName(String displayName)
Sets the display name.

Parameters:
  `displayName` - the display name to set

### getDisplayNameID

public String getDisplayNameID()
Returns the resource key for display name.

Returns:
  the resource key for display name.

### setDisplayNameID

public void setDisplayNameID(String displayNameID)
Sets the resource key for display name.

Parameters:
  `displayNameID` - the resource key for display name

### getName

public String getName()
Returns the custom color name.

Returns:
  the custom color name

### getColor

public String getColor()
Returns the color value as what the user has input.

Returns:
  the color value as what the user has input.

### setColor

public void setColor(String colorValue) throws SemanticException
Sets the color value.

Parameters:
  `colorValue` - the color value to be set.
Throws:
  `SemanticException` - value required exception

### setName

public void setName(String name) throws SemanticException
Sets the custom color name.

Parameters:
  `name` - the custom color name to set
Throws:
  `SemanticException` - value required exception

### getRGB

public int getRGB()
Returns the color value as an integer RGB value. If the color value is of a valid color representation, then return its numeric RGB value as integer. Otherwise, return `-1` indicates that the value is not valid.

The color value can contain any of the valid color representations:

- INT_FORMAT: An integer with a valid RGB color value.
- HTML_FORMAT: ( #RRGGBB or #RGB )
- JAVA_FORMAT: ( 0xRRGGBB )
- CSS_ABSOLUTE_FORMAT: ( RGB(r,g,b) )
- CSS_RELATIVE_FORMAT: ( RGB(r%,g%,b%) )

Returns:
  the color value as an integer RGB value. Return `-1` if the color value is not valid or the color value is `null`.

### getQualifiedName

public String getQualifiedName()
Returns the qualified name of this element. The qualified name is the name of this element if this element is in module user is editing.

Returns:
  the qualified name of thie element.