package com.gx.obe.management.composite;

import java.util.Date;

import org.eclipse.swt.SWT;
import org.eclipse.swt.core.listener.ChangeTextListener;
import org.eclipse.swt.core.utils.WidgetUtils;
import org.eclipse.swt.core.widgets.ELink;
import org.eclipse.swt.core.widgets.ImageButton;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseTrackAdapter;
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.Label;

import com.gx.obe.ColorConstants;
import com.gx.obe.business.entity.MenuFunction;
import com.gx.obe.business.enumeration.UserEnum;
import com.gx.obe.common.icons.IconsActivator;
import com.gx.obe.common.widget.utils.MenuFunctionUtils;
import com.gx.obe.components.core.Constants;
import com.gx.obe.components.core.I18NEnum;
import com.gx.obe.components.core.enumeration.CommonEnum;
import com.gx.obe.components.core.enumeration.TenderProjectEnum;
import com.gx.obe.listener.ProjectOpListener;
import com.gx.obe.message.Messages;
import com.gx.obe.util.utils.DateUtils;
import com.gx.obe.util.utils.ObjectUtils;
import com.gx.obe.util.utils.StringUtils;
import com.gx.obe.web.entity.tender.TenderProjectEntity;
import com.gx.obe.web.vo.TenderProjectVo;
import com.swtdesigner.ResourceManager;
import com.swtdesigner.SWTResourceManager;

public class TenderProjectItemComposite extends Composite {

