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

import java.util.List;

import org.eclipse.swt.SWT;
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 com.gx.obe.evaluation.step.inter.IBidPriceShowTable;
import com.gx.obe.evaluation.step.inter.IPriceShowTable;
import com.gx.obe.web.entity.Supplier;
import com.gx.obe.web.entity.evaluation.EvaluationFactor;
import com.gx.obe.web.entity.evaluation.EvaluationStep;
import com.gx.obe.web.entity.expert.Expert;
import com.gx.obe.web.entity.price.BidPrice;
import com.gx.obe.web.entity.tender.TenderProjectEntity;
import com.gx.obe.web.entity.tender.TenderProjectRuleEntity;
import com.gx.obe.web.service.BidPriceService;
import com.swtdesigner.SWTResourceManager;

public class ShowPriceResultWithOutScoreComposite extends Composite implements IPriceShowTable{
	private BidPriceService bidPriceService ;
	private Expert CURRENT_EXPERT;
	private Composite composite;
	List<BidPrice> bidPriceList;
	private IBidPriceShowTable bidPriceShowTable;
	/**
	 * Create the composite.
	 * @param parent
	 * @param style
	 */
	public ShowPriceResultWithOutScoreComposite(Composite parent, int style) {
		super(parent, style);
		GridLayout gridLayout = new GridLayout(1, false);
		gridLayout.marginHeight = 0;
		gridLayout.marginWidth = 0;
		setLayout(gridLayout);
		
		composite = new Composite(this, SWT.NONE);
		composite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		composite.setLayout(new FillLayout(SWT.HORIZONTAL));
		composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
	}
	/**
	 * @Description: 表格数据加载
	 * @author guoyr
	 */
	public void refreshTable(TenderProjectEntity tenderProjectEntity, TenderProjectRuleEntity tenderProjectRuleEntity, EvaluationStep evaluationStep, Expert curExpert, List<Supplier> supplierList, List<EvaluationFactor> evaluationFactorList, boolean hasFactorWeight){
		if(null == bidPriceService){
			bidPriceService = new BidPriceService();
		}
		List<BidPrice> bidPriceList = bidPriceService.getTenderBidPriceList(tenderProjectEntity.getId());
		if(null != bidPriceList && bidPriceList.size() > 0){
			bidPriceShowTable = new ShowSubBidPriceTableComposite(composite, SWT.NONE);
		}else {
			bidPriceShowTable = new ShowBidPriceTableComposite(composite, SWT.NONE);
		}
		bidPriceShowTable.refreshBidPriceResult(tenderProjectEntity, tenderProjectRuleEntity, supplierList, bidPriceList);
		
	}
	
}
