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

import org.eclipse.swt.SWT;
import org.eclipse.swt.core.CallBack;
import org.eclipse.swt.core.widgets.EDialog;
import org.eclipse.swt.graphics.Point;
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.evaluation.step.composite.WasteBidProjectStepComposite;
import com.gx.obe.message.Messages;
import com.gx.obe.util.utils.LogUtils;
import com.gx.obe.web.entity.evaluation.EvaluationStep;
import com.gx.obe.web.entity.tender.TenderProjectEntity;
import com.swtdesigner.SWTResourceManager;

/**
 * @Description: 
 * @author wangxiang
 */
public class WasteBidStepDialog extends EDialog {
	
	private TenderProjectEntity tenderProjectEntity;
	private EvaluationStep evaluationStep;
	private WasteBidProjectStepComposite wasteProjectStepComposite;
	private CallBack callBack;

		
	{
		LogUtils.logClass(WasteBidStepDialog.class);
	}

	/**
	 * Create the dialog.
	 * @param parentShell
	 */
	public WasteBidStepDialog(Shell parentShell, TenderProjectEntity tenderProjectEntity, EvaluationStep evaluationStep) {
		super(parentShell);
		setTitle(Messages.Step_wasteBidding);
		this.tenderProjectEntity = tenderProjectEntity;
		this.evaluationStep = evaluationStep;
	}

	/**
	 * Create contents of the dialog.
	 * @param parent
	 */
	@Override
	protected Control createDialogArea(Composite parent) {
		Composite topContainer = (Composite) super.createDialogArea(parent);
		topContainer.setBackground(SWTResourceManager.getColor(247, 247, 247));
		topContainer.setBackgroundMode(SWT.INHERIT_FORCE);
		GridLayout gl_topContainer = new GridLayout(1, false);
		gl_topContainer.verticalSpacing = 0;
		gl_topContainer.horizontalSpacing = 0;
		gl_topContainer.marginHeight = 0;
		gl_topContainer.marginWidth = 0;
		topContainer.setLayout(gl_topContainer);
		
		topContainer.setData("tenderProject", tenderProjectEntity);
		topContainer.setData("evaluationStep", evaluationStep);
		wasteProjectStepComposite = new WasteBidProjectStepComposite(topContainer,  SWT.NONE);
		wasteProjectStepComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
		init();
		return topContainer;
	}

	private void init() {
		wasteProjectStepComposite.setCallBack(callBack);
	}
	public void setCallBack(CallBack callBack) {
		this.callBack = callBack;
	}
	/**
	 * Return the initial size of the dialog.
	 */
	@Override
	protected Point getInitialSize() {
		return new Point(800, 600);
	}
}