	private Label indexLabel;
	private Label tenderNoLabel;
	private ELink tenderNameLabel;
	private CLabel phaseTypeLabel;
	private Label countTitle_label;
	private Label countValue_label;
	private Label tenderTypeValueLabel;
	private Label tenderMethodValueLabel;
	private Label bidOpeningTimeValueLabel;
//	private Label evalTimeValueLabel;
	private ELink deleteBtn;
	public static final String  FORMAT = "yyyy-MM-dd HH:mm";
	private ProjectOpListener listener;
//	private Map<String, Object> projectMap;
//	private int childCount = 0;
	private int supplierCount = 0;
	private ELink goto_btn;
	private CLabel archiveBtn;
 	private TenderProjectEntity tenderProjectEntity;
	private Composite bidOpeningTimeComposite;
	private Composite openingStatusComposite;
	private Composite infoComposite;
	private CLabel label_7;
	private Label openingStatusLabel;
	private ImageButton openingUploadStatusLabel;
	private Composite evalResultComposite;
	private Label evalStatusLabel;
	private ImageButton evalUploadStatusLabel;
	private MenuFunctionUtils menuFunctions;
	private Composite subPackCountComposite;
	private CLabel countSep;
//	private TenderProjectVo tenderProjectVo;
	/**
	 * Create the composite.
	 * @param parent
	 * @param style
	 */
	public TenderProjectItemComposite(Composite parent, MenuFunctionUtils menuFunctions, int style) {
		super(parent, style);
		setBackgroundMode(SWT.INHERIT_FORCE);
		setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		GridLayout gridLayout = new GridLayout(1, false);
		gridLayout.marginHeight = 2;
		gridLayout.marginWidth = 2;
		gridLayout.horizontalSpacing = 0;
		gridLayout.verticalSpacing = 0;
		setLayout(gridLayout);
		this.menuFunctions = menuFunctions;
		Composite composite = new Composite(this, SWT.NONE);
		composite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		composite.setLayout(new GridLayout(7, false));
		GridData gd_composite = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
		gd_composite.widthHint = 700;
		composite.setLayoutData(gd_composite);
		
		Composite composite_2 = new Composite(composite, SWT.NONE);
		composite_2.setBackgroundMode(SWT.INHERIT_FORCE);
		composite_2.setBackground(SWTResourceManager.getColor(255, 153, 51));
		composite_2.setLayout(new GridLayout(1, false));
		
		indexLabel = new Label(composite_2, SWT.NONE);
		indexLabel.setAlignment(SWT.CENTER);
		indexLabel.setFont(SWTResourceManager.getFont("微软雅黑", 12, SWT.BOLD));
		indexLabel.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
//		label_1.setBackground(SWTResourceManager.getColor(255, 153, 51));
//		indexLabel.setText("01");
		
		tenderNoLabel = new Label(composite, SWT.NONE);
		tenderNoLabel.setFont(SWTResourceManager.getFont("微软雅黑", 11, SWT.NORMAL));
		tenderNoLabel.setForeground(ColorConstants.FONT_BLACK_COLOR);
		tenderNoLabel.setText("");
		
		tenderNameLabel = new ELink(composite, SWT.NONE);
		tenderNameLabel.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
		tenderNameLabel.setFont(SWTResourceManager.getFont("微软雅黑", 11, SWT.NORMAL));
		tenderNameLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
		
		goto_btn = new ELink(composite, SWT.NONE);
		goto_btn.setActiveColor(SWTResourceManager.getColor(255, 153, 0));
		goto_btn.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/goto.png"));
		goto_btn.setText(Messages.Enter);
		goto_btn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
		
		deleteBtn = new ELink(composite, SWT.NONE);
		deleteBtn.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/delete.png"));
		deleteBtn.setText(Messages.Button_delete);
		deleteBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
		deleteBtn.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseUp(MouseEvent e) {
				deleteProjectAction();
			}
		});
		menuFunctions.addFunction(deleteBtn, "DELETE_PROJECT");
		
		archiveBtn = new ELink(composite, SWT.NONE);
		archiveBtn.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/tips.png"));
		archiveBtn.setText(Messages.MarkAsClosed);
		archiveBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
		archiveBtn.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseUp(MouseEvent e) {
				archiveAction();
			}
		});
		menuFunctions.addFunction(archiveBtn, "ARCHIVE");
		
		Label label = new Label(this, SWT.NONE);
		label.setBackground(SWTResourceManager.getColor(240, 240, 240));
		GridData gd_label = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
		gd_label.heightHint = 1;
		label.setLayoutData(gd_label);
		
		Composite composite_1 = new Composite(this, SWT.NONE);
		composite_1.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		GridLayout gl_composite_1 = new GridLayout(4, false);
		gl_composite_1.horizontalSpacing = 0;
		gl_composite_1.marginWidth = 0;
		gl_composite_1.marginHeight = 0;
		composite_1.setLayout(gl_composite_1);
		composite_1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
		menuFunctions.addFunction(composite_1, "PHASE_TYPE");
		
		phaseTypeLabel = new CLabel(composite_1, SWT.NONE);
		phaseTypeLabel.setAlignment(SWT.CENTER);
		GridData gd_phaseTypeLabel = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1);
		gd_phaseTypeLabel.widthHint = 32;
		phaseTypeLabel.setLayoutData(gd_phaseTypeLabel);
		phaseTypeLabel.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/phase_type.png"));
		phaseTypeLabel.setText("");
		
		
		infoComposite = new Composite(composite_1, SWT.NONE);
		GridLayout gl_infoComposite = new GridLayout(12, false);
		gl_infoComposite.marginWidth = 0;
		gl_infoComposite.marginHeight = 0;
		infoComposite.setLayout(gl_infoComposite);
		infoComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
		
		countSep = new CLabel(infoComposite, SWT.NONE);
		countSep.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/gv.png"));
		countSep.setText("");
		menuFunctions.addFunction(countSep, "COUNT");
		
		subPackCountComposite = new Composite(infoComposite, SWT.NONE);
		subPackCountComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
		GridLayout gl_subPackCountComposite = new GridLayout(2, false);
		gl_subPackCountComposite.horizontalSpacing = 0;
		gl_subPackCountComposite.marginWidth = 0;
		gl_subPackCountComposite.marginHeight = 0;
		subPackCountComposite.setLayout(gl_subPackCountComposite);
		menuFunctions.addFunction(subPackCountComposite, "COUNT");
		
		countTitle_label = new Label(subPackCountComposite, SWT.NONE);
		countTitle_label.setText(Messages.Package +"：");
		countTitle_label.setForeground(ColorConstants.FONT_BLACK_COLOR);
		
		countValue_label = new Label(subPackCountComposite, SWT.NONE);
		countValue_label.setForeground(SWTResourceManager.getColor(72, 152, 21));
