package jp.co.cybec.laxide.editParts;

import jp.co.cybec.laxide.editParts.extension.LetsAjaxDataTableEditPart;
import jp.co.cybec.laxide.editParts.extension.YuiBasicAnimateJSEditPart;
import jp.co.cybec.laxide.editParts.extension.YuiCalendarJSEditPart;
import jp.co.cybec.laxide.editParts.js.LetsAjaxChartEditPart;
import jp.co.cybec.laxide.editParts.js.LetsAjaxDataTableJSEditPart;
import jp.co.cybec.laxide.editParts.js.LetsAjaxJSControlEditPart;
import jp.co.cybec.laxide.editParts.js.YuiColorAnimateJSEditPart;
import jp.co.cybec.laxide.model.base.LetsAjax2ColumnHeaderLayoutModel;
import jp.co.cybec.laxide.model.base.LetsAjax2ColumnLayoutModel;
import jp.co.cybec.laxide.model.base.LetsAjaxBodyModel;
import jp.co.cybec.laxide.model.base.LetsAjaxButtonModel;
import jp.co.cybec.laxide.model.base.LetsAjaxChartModel;
import jp.co.cybec.laxide.model.base.LetsAjaxCheckBoxModel;
import jp.co.cybec.laxide.model.base.LetsAjaxComboBoxModel;
import jp.co.cybec.laxide.model.base.LetsAjaxImageModel;
import jp.co.cybec.laxide.model.base.LetsAjaxLabelModel;
import jp.co.cybec.laxide.model.base.LetsAjaxLinkButtonModel;
import jp.co.cybec.laxide.model.base.LetsAjaxPlainLayoutModel;
import jp.co.cybec.laxide.model.base.LetsAjaxRadioButtonModel;
import jp.co.cybec.laxide.model.base.LetsAjaxTextAreaModel;
import jp.co.cybec.laxide.model.base.LetsAjaxTextFieldModel;
import jp.co.cybec.laxide.model.base.LetsAjaxTextModel;
import jp.co.cybec.laxide.model.extension.LetsAjaxDataTableModel;
import jp.co.cybec.laxide.model.extension.YuiBasicAnimateModel;
import jp.co.cybec.laxide.model.extension.YuiCalendarModel;
import jp.co.cybec.laxide.model.js.LetsAjaxDataTableJSModel;
import jp.co.cybec.laxide.model.js.LetsAjaxJSControlModel;
import jp.co.cybec.laxide.model.js.YuiColorAnimateJSModel;

import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPartFactory;

/**
 * EditPartクラスを生成するFactoryクラス ファイル名：LetsAjaxEditPartFactory.java
 * 
 * @author nakamura 作成時刻：13:28:17
 * 
 */
public class LetsAjaxEditPartFactory implements EditPartFactory {

	/**
	 * ファクトリーメソッド
	 * 
	 * @see org.eclipse.gef.EditPartFactory#createEditPart(org.eclipse.gef.EditPart,
	 *      java.lang.Object)
	 */
	public EditPart createEditPart(EditPart editPart, Object model) {
		EditPart part = null;

		// モデルの型を調べて対応するEditPartを作成
		if (model instanceof LetsAjaxBodyModel) {
			part = new LetsAjaxBodyEditPart();
		} else if (model instanceof LetsAjaxLabelModel) {
			part = new LetsAjaxLabelEditPart();
		} else if (model instanceof LetsAjaxTextModel) {
			part = new LetsAjaxTextEditPart();
		} else if (model instanceof LetsAjaxButtonModel) {
			part = new LetsAjaxButtonEditPart();
		} else if (model instanceof LetsAjaxTextFieldModel) {
			part = new LetsAjaxTextFieldEditPart();
		} else if (model instanceof LetsAjaxDataTableModel) {
			part = new LetsAjaxDataTableEditPart();
		} else if (model instanceof LetsAjaxTextAreaModel) {
			part = new LetsAjaxTextAreaEditPart();
		} else if (model instanceof LetsAjaxComboBoxModel) {
			part = new LetsAjaxComboBoxEditPart();
		} else if (model instanceof LetsAjaxCheckBoxModel) {
			part = new LetsAjaxCheckBoxEditPart();
		} else if (model instanceof LetsAjaxRadioButtonModel) {
			part = new LetsAjaxRadioButtonEditPart();
		} else if (model instanceof LetsAjaxLinkButtonModel) {
			part = new LetsAjaxLinkButtonEditPart();
		} else if (model instanceof LetsAjaxJSControlModel) {
			part = new LetsAjaxJSControlEditPart();
		} else if (model instanceof LetsAjaxDataTableJSModel) {
			part = new LetsAjaxDataTableJSEditPart();
		} else if (model instanceof LetsAjaxChartModel) {
			part = new LetsAjaxChartEditPart();
		} else if (model instanceof YuiCalendarModel) {
			part = new YuiCalendarJSEditPart();
		} else if (model instanceof YuiBasicAnimateModel) {
			part = new YuiBasicAnimateJSEditPart();
		} else if (model instanceof YuiColorAnimateJSModel) {
			part = new YuiColorAnimateJSEditPart();
		} else if (model instanceof LetsAjaxImageModel) {
			part = new LetsAjaxImageEditPart();
		} else if (model instanceof LetsAjax2ColumnLayoutModel) {
			part = new LetsAjax2ColumnLayoutEditPart();
		} else if (model instanceof LetsAjaxPlainLayoutModel) {
			part = new LetsAjaxPlainLayoutEditPart();
		} else if (model instanceof LetsAjax2ColumnHeaderLayoutModel) {
			part = new LetsAjax2ColumnHeaderLayoutEditPart();
		}
		part.setModel(model); // モデルをEditPartに設定する
		return part;
	}

}
