Java 类net.sf.jasperreports.engine.type.ColorEnum 实例源码

项目:ireport-fork    文件:ColorSchemaGenerator.java   
public static java.awt.Color decodeColor(String colorString)
{
    java.awt.Color color = null;
    char firstChar = colorString.charAt(0);
    if (firstChar == '#')
    {
           color = new java.awt.Color(Integer.parseInt(colorString.substring(1), 16));
    }
    else if ('0' <= firstChar && firstChar <= '9')
    {
           color = new java.awt.Color(Integer.parseInt(colorString));
    }
    else
    {
            if (ColorEnum.getByName(colorString) != null)
            {
                    color = ColorEnum.getByName(colorString).getColor();
            }
            else
            {
                    color = java.awt.Color.black;
            }
    }
    return color;

}
项目:jasperreports    文件:FillStyleItem.java   
@Override
public Object getEvaluatedValue(ItemProperty property, JRFillExpressionEvaluator evaluator, byte evaluation) throws JRException
{
    Object result = super.getEvaluatedValue(property, evaluator, evaluation);
    return PROPERTY_COLOR.equals(property.getName()) 
            ? JRColorUtil.getColorHexa(JRColorUtil.getColor((String)result, ColorEnum.RED.getColor()))
            : result;
}
项目:jasperreports    文件:FillPlaceItem.java   
@Override
public Object getEvaluatedValue(ItemProperty property, JRFillExpressionEvaluator evaluator, byte evaluation) throws JRException
{
    Object result = super.getEvaluatedValue(property, evaluator, evaluation);
    return MapComponent.ITEM_PROPERTY_address.equals(property.getName())
        ? getCoords((String)result)
        : (PROPERTY_COLOR.equals(property.getName()) 
            ? JRColorUtil.getColorHexa(JRColorUtil.getColor((String)result, ColorEnum.RED.getColor()))
            : result);
}
项目:PDFReporter-Studio    文件:ColorSchemaGenerator.java   
/**
 * Given the hexadecimal value of a color, it will be converted into an AWT color object
 * 
 * @param colorString a string representing the hexadecimal value of a color, it can have or not the 
 * starting symbol "#".
 * 
 * @return an AWT color
 */
public static Color decodeColor(String colorString)
{
    java.awt.Color color = null;
    if (colorString == null) return null;
    char firstChar = colorString.charAt(0);
    if (firstChar == '#')
    {
           color = new java.awt.Color(Integer.parseInt(colorString.substring(1), 16));
    }
    else if ('0' <= firstChar && firstChar <= '9')
    {
           color = new java.awt.Color(Integer.parseInt(colorString));
    }
    else
    {
            if (ColorEnum.getByName(colorString) != null)
            {
                    color = ColorEnum.getByName(colorString).getColor();
            }
            else
            {
                    color = java.awt.Color.black;
            }
    }
    return color;

}