//		countValue_label.setText("2个");
		
		CLabel lab_5 = new CLabel(infoComposite, SWT.NONE);
		lab_5.setAlignment(SWT.CENTER);
		GridData gd_lab_5 = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1);
		gd_lab_5.widthHint = 20;
		lab_5.setLayoutData(gd_lab_5);
		lab_5.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/v_gray.png"));
		lab_5.setText("");
		menuFunctions.addFunction(lab_5, "TENDER_TYPE");
		
		Composite tenderTypeComposite = new Composite(infoComposite, SWT.NONE);
		tenderTypeComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
		GridLayout gl_tenderTypeComposite = new GridLayout(2, false);
		gl_tenderTypeComposite.horizontalSpacing = 0;
		gl_tenderTypeComposite.marginWidth = 0;
		gl_tenderTypeComposite.marginHeight = 0;
		tenderTypeComposite.setLayout(gl_tenderTypeComposite);
		menuFunctions.addFunction(tenderTypeComposite, "TENDER_TYPE");
		
		Label tenderTypeLabel = new Label(tenderTypeComposite, SWT.NONE);
		tenderTypeLabel.setText(Messages.TenderType + "：");
		tenderTypeLabel.setForeground(ColorConstants.FONT_BLACK_COLOR);
		
		tenderTypeValueLabel = new Label(tenderTypeComposite, SWT.NONE);
		tenderTypeValueLabel.setForeground(SWTResourceManager.getColor(72, 152, 21));
//		tenderTypeValueLabel.setText("政府采购");
		
		CLabel label_5 = new CLabel(infoComposite, SWT.NONE);
		label_5.setAlignment(SWT.CENTER);
		GridData gd_label_5 = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1);
		gd_label_5.widthHint = 20;
		label_5.setLayoutData(gd_label_5);
		label_5.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/v_gray.png"));
		label_5.setText("");
		menuFunctions.addFunction(label_5, "TENDER_METHOD");
		
		Composite tenderMethodComposite = new Composite(infoComposite, SWT.NONE);
		tenderMethodComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
		GridLayout gl_tenderMethodComposite = new GridLayout(2, false);
		gl_tenderMethodComposite.horizontalSpacing = 0;
		gl_tenderMethodComposite.marginWidth = 0;
		gl_tenderMethodComposite.marginHeight = 0;
		tenderMethodComposite.setLayout(gl_tenderMethodComposite);
		menuFunctions.addFunction(tenderMethodComposite, "TENDER_METHOD");
		
		Label tenderMethodLabel = new Label(tenderMethodComposite, SWT.NONE);
		tenderMethodLabel.setText(Messages.TenderMethod+"：");
		tenderMethodLabel.setForeground(ColorConstants.FONT_BLACK_COLOR);
		
		tenderMethodValueLabel = new Label(tenderMethodComposite, SWT.NONE);
		tenderMethodValueLabel.setForeground(SWTResourceManager.getColor(72, 152, 21));
//		tenderMethodValueLabel.setText("公开招标   ");
		
		CLabel label_6 = new CLabel(infoComposite, SWT.NONE);
		label_6.setAlignment(SWT.CENTER);
		GridData gd_label_6 = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1);
		gd_label_6.widthHint = 20;
		label_6.setLayoutData(gd_label_6);
		label_6.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/v_gray.png"));
		label_6.setText("");
		menuFunctions.addFunction(label_6, "OPENING_TIME");
		
		bidOpeningTimeComposite = new Composite(infoComposite, SWT.NONE);
		bidOpeningTimeComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
		GridLayout gl_bidOpeningTimeComposite = new GridLayout(2, false);
		gl_bidOpeningTimeComposite.horizontalSpacing = 0;
		gl_bidOpeningTimeComposite.marginWidth = 0;
		gl_bidOpeningTimeComposite.marginHeight = 0;
		bidOpeningTimeComposite.setLayout(gl_bidOpeningTimeComposite);
		menuFunctions.addFunction(bidOpeningTimeComposite, "OPENING_TIME");
		
		Label bidOpeningTimeLabel = new Label(bidOpeningTimeComposite, SWT.NONE);
		bidOpeningTimeLabel.setText(Messages.BidOpeningTime+"：");
		bidOpeningTimeLabel.setForeground(ColorConstants.FONT_BLACK_COLOR);
		
		bidOpeningTimeValueLabel = new Label(bidOpeningTimeComposite, SWT.NONE);
		bidOpeningTimeValueLabel.setForeground(SWTResourceManager.getColor(72, 152, 21));
//		bidOpeningTimeValueLabel.setText("2016-01-17 09:00");
		
		label_7 = new CLabel(infoComposite, SWT.NONE);
		label_7.setAlignment(SWT.CENTER);
		GridData gd_label_7 = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1);
		gd_label_7.widthHint = 20;
		label_7.setLayoutData(gd_label_7);
		label_7.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/v_gray.png"));
		label_7.setText("");
		menuFunctions.addFunction(label_7, "OPENING_STATUS");
		
		openingStatusComposite = new Composite(infoComposite, SWT.NONE);
		openingStatusComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
		GridLayout gl_openingStatusComposite = new GridLayout(3, false);
		gl_openingStatusComposite.horizontalSpacing = 0;
		gl_openingStatusComposite.marginWidth = 0;
		gl_openingStatusComposite.marginHeight = 0;
		openingStatusComposite.setLayout(gl_openingStatusComposite);
		menuFunctions.addFunction(openingStatusComposite, "OPENING_STATUS");
		
		Label bidOpeningStatusTitle = new Label(openingStatusComposite, SWT.NONE);
		bidOpeningStatusTitle.setText(Messages.BidOpeningStatus + ": ");
		bidOpeningStatusTitle.setForeground(ColorConstants.FONT_BLACK_COLOR);
		
		openingStatusLabel = new Label(openingStatusComposite, SWT.NONE);
		openingStatusLabel.setForeground(SWTResourceManager.getColor(100, 100, 100));
//		openingStatusLabel.setText(Messages.OpeningStatus_none);
		
		openingUploadStatusLabel = new ImageButton(openingStatusComposite, SWT.NONE);
		openingUploadStatusLabel.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/update.png"));
	
		CLabel evalStatusSep = new CLabel(infoComposite, SWT.NONE);
		evalStatusSep.setAlignment(SWT.CENTER);
		GridData gd_evalStatusSep = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1);
		gd_evalStatusSep.widthHint = 20;
		evalStatusSep.setLayoutData(gd_evalStatusSep);
		evalStatusSep.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/v_gray.png"));
		evalStatusSep.setText("");
		menuFunctions.addFunction(evalStatusSep, "EVALUATION_STATUS");
		
		evalResultComposite = new Composite(infoComposite, SWT.NONE);
		evalResultComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
		GridLayout gl_evalResultComposite = new GridLayout(3, false);
		gl_evalResultComposite.horizontalSpacing = 0;
		gl_evalResultComposite.marginWidth = 0;
		gl_evalResultComposite.marginHeight = 0;
		evalResultComposite.setLayout(gl_evalResultComposite);
		menuFunctions.addFunction(evalResultComposite, "EVALUATION_STATUS");
		
		Label evalResultLabel = new Label(evalResultComposite, SWT.NONE);
		evalResultLabel.setText(Messages.EvaluationStatus + "：");
		evalResultLabel.setForeground(ColorConstants.FONT_BLACK_COLOR);
		
		evalStatusLabel = new Label(evalResultComposite, SWT.NONE);
		evalStatusLabel.setForeground(SWTResourceManager.getColor(100, 100, 100));
