//----------------------------BEGIN LICENSE----------------------------
/* 
 * Willow : the Open Source WorkFlow Project
 * Distributable under GNU LGPL license by gun.org
 *
 * Copyright (C) 2004-2010 huihoo.org 
 * Copyright (C) 2004-2010  ZosaTapo <dertyang@hotmail.com> 
 * 
 * ====================================================================
 * Project Homepage : http://www.huihoo.org/god4j
 * Source Forge     : http://sourceforge.net/projects/huihoo
 * Mailing list     : god4j@lists.sourceforge.net 
 */
//----------------------------END  LICENSE-----------------------------
package org.huihoo.god4j.editor.elements.atoms;
import org.huihoo.god4j.editor.XPDLComplexComponent;
import org.huihoo.god4j.editor.panels.JavaPanel;
/**
* Represents a WfMC DTD element that has the similar name.
*
* @see XPDL
*/
public class XPDLDataType extends XPDLComplexComponent
{
	private XPDLDataTypes refDataTypes;
	/**
	* Creates a new instance of the class.
	*
	* @param p The package which elements holds instance of
	*          of this class.
	*/
	public XPDLDataType(XPDLComplexComponent parent)
	{
		super(parent, "DataType");
	}

	/**
	* Returns the value of choosen type.
	*
	* @return The value of choosen data type.
	*/
	public Object getValue()
	{
		return refDataTypes.getValue();
	}

	public void setValue(Object value)
	{
		refDataTypes.setValue(value);
	}

	public XPDLDataTypes getDataTypes()
	{
		return refDataTypes;
	}

	/**
	* Prepares the panel with a combo box to choose the one of
	* allowed data types.
	*
	* @return XPDLPanel to be shown.
	*/
	public JavaPanel getJavaPanel()
	{
		return refDataTypes.getJavaPanel();
	}
	//==================================================================

	public void initComponent()
	{
		//	-----------------------------------------------
		super.initComponent();
		//	-----------------------------------------------	
		refDataTypes = new XPDLDataTypes(this, 0);
		refDataTypes.initComponent();
		refDataTypes.setRequired(true);

	}

	public void structComponent()
	{
		//	-----------------------------------------------
		super.structComponent();
		//	-----------------------------------------------
		refDataTypes.structComponent();

		complexChildren.add(refDataTypes);
	}

	public void loadComponent()
	{
		//	-----------------------------------------------
		super.loadComponent();
		//	-----------------------------------------------
		refDataTypes.loadComponent();
	}

	public void saveComponent()
	{
    if(isReadOnly())
    {
      return;
    }
    
		//	-----------------------------------------------
		super.saveComponent();
		//	-----------------------------------------------
		refDataTypes.saveComponent();
	}

	//==================================================================
}
