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)
andColorUtil.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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getColor()
Returns the color value as what the user has input.java.lang.String
getDisplayName()
Returns the internal display name.java.lang.String
getDisplayNameID()
Returns the resource key for display name.java.lang.String
getName()
Returns the custom color name.java.lang.String
getQualifiedName()
Returns the qualified name of this element.int
getRGB()
Returns the color value as an integer RGB value.void
setColor(java.lang.String colorValue)
Sets the color value.void
setDisplayName(java.lang.String displayName)
Sets the display name.void
setDisplayNameID(java.lang.String displayNameID)
Sets the resource key for display name.void
setName(java.lang.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
-
-
-
-
Constructor Detail
-
CustomColorHandle
public CustomColorHandle(SimpleValueHandle valueHandle, int index)
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 Detail
-
getDisplayName
public java.lang.String getDisplayName()
Returns the internal display name.- Returns:
- the internal display name
-
setDisplayName
public void setDisplayName(java.lang.String displayName)
Sets the display name.- Parameters:
displayName
- the display name to set
-
getDisplayNameID
public java.lang.String getDisplayNameID()
Returns the resource key for display name.- Returns:
- the resource key for display name.
-
setDisplayNameID
public void setDisplayNameID(java.lang.String displayNameID)
Sets the resource key for display name.- Parameters:
displayNameID
- the resource key for display name
-
getName
public java.lang.String getName()
Returns the custom color name.- Returns:
- the custom color name
-
getColor
public java.lang.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(java.lang.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(java.lang.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 isnull
.
-
getQualifiedName
public java.lang.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.
-
-