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
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:
-
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
ConstructorsConstructorDescriptionCustomColorHandle
(SimpleValueHandle valueHandle, int index) Constructs the handle of custom color. -
Method Summary
Modifier and TypeMethodDescriptiongetColor()
Returns the color value as what the user has input.Returns the internal display name.Returns the resource key for display name.getName()
Returns the custom color name.Returns the qualified name of this element.int
getRGB()
Returns the color value as an integer RGB value.void
Sets the color value.void
setDisplayName
(String displayName) Sets the display name.void
setDisplayNameID
(String displayNameID) Sets the resource key for display name.void
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
-
Constructor Details
-
CustomColorHandle
Constructs the handle of custom color.- Parameters:
valueHandle
- the value handle for custom color list of one propertyindex
- the position of this custom color in the list
-
-
Method Details
-
getDisplayName
Returns the internal display name.- Returns:
- the internal display name
-
setDisplayName
Sets the display name.- Parameters:
displayName
- the display name to set
-
getDisplayNameID
Returns the resource key for display name.- Returns:
- the resource key for display name.
-
setDisplayNameID
Sets the resource key for display name.- Parameters:
displayNameID
- the resource key for display name
-
getName
Returns the custom color name.- Returns:
- the custom color name
-
getColor
Returns the color value as what the user has input.- Returns:
- the color value as what the user has input.
-
setColor
Sets the color value.- Parameters:
colorValue
- the color value to be set.- Throws:
SemanticException
- value required exception
-
setName
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 isnull
.
-
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.
-