/*******************************************************************************
 * 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.elements;

import java.util.List;

import org.eclipse.birt.report.model.api.DesignElementHandle;
import org.eclipse.birt.report.model.api.ReportItemThemeHandle;
import org.eclipse.birt.report.model.api.elements.ReportDesignConstants;
import org.eclipse.birt.report.model.api.metadata.IPredefinedStyle;
import org.eclipse.birt.report.model.api.util.StringUtil;
import org.eclipse.birt.report.model.core.DesignElement;
import org.eclipse.birt.report.model.core.Module;
import org.eclipse.birt.report.model.elements.interfaces.IReportItemThemeModel;
import org.eclipse.birt.report.model.metadata.MetaDataDictionary;

/**
 * This class represents a theme in the library.
 * 
 */

public class ReportItemTheme extends AbstractTheme
		implements
			IReportItemThemeModel
{

	/**
	 * Constructor.
	 */

	public ReportItemTheme( )
	{
		super( );
	}

	/**
	 * Constructor with the element name.
	 * 
	 * @param theName
	 *            the element name
	 */

	public ReportItemTheme( String theName )
	{
		super( theName );
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.eclipse.birt.report.model.core.DesignElement#apply(org.eclipse.birt
	 * .report.model.elements.ElementVisitor)
	 */

	public void apply( ElementVisitor visitor )
	{
		visitor.visitReportItemTheme( this );
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.birt.report.model.core.DesignElement#getElementName()
	 */

	public String getElementName( )
	{
		return ReportDesignConstants.REPORT_ITEM_THEME_ELEMENT;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.eclipse.birt.report.model.api.core.IDesignElement#getHandle(org.eclipse
	 * .birt.report.model.core.Module)
	 */

	public DesignElementHandle getHandle( Module module )
	{
		return handle( module );
	}

	/**
	 * Returns an API handle for this element.
	 * 
	 * @param module
	 *            the report design of the row
	 * 
	 * @return an API handle for this element
	 */

	public ReportItemThemeHandle handle( Module module )
	{
		if ( handle == null )
		{
			handle = new ReportItemThemeHandle( module, this );
		}
		return (ReportItemThemeHandle) handle;
	}

	public static boolean isValidType( String type )
	{
		if ( StringUtil.isBlank( type ) )
			return false;
		List<IPredefinedStyle> styles = MetaDataDictionary.getInstance( )
				.getPredefinedStyles( type );
		if ( styles == null || styles.isEmpty( ) )
			return false;
		return true;
	}

	public String getType( Module module )
	{
		return getStringProperty( module, TYPE_PROP );
	}

  
    /* (non-Javadoc)
     * @see org.eclipse.birt.report.model.core.ReferenceableElement#dropClient(org.eclipse.birt.report.model.core.DesignElement)
     */
    public  synchronized void dropClient( DesignElement client )
    {     
       adapter.dropClient( client, (String) null );      
    }


    public synchronized void dropClient( DesignElement client, String propName )
    {
       adapter.dropClient( client, propName );
    }
	
	
}

@@ -3031,455 +3031,7 @@
 ;%0A%09%7D
-%0A%0A  %0A    /* (non-Javadoc)%0A     * @see org.eclipse.birt.report.model.core.ReferenceableElement#dropClient(org.eclipse.birt.report.model.core.DesignElement)%0A     */%0A    public  synchronized void dropClient( DesignElement client )%0A    %7B     %0A       adapter.dropClient( client, (String) null );      %0A    %7D%0A%0A%0A    public synchronized void dropClient( DesignElement client, String propName )%0A    %7B%0A       adapter.dropClient( client, propName );%0A    %7D%0A%09%0A%09
 %0A%7D%0A

remove the patch in ReportItemTheme for theme slot is supported in report design.