//		evalStatusLabel.setText(Messages.Progress_noStart);
		
		evalUploadStatusLabel = new ImageButton(evalResultComposite, SWT.NONE);
		evalUploadStatusLabel.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/update.png"));
		
		
		init();
	}

	/**
	 * @Description: 初始化
	 * @author guoyr
	 */
	public void init(){
		MyMouseTrackListener myMouseTrackListener = new MyMouseTrackListener();
		setBackgroundColor(this, myMouseTrackListener);
		EnterListener enterListener = new EnterListener();
		tenderNoLabel.addMouseListener(new ChangeTextListener());
		tenderNameLabel.addMouseListener(enterListener);
		goto_btn.addMouseListener(enterListener);
		menuFunctions.refreshFunctionAuthority();
	}
	/**
	 * @Description: 递归设置当前面板的鼠标进入时整个面板的背景颜色
	 * @author guoyr
	 * @param targetComposite
	 * @param myMouseTrackListener 
	 */
	private void setBackgroundColor(Composite targetComposite, MyMouseTrackListener myMouseTrackListener){
		targetComposite.addMouseTrackListener(myMouseTrackListener);
		for(Control contrl : targetComposite.getChildren()){
			if(contrl instanceof Composite){
				setBackgroundColor((Composite)contrl, myMouseTrackListener);
			}else{
				contrl.addMouseTrackListener(myMouseTrackListener);
			}
		}
	}
	
	
	class MyMouseTrackListener extends MouseTrackAdapter{
		@Override
		public void mouseEnter(MouseEvent arg0) {
			setBackground(SWTResourceManager.getColor(255, 153, 51));
		}
		@Override
		public void mouseExit(MouseEvent e) {
			setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		}
	}
	
	class EnterListener extends MouseAdapter{
		@Override
		public void mouseUp(MouseEvent e) {
			enterProjectAction();
			super.mouseUp(e);
		}
	}
	
	public void addProjectOpListener(ProjectOpListener listener){
		this.listener = listener;
	}

	/**
	 * @Description: 进入项目
	 * @author guoyr
	 */
	public void enterProjectAction(){
		listener.enterProject(this.tenderProjectEntity);
	}
	
	
	/**
	 * @Description: 
	 * @author guoyr
	 * @param resultMap
	 */
	public void refresh(int index, TenderProjectVo tenderProjectVo){
		tenderProjectEntity = new TenderProjectEntity();
		tenderProjectEntity.setId(tenderProjectVo.getTenderId());
		tenderProjectEntity.setTenderNo(tenderProjectVo.getTenderNo());
		tenderProjectEntity.setTenderName(tenderProjectVo.getTenderName());
		tenderProjectEntity.setTenderType(tenderProjectVo.getTenderType());
		tenderProjectEntity.setPhaseType(tenderProjectVo.getPhaseType());
		tenderProjectEntity.setIsPack(tenderProjectVo.getIsPack());
		tenderProjectEntity.setUseStatus(tenderProjectVo.getUseStatus());
		tenderProjectEntity.setTenderMethod(tenderProjectVo.getTenderMethod());
		tenderProjectEntity.setRemoteStatus(tenderProjectVo.getRemoteStatus());
		tenderProjectEntity.setChildrenCount(tenderProjectVo.getChildCount());
		tenderProjectEntity.setBidOpeningStatus(tenderProjectVo.getBidOpeningStatus());
		
		if(index < 10){
			indexLabel.setText("0"+index);
		}else {
			indexLabel.setText(""+index);
		}
		boolean showArchiveBtn = false;
		boolean canDelete = false;
		if(CommonEnum.YES.equals(tenderProjectVo.getIsPack())){
			String packageName = com.gx.obe.components.core.I18N.getString(I18NEnum.SUBPACKAGE, tenderProjectVo.getTenderType());
			countTitle_label.setText(packageName+ "：");
			countValue_label.setText(tenderProjectVo.getChildCount()+ Messages.NumCouns);
			WidgetUtils.setControlVisible(openingUploadStatusLabel, false);
			if(tenderProjectVo.getOpeningComplateCount() > 0 && tenderProjectVo.getChildCount() > 0){
				openingStatusLabel.setForeground(SWTResourceManager.getColor(72, 152, 21));
				if(tenderProjectVo.getOpeningComplateCount() >= tenderProjectVo.getChildCount()) {
					openingStatusLabel.setText(Messages.OpeningStatus_opend);
				}else {
					openingStatusLabel.setText(Messages.OpeningStatus_opening +"  "+(int)(tenderProjectVo.getOpeningComplateCount() * 100d /tenderProjectVo.getChildCount())+"%");
				}
			}else {
				canDelete = true;
				openingStatusLabel.setText(Messages.OpeningStatus_none);
			}
			WidgetUtils.setControlVisible(evalUploadStatusLabel, false);
			if(tenderProjectVo.getEvaluationComplateCount() > 0 && tenderProjectVo.getChildCount() > 0){
				evalStatusLabel.setForeground(SWTResourceManager.getColor(72, 152, 21));
				if(tenderProjectVo.getOpeningComplateCount() >= tenderProjectVo.getChildCount()) {
					evalStatusLabel.setText(Messages.Progress_complate);
				}else {
					evalStatusLabel.setText(Messages.Progress_complate +"  "+(int)(tenderProjectVo.getOpeningComplateCount() * 100d /tenderProjectVo.getChildCount())+"%");
				}
			}else {
				evalStatusLabel.setText(Messages.Progress_complate +"  0%");
			}
			if(tenderProjectVo.getChildCount() > 0 && tenderProjectVo.getEvaluationComplateCount() >= tenderProjectVo.getChildCount()){
				showArchiveBtn = true;
			}
		}else {
			WidgetUtils.setControlVisible(subPackCountComposite, false);
			WidgetUtils.setControlVisible(countSep, false);
			countTitle_label.setText(com.gx.obe.components.core.I18N.getString(I18NEnum.SUPPLIERNAME, tenderProjectVo.getTenderType())+ "：");
			supplierCount  = tenderProjectVo.getSupplierCount();
			countValue_label.setText(supplierCount+Messages.SupplierCouns);
			if(CommonEnum.COMPLETE.equals(tenderProjectVo.getBidOpeningStatus())){
				openingStatusLabel.setForeground(SWTResourceManager.getColor(72, 152, 21));
				openingStatusLabel.setText(Messages.OpeningStatus_opend);
				openingUploadStatusLabel.setEnabled(CommonEnum.COMPLETE.equals(tenderProjectVo.getUploadOpeningResultStatus()));
			}else {
				canDelete = true;
				if(CommonEnum.IN_PROGRESS.equals(tenderProjectVo.getBidOpeningStatus())){
					openingStatusLabel.setText(Messages.OpeningStatus_opening);
				}else {
					openingStatusLabel.setText(Messages.OpeningStatus_none);
				}
				openingUploadStatusLabel.setEnabled(false);
			}
			evalUploadStatusLabel.setEnabled(false);
			if(CommonEnum.COMPLETE.equals(tenderProjectVo.getComplateStatus())){
				if(CommonEnum.COMPLETE.equals(tenderProjectVo.getUploadEvaluationResultStatus())){
					evalUploadStatusLabel.setEnabled(true);
				}
				evalStatusLabel.setText(Messages.Progress_complate);
				evalStatusLabel.setForeground(SWTResourceManager.getColor(72, 152, 21));
			}else if(StringUtils.isEmpty(tenderProjectVo.getComplateStatus()) || CommonEnum.NOT_START.equals(tenderProjectVo.getComplateStatus())){
				evalStatusLabel.setText(Messages.Progress_noStart);
			}else {
				evalStatusLabel.setText(Messages.Progress_noComplate);
			}
			if(CommonEnum.COMPLETE.equals(tenderProjectVo.getComplateStatus()) || CommonEnum.ARCHIVE_STATUS.equals(tenderProjectVo.getUseStatus())){
				showArchiveBtn = true;
			}
		}
		if(!canDelete) {
			WidgetUtils.setControlVisible(deleteBtn, false);
			deleteBtn.setEnabled(false);
		}
		showArchiveBtn = false;
		WidgetUtils.setControlVisible(archiveBtn, showArchiveBtn);
		if(CommonEnum.ARCHIVE_STATUS.equals(tenderProjectEntity.getUseStatus())){
			archiveBtn.setText(Messages.MarkAsInProgress);
		}
		if(MenuFunction.SHOW.equals(menuFunctions.getAuthority("DELETE_PROJECT")) && canDelete){
			WidgetUtils.setControlVisible(deleteBtn, true);
		}else {
			WidgetUtils.setControlVisible(deleteBtn, false);
		}
		if(UserEnum.ROLE_TYPE_EVALUATION_MONITOR.equals(Constants.USER.getUserType())){
			WidgetUtils.setControlVisible(deleteBtn, false);
			WidgetUtils.setControlVisible(archiveBtn, false);
		}
		
		if(null != tenderProjectVo.getPhaseType() && tenderProjectVo.getPhaseType().equals(TenderProjectEnum.PHASE_TYPE_PRE)){
			phaseTypeLabel.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/phase_type.png"));
		}else {
			phaseTypeLabel.setImage(null);
		}
		tenderNoLabel.setText("["+tenderProjectVo.getTenderNo() + "]");
		tenderNameLabel.setText(tenderProjectVo.getTenderName());
		
		if(TenderProjectEnum.REMOTE.equals(tenderProjectEntity.getRemoteStatus())){
			tenderTypeValueLabel.setText("全流程");
		}else if(TenderProjectEnum.HALF_PROCESS.equals(tenderProjectEntity.getRemoteStatus())){
			tenderTypeValueLabel.setText("半流程");
		}else if(TenderProjectEnum.LOCAL.equals(tenderProjectEntity.getRemoteStatus())){
			tenderTypeValueLabel.setText("本地新建");
		}else {
			tenderTypeValueLabel.setText("-");
		}
		tenderMethodValueLabel.setText(TenderProjectEnum.getTenderMethodCN(tenderProjectVo.getTenderMethod()));
		bidOpeningTimeValueLabel.setText(ObjectUtils.getObjString(DateUtils.getFormat((Date)tenderProjectVo.getBidOpeningStartTime(), FORMAT)));
		
		WidgetUtils.setControlVisible(deleteBtn, false);
		deleteBtn.setEnabled(false);
		infoComposite.layout();
	}

	/**
	 * 删除项目事件
	 */
	private void deleteProjectAction(){
		if(deleteBtn.getVisible() && deleteBtn.getEnabled()) {
//			listener.deleteProject(this.tenderProjectEntity);
		}
	}

	/**
	 * @Description: 项目隐藏
	 * @author guoyr 
	 */
	private void archiveAction(){
		listener.archiveProject(this.tenderProjectEntity);
	}

	@Override
	protected void checkSubclass() {
	}
}
