package com.gx.obe.evaluation.step.review.action;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;

import com.gx.obe.action.bean.Action;
import com.gx.obe.action.listener.ActionListener;
import com.gx.obe.components.core.Constants;
import com.gx.obe.evaluation.step.composite.FactorEvaluationComposite;
import com.gx.obe.evaluation.step.composite.struct.AiEvaluationComposite;
import com.gx.obe.evaluation.step.composite.struct.EvaluationView;
import com.gx.obe.evaluation.step.listener.ExpertEvaluationListener;
import com.gx.obe.web.entity.evaluation.EvaluationStep;

/**
 * @Description: 指标评审
 * @author guoyr
 */
public class FactorEvaluationAction extends Action {
	public void run(){
		ActionListener actionListener = this.getListener();
		if(null != actionListener){
			actionListener.onLoad(this);
			EvaluationStep evaluationStep = (EvaluationStep)this.getData("evaluationStep");
			Composite composite = actionListener.getParentComposite();
			composite.setData("tenderProjectEntity", this.getData("tenderProjectEntity"));
			composite.setData("evaluationStep", evaluationStep);
			composite.setData("tenderProjectRuleEntity", this.getData("tenderProjectRuleEntity"));
			composite.setData(Constants.CUR_EXPERT, this.getData(Constants.CUR_EXPERT));
			composite.setData("menu",this.getMenu());
//			FactorEvaluationComposite factorEvaluationComposite = new FactorEvaluationComposite(composite, SWT.NONE);
//			factorEvaluationComposite.addExpertEvaluationListener(expertEvaluationListener);
//			actionListener.loadComposite(this, factorEvaluationComposite);
//			
			String evalType = evaluationStep.getEvaluationParamByKey(com.gx.obe.components.core.enumeration.EvaluationStepEnum.EVALUATION_TYPE);
			EvaluationView evaluationView = null;
			if (com.gx.obe.components.core.enumeration.EvaluationStepEnum.EVALUATION_TYPE_AI.equals(evalType)) {
				evaluationView = new AiEvaluationComposite(composite, SWT.NONE);
			}else if (com.gx.obe.components.core.enumeration.EvaluationStepEnum.EVALUATION_TYPE_SINGLE.equals(evalType)) {
				evaluationView = new AiEvaluationComposite(composite, SWT.NONE);
			}else {
				evaluationView = new FactorEvaluationComposite(composite, SWT.NONE);
			}
			evaluationView.addExpertEvaluationListener((ExpertEvaluationListener)this.getData("expertEvaluationListener"));
			actionListener.loadComposite(this, evaluationView);
			
//			
		}
	}
}
