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

import org.eclipse.birt.report.model.api.util.StringUtil;
import org.eclipse.birt.report.model.core.DesignElement;
import org.xml.sax.SAXException;

/**
 * This state is for handling the compatibility problem when changing property
 * type. This implementation is about changing from "expression" to "string". In
 * expression type, literal must be quoted with quotes, which is not necessary
 * for string type. So we need to trim quotes for the old version design file.
 */

public class CompatiblePropertyTypeState extends PropertyState
{

	/**
	 * Constructs a <code>CompatiblePropertyTypeState</code> to parse an
	 * pagebreakinterval property.
	 * 
	 * @param theHandler
	 *            the parser handle
	 * @param element
	 *            the element that holds the obsolete property
	 * 
	 */

	public CompatiblePropertyTypeState( ModuleParserHandler theHandler,
			DesignElement element )
	{
		super( theHandler, element );
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.birt.report.model.util.AbstractParseState#end()
	 */

	public void end( ) throws SAXException
	{
		String value = StringUtil.trimQuotes( text.toString( ) );
		doEnd( value );
	}

}
