/*******************************************************************************
 * 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 java.util.List;

import org.mozilla.javascript.ScriptableObject;

/**
 * Represents the scriptable object for <code>PropertyDefinition</code>.
 */

public class NativePropertyDefinition extends ScriptableObject
{

	/**
	 * The class name in JavaScript.
	 */

	public static final String CLASS_NAME = "PropertyDefn"; //$NON-NLS-1$

	/**
	 * Cached property definition.
	 */

	private PropertyDefinition propDefn;

    /**
     * The zero-argument constructor used by Rhino runtime to create instances
     */
    
	public NativePropertyDefinition()
	{}

    
    /**
     * JavaScript function that is the constructor .
     * 
     * @param propDefn a propertyDefinition instance
     */
    
    public void jsConstructor( Object propDefn )
    {
        assert propDefn instanceof PropertyDefinition;
    	this.propDefn = (PropertyDefinition)propDefn;
    }
    
    public boolean jsGet_isUserProperty( )
    {
        return this.propDefn.isUserProperty();
    }
    
    public String jsGet_name( )
    {
        return this.propDefn.getName();
    }
    
    public String jsGet_group( )
    {
        return this.propDefn.getGroup();
    }
    
    public boolean jsGet_isStyle( )
    {
        return this.propDefn.isStyle();
    }
    
    public boolean jsGet_canInherit( )
    {
        return this.propDefn.canInherit();
    }
    
    public String jsGet_type( )
    {
        return this.propDefn.getType();
    }
    
    public List jsGet_choices( )
    {
        return this.propDefn.getChoices();
    }
    
    public Object jsGet_defaultValue( )
    {
        return this.propDefn.getDefaultValue();
    }
	
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.mozilla.javascript.ScriptableObject#getClassName()
	 */
	public String getClassName( )
	{
		return CLASS_NAME;
	}
}