/*******************************************************************************
 * Copyright (c) 2004 Actuate Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  Actuate Corporation  - initial API and implementation
 *******************************************************************************/

package org.eclipse.birt.report.model.script;

import org.eclipse.birt.report.model.api.ColorHandle;

/**
 * Defines a set of methods that support a number of color property type
 * functions.
 *  
 */

public class Color
{

	/**
	 * The property value handle of the color property type.
	 */
	
	ColorHandle colorHandle = null;

	/**
	 * Constructs the color with the value handle of the color property type.
	 * 
	 * @param colorHandle
	 *            the color handle of the color property type
	 */

	public Color( ColorHandle colorHandle )
	{
		this.colorHandle = colorHandle;
	}

	/**
	 * Justifies whether the property value is set to the CSS transparent value.
	 * 
	 * @return true if the property value is null, otherwise false
	 */

	public boolean isTranparent( )
	{
		return colorHandle.getValue( ) == null;
	}

	/**
	 * Gets the color as an RGB value.
	 * 
	 * @return the RGB integer value of the color
	 */

	public int getRGB( )
	{
		return colorHandle.getRGB( );
	}

	/**
	 * Gets the color in the form that can be set in CSS: either a CSS color
	 * name or an RBG value.
	 * 
	 * @return the color value in the form that can be set in CSS: either a CSS
	 *         color name or an RBG value
	 */

	public String getCssValue( )
	{
		return colorHandle.getCssValue( );
	}

	/**
	 * Gets the color as a name (if set as a name) or as a CSS RGB string (if
	 * set as RGB.).
	 * 
	 * @return the color as a name if set as a name or as a CSS RGB string if
	 *         set as RGB
	 */

	public String getValue( )
	{
		return colorHandle.getStringValue( );
	}

}