package com.gx.obe.evaluation.step.dialog;

import org.eclipse.swt.SWT;
import org.eclipse.swt.core.widgets.EDialog;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;

import com.gx.obe.config.ConfigConstants;
import com.gx.obe.evaluation.step.composite.BidOpenAndEvaluationResultComposite;
import com.gx.obe.message.Messages;
import com.gx.obe.web.entity.tender.TenderProjectEntity;

public class ViewResultDialog extends EDialog {
	
	private final TenderProjectEntity tenderProject;
	private final String viewOpenResult;
	private final String viewEvalResult;
	private final String expertSelfUserId;
	private Composite composite;
	
	/** 
	 * @author chenxw
	 * @param parentShell
	 * @param tenderProject
	 * @param viewOpenResult
	 * @param viewEvalResult
	 * @param expertSelfUserId 
	 */
	public ViewResultDialog (Shell parentShell, TenderProjectEntity tenderProject, String viewOpenResult, String viewEvalResult, String expertSelfUserId) {
		super(parentShell);
		this.setTitle(Messages.Button_viewBidEvaluationResults);
		this.setOperator(SWT.MAX | SWT.CLOSE);
		this.tenderProject = tenderProject;
		this.viewOpenResult = viewOpenResult;
		this.viewEvalResult = viewEvalResult;
		this.expertSelfUserId = expertSelfUserId;
	}
	
	/**
	 * @Description:
	 * @author chenxw
	 * @param parent
	 * @return
	 */
	protected Control createDialogArea(Composite parent) {
		Composite container = (Composite) super.createDialogArea(parent);
		container.setLayout(new GridLayout(1, false));
		
		composite = new Composite(container, SWT.NONE);
		composite.setLayout(new FillLayout(SWT.HORIZONTAL));
		composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
		
		
		viewFinalResultAction();
		return container;
	}
	
	/**
	 * @Description:
	 * @author chenxw
	 */
	private void viewFinalResultAction() {
		
		composite.setData("tenderProject", tenderProject);
		composite.setData("expertSelfUserId", expertSelfUserId);
		composite.setData(ConfigConstants.VIEW_OPEN_RESULT, viewOpenResult);
		composite.setData(ConfigConstants.VIEW_EVAL_RESULT, viewEvalResult);
		new BidOpenAndEvaluationResultComposite(composite, SWT.NONE);
         
//         
//		Action action = (Action) ActionUtil.getAction(BidOpenAndEvaluationResultAction.class.getName());
//		action.setTenderProject(tenderProject);
//		action.setData("expertSelfUserId", expertSelfUserId);
//		action.setData(ConfigConstants.VIEW_OPEN_RESULT, viewOpenResult);
//		action.setData(ConfigConstants.VIEW_EVAL_RESULT, viewEvalResult);
//		action.addActionListener(this);
//		action.run();
	}
	
	/**
	 * @Description:
	 * @author chenxw
	 * @return
	 */
	protected Point getInitialSize() {
		return new Point(900, 600);
	}
}
