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

import java.math.BigDecimal;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.eclipse.swt.SWT;
import org.eclipse.swt.core.widgets.EDialog;
import org.eclipse.swt.core.widgets.ELink;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Scale;
import org.eclipse.swt.widgets.Shell;
import org.swtchart.Chart;
import org.swtchart.ILineSeries;
import org.swtchart.ILineSeries.PlotSymbolType;
import org.swtchart.ISeries;
import org.swtchart.ISeries.SeriesType;
import org.swtchart.LineStyle;

import com.gx.obe.business.entity.SupplierEvaluationStep;
import com.gx.obe.common.icons.IconsActivator;
import com.gx.obe.common.widget.dialog.SelectChartExpertDialog;
import com.gx.obe.common.widget.dialog.SelectChartSupplierDialog;
import com.gx.obe.common.widget.listener.SelectExpertListener;
import com.gx.obe.common.widget.listener.SelectSupplierListener;
import com.gx.obe.components.core.I18NEnum;
import com.gx.obe.components.core.enumeration.CommonEnum;
import com.gx.obe.message.Messages;
import com.gx.obe.util.utils.BigDecimalUtils;
import com.gx.obe.util.utils.LogUtils;
import com.gx.obe.web.entity.Supplier;
import com.gx.obe.web.entity.auth.AuthUser;
import com.gx.obe.web.entity.evaluation.EvaluationStep;
import com.gx.obe.web.entity.expert.Expert;
import com.gx.obe.web.entity.expert.ExpertEvaluationResult;
import com.gx.obe.web.entity.tender.TenderProjectEntity;
import com.gx.obe.web.service.SupplierEvaluationStepService;
import com.gx.obe.web.service.SupplierService;
import com.gx.obe.web.service.expert.ExpertEvaluationResultService;
import com.gx.obe.web.service.expert.ExpertService;
import com.swtdesigner.ResourceManager;

/**
 * @Description: 选择供应商
 * @author guoyr
 */
public class SupplierExpertScoreDialog extends EDialog {
	private List<Supplier> defaultSupplierList;
	private List<Expert> defaultExpertList;
	private List<Supplier> configSupplierList;
	private List<Expert> configExpertList;
	private ExpertService expertService ;
	private EvaluationStep evaluationStep;
	private SupplierEvaluationStepService supplierEvaluationStepService ;
	private ExpertEvaluationResultService expertEvaluationResultService;
	private SupplierService supplierService = new SupplierService(); 
	private TenderProjectEntity tenderProjectEntity;
	private Chart chart;
	private Composite composite;
	private List<Color> colorList = new ArrayList<Color>();
	private Color avgScoreLineColor = ResourceManager.getColor(140, 200, 186);
	private ScrolledComposite scrolledComposite;
	private Map<String, Map<String, ExpertEvaluationResult>> supplierExpertEvaluationResultMap ;
	private Composite composite_1;
	private String supplierName;
	private BigDecimal HightScore = BigDecimal.ZERO;
	private int plotSymbolTypeIndex = 0;
	List<PlotSymbolType> plotSymbolTypeList = new ArrayList<PlotSymbolType>();
	private Button switchLineStyle_button;
	private String avgString = "平均线";
	private int symbolSize = 4;
	private Scale scale;
	{
		LogUtils.logClass(SupplierExpertScoreDialog.class);
	}
	
	/**
	 * 
	 * Create the dialog.
	 * @param parentShell
	 */
	public SupplierExpertScoreDialog(Shell parentShell, TenderProjectEntity tenderProjectEntity, EvaluationStep evaluationStep) {
		super(parentShell);
		this.evaluationStep = evaluationStep;
		this.tenderProjectEntity = tenderProjectEntity;
		this.setShellTrim();
		this.setOperator(SWT.MAX | SWT.CLOSE);
		supplierName = com.gx.obe.components.core.I18N.getString(I18NEnum.SUPPLIERNAME, tenderProjectEntity.getTenderType());
		setTitle(Messages.Button_analysisScoreDispersion);
		
	}

	/**
	 * Create contents of the dialog.
	 * @param parent
	 */
	@Override
	protected Control createDialogArea(Composite parent) {
		Composite container = (Composite) super.createDialogArea(parent);
		container.setLayout(new GridLayout(1, false));
		
		composite_1 = new Composite(container, SWT.NONE);
		GridLayout gl_composite_1 = new GridLayout(7, false);
		gl_composite_1.marginHeight = 0;
		composite_1.setLayout(gl_composite_1);
		composite_1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
		
		switchLineStyle_button = new Button(composite_1, SWT.CHECK);
		switchLineStyle_button.setText(Messages.Button_showLine);
		switchLineStyle_button.addMouseListener(new MouseAdapter() {
			public void mouseUp(MouseEvent e) {
				switchLineStyle();
			}
		});
		Label label = new Label(composite_1, SWT.NONE);
		label.setText(Messages.Small);
		
		scale = new Scale(composite_1, SWT.NONE);
		scale.addListener(SWT.Selection, new Listener() { 
			public void handleEvent(Event event) { 
				swithSymbolSize(scale.getSelection());
				
			} 
		});
		scale.setMinimum(4);
		scale.setMaximum(30);
		Label label_1 = new Label(composite_1, SWT.NONE);
		label_1.setText(Messages.Big);
		
		
		
		ELink switchSymble_button = new ELink(composite_1, SWT.NONE);
		switchSymble_button.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
		switchSymble_button.addMouseListener(new MouseAdapter() {
			public void mouseUp(MouseEvent e) {
				switchStyle();
			}
		});
		switchSymble_button.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/change.png"));
		switchSymble_button.setText(Messages.Button_changeStyles);
		
		
		
		ELink config_supplier = new ELink(composite_1, SWT.NONE);
		config_supplier.addMouseListener(new MouseAdapter() {
			public void mouseUp(MouseEvent e) {
				selectSupplierList();
			}
		});
		config_supplier.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/config.png"));
		config_supplier.setText(MessageFormat.format(Messages.Button_selectFormat, supplierName));
		
		ELink config_expert = new ELink(composite_1, SWT.NONE);
		config_expert.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/config.png"));
		config_expert.setText(MessageFormat.format(Messages.Button_selectFormat, Messages.Expert));
		config_expert.addMouseListener(new MouseAdapter() {
			public void mouseUp(MouseEvent e) {
				selectExpertList();
			}
		});
		
		scrolledComposite = new ScrolledComposite(container, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
		scrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
		scrolledComposite.setExpandHorizontal(true);
		scrolledComposite.setExpandVertical(true);
		
		composite = new Composite(scrolledComposite, SWT.NONE);
		scrolledComposite.setContent(composite);
		GridLayout gl_composite = new GridLayout(1, false);
		gl_composite.verticalSpacing = 0;
		gl_composite.horizontalSpacing = 0;
		gl_composite.marginHeight = 0;
		gl_composite.marginWidth = 0;
		composite.setLayout(gl_composite);
		scrolledComposite.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
		init();
		return container;
	}
	
	/**
	 * @Description: 初始化界面
	 */
	private void init(){
		expertEvaluationResultService = new ExpertEvaluationResultService();
		expertService = new ExpertService();
		supplierEvaluationStepService = new SupplierEvaluationStepService();
		
		plotSymbolTypeList.add(PlotSymbolType.CIRCLE);
		plotSymbolTypeList.add(PlotSymbolType.CROSS);
		plotSymbolTypeList.add(PlotSymbolType.DIAMOND);
		plotSymbolTypeList.add(PlotSymbolType.INVERTED_TRIANGLE);
		plotSymbolTypeList.add(PlotSymbolType.PLUS);
		plotSymbolTypeList.add(PlotSymbolType.SQUARE);
		plotSymbolTypeList.add(PlotSymbolType.TRIANGLE);
		defaultSupplierList = supplierService.getEvaluationStepSupplierList(tenderProjectEntity.getId(), evaluationStep);
		defaultExpertList = expertService.getEvaluationStepExpertList(tenderProjectEntity.getId(), evaluationStep);
		configSupplierList = defaultSupplierList;
		configExpertList = defaultExpertList;
		setColor();
		initData();
		loadChartList(configSupplierList, configExpertList);
		
		
	}
	/**
	 * @Description: 设置离散点图标大小
	 * @author guoyr 
	 */
	private void swithSymbolSize(int tempSymbolSize){
		symbolSize = tempSymbolSize;
		ISeries[] series = chart.getSeriesSet().getSeries();
		for(ISeries iseries : series){
			ILineSeries lineSeries = (ILineSeries)iseries;
			if(!"".equals(lineSeries.getDescription()) && !avgString.equals(lineSeries.getDescription())){
				lineSeries.setSymbolSize(symbolSize);
			
			}
		}
		chart.redraw();
		composite.layout();
	}
	/**
	 * @Description: 切换离散点之间连线样式
	 * @author guoyr 
	 */
	private void switchLineStyle(){
		ISeries[] series = chart.getSeriesSet().getSeries();
		for(ISeries iseries : series){
			ILineSeries lineSeries = (ILineSeries)iseries;
			if(!"".equals(lineSeries.getDescription()) && !avgString.equals(lineSeries.getDescription())){
				if(switchLineStyle_button.getSelection()){
					lineSeries.setLineStyle(LineStyle.SOLID);
				}else{
					lineSeries.setLineStyle(LineStyle.NONE);
				}
				
			}
		}
		chart.redraw();
		composite.layout();
	}
	/**
	 * @Description: 切换离散点样式
	 * @author guoyr 
	 */
	private void switchStyle(){
		plotSymbolTypeIndex = plotSymbolTypeIndex + 1;
		if(plotSymbolTypeIndex >= plotSymbolTypeList.size()){
			plotSymbolTypeIndex = plotSymbolTypeIndex - plotSymbolTypeList.size();
		}
		ISeries[] series = chart.getSeriesSet().getSeries();
		for(ISeries iseries : series){
			ILineSeries lineSeries = (ILineSeries)iseries;
			if(!"".equals(lineSeries.getDescription())){
				lineSeries.setSymbolType(plotSymbolTypeList.get(plotSymbolTypeIndex));
			}
		}
		chart.redraw();
		composite.layout();
	}
	/**
	 * @Description: 设置默认样式颜色
	 * @author guoyr 
	 */
	private void setColor(){
		colorList.add(ResourceManager.getColor(255, 0, 0 ));
		colorList.add(ResourceManager.getColor(0, 255, 0));
		colorList.add(ResourceManager.getColor(0, 0, 255));
		colorList.add(ResourceManager.getColor(255, 255, 0));
		colorList.add(ResourceManager.getColor(255, 0, 255));
		colorList.add(ResourceManager.getColor(0, 255, 255));
		colorList.add(ResourceManager.getColor(0, 0, 0));
		
	}
	/**
	 * @Description: 加载图表
	 * @author guoyr
	 * @param expert
	 * @param factorList
	 * @param curSupplierList 
	 */
	private void loadChartList(List<Supplier> supplierList, List<Expert> expertList){
		HightScore = BigDecimal.ZERO;
		if(null != chart && !chart.isDisposed()){
			chart.dispose();
		}
		
		chart = new Chart(composite, SWT.NONE);
		chart.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
		chart.setBackgroundMode(SWT.INHERIT_FORCE);
		chart.getTitle().setText(evaluationStep.getStepName());
		chart.getAxisSet().getYAxis(0).getTitle().setText(Messages.Score);
	    chart.getAxisSet().getXAxis(0).getTitle().setText(supplierName);
		chart.getAxisSet().getXAxis(0).enableCategory(true);
        chart.getAxisSet().getXAxis(0).setCategorySeries(getX(supplierList));
        if(supplierList.size() > 3){
        	chart.getAxisSet().getXAxis(0).getTick().setTickLabelAngle(45);
        }else {
        	chart.getAxisSet().getXAxis(0).getTick().setTickLabelAngle(0);
        }
     	Integer[] firstValue = new Integer[]{255, 100, 0};
     	Integer[] secondValue = new Integer[]{0, 255, 0};
     	Integer[] thirdValue = new Integer[]{0, 0, 255};
     	
     	int expertrIndex = 0;
     	int size = 40;
        for(Expert expert : expertList){
        	double[] ySeries = new double[supplierList.size()];
        	AuthUser user = expert.getUser();
			int supplierIndex = 0; 
			for(Supplier supplier : supplierList){
				Map<String, ExpertEvaluationResult> expertEvaluationResultMap = supplierExpertEvaluationResultMap.get(supplier.getId());
				ExpertEvaluationResult expertEvaluationResult = expertEvaluationResultMap.get(user.getId());
				if(null != expertEvaluationResult && null != expertEvaluationResult.getEvaluationScore()){
					
					if(HightScore.compareTo(expertEvaluationResult.getEvaluationScore()) < 0){
						HightScore = expertEvaluationResult.getEvaluationScore();
					}
					ySeries[supplierIndex] = expertEvaluationResult.getEvaluationScore().doubleValue();
					
				}else{
					ySeries[supplierIndex] = 0;
				}
				supplierIndex ++;
			}
			ILineSeries expertSeries = (ILineSeries) chart.getSeriesSet().createSeries(SeriesType.LINE, user.getUserName());
			expertSeries.setYSeries(ySeries);
			if(expertrIndex >= colorList.size()){
				int result =(expertrIndex - colorList.size()) % 3;
				if(result == 0){
					if(firstValue[0] - size > 0 && firstValue[1] + size < 255 && firstValue[2] + size < 255){
						firstValue[0] = firstValue[0] - size;
						firstValue[1] = firstValue[1] + size;
						firstValue[2] = firstValue[2] + size;
						
					}
					expertSeries.setLineColor(ResourceManager.getColor(firstValue[0], firstValue[1], firstValue[2]));//设置线颜色
					expertSeries.setSymbolColor(ResourceManager.getColor(firstValue[0], firstValue[1], firstValue[2]));//设置值点颜色
				}else if(result == 1){
					if(secondValue[0] + size < 255 && secondValue[1] - size > 0 && secondValue[2] + size < 255 ){
						secondValue[0] = secondValue[0] + size;
						secondValue[1] = secondValue[1] - size;
						secondValue[2] = secondValue[2] + size;
					}
					expertSeries.setLineColor(ResourceManager.getColor(secondValue[0], secondValue[1], secondValue[2]));//设置线颜色
					expertSeries.setSymbolColor(ResourceManager.getColor(secondValue[0], secondValue[1], secondValue[2]));//设置值点颜色
				}else if(secondValue[0] + size < 255 && secondValue[2] - size > 0 && secondValue[1] + size < 255 ){
					if(thirdValue[1] - size > 0 && thirdValue[2] + size < 255){
						thirdValue[2] = thirdValue[2] - size;
						thirdValue[1] = thirdValue[1] + size;
						thirdValue[0] = thirdValue[0] + size;
					}
					expertSeries.setLineColor(ResourceManager.getColor(thirdValue[0], thirdValue[1], thirdValue[2]));//设置线颜色
					expertSeries.setSymbolColor(ResourceManager.getColor(thirdValue[0], thirdValue[1], thirdValue[2]));//设置值点颜色
				}
			}else{
				expertSeries.setLineColor(colorList.get(expertrIndex));//设置线颜色
				expertSeries.setSymbolColor(colorList.get(expertrIndex));//设置值点颜色
			}
			expertSeries.setSymbolSize(symbolSize);
			expertSeries.setLineWidth(3);	
			expertSeries.setLineStyle(LineStyle.NONE);
			expertrIndex ++;
        }
       final double[] avgSeries = new double[supplierList.size()];
    	int[] numberChart= new int[supplierList.size()];
        for(Expert expert : defaultExpertList){
        	AuthUser user = expert.getUser();
			int supplierIndex = 0; 
			for(Supplier supplier : supplierList){
				Map<String, ExpertEvaluationResult> expertEvaluationResultMap = supplierExpertEvaluationResultMap.get(supplier.getId());
				ExpertEvaluationResult expertEvaluationResult = expertEvaluationResultMap.get(user.getId());
				if(null != expertEvaluationResult && null != expertEvaluationResult.getEvaluationScore()){
					avgSeries[supplierIndex] = avgSeries[supplierIndex] + expertEvaluationResult.getEvaluationScore().doubleValue();
					numberChart[supplierIndex] = numberChart[supplierIndex] +1;
				}
				supplierIndex ++;
			}
        }
        
        for(int i = 0; i < avgSeries.length; i++ ){
			avgSeries[i] = avgSeries[i] / numberChart[i];
		}
    	final ILineSeries avgseries = (ILineSeries) chart.getSeriesSet().createSeries(SeriesType.LINE, avgString);
    	avgseries.setDescription(avgString);
		avgseries.setYSeries(avgSeries);
		avgseries.enableArea(true);
		avgseries.setLineWidth(2);
		avgseries.setLineColor(avgScoreLineColor);
		avgseries.setSymbolColor(avgScoreLineColor);
        
		//隐藏线，避免满分线在最顶端，导致部分数据显示不全
		double[] hignseriesValue = new double[supplierList.size()]; 
		HightScore = BigDecimalUtils.add(HightScore, new BigDecimal(5));//顶线分数，满分线再加上2
		for(int i = 0 ; i < hignseriesValue.length; i++){
			hignseriesValue[i] = HightScore.doubleValue();
		}
		ILineSeries hignseries = (ILineSeries) chart.getSeriesSet().createSeries(SeriesType.LINE, ".");
		hignseries.setDescription("");
		hignseries.setLineStyle(LineStyle.NONE);
		hignseries.setYSeries(hignseriesValue);
//		hignseries.enableArea(true);
		hignseries.setSymbolType(PlotSymbolType.NONE);
		
		//零分线
		double[] zeroLine = new double[supplierList.size()]; 
		ILineSeries zeroLineSeries = (ILineSeries) chart.getSeriesSet().createSeries(SeriesType.LINE, "..");
		zeroLineSeries.setDescription("");
		zeroLineSeries.setLineStyle(LineStyle.NONE);
		zeroLineSeries.setYSeries(zeroLine);
		zeroLineSeries.setSymbolType(PlotSymbolType.NONE);
		
		chart.getAxisSet().adjustRange();
//		new Thread(new Runnable(){
//			public void run(){
//				double max = 0;
//				for(int i = 0; i < avgSeries.length; i++ ){
//					max = Math.max(max, avgSeries[i]);
//				}
//				final double[] newAvgSeries = new double[avgSeries.length];
//				while(max > 0){
//					
//					Display.getDefault().syncExec(new Runnable(){
//						public void run(){
//							for(int i = 0; i < avgSeries.length; i++ ){
//								newAvgSeries[i] = Math.min(newAvgSeries[i]+1, avgSeries[i]);
//							}
//							avgseries.setYSeries(newAvgSeries);
//							if(!chart.isDisposed()){
//								chart.redraw();
//							}
//						}
//					});
//					max--;
////					try {
////						Thread.sleep(1000);
////					} catch (InterruptedException e) {
////					}
//				}
//			}
//		}).start();
		composite.layout();
		scrolledComposite.setContent(composite);
		scrolledComposite.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
	}
	
	/**
	 * @Description: 获取评审指标列表
	 * @author guoyr
	 * @return 
	 */
	private String[] getX(List<Supplier> supplierList){
		StringBuffer factorNames = new StringBuffer();
		int index = 1;
		for(Supplier supplier : supplierList){
			factorNames.append(supplier.getSupplierName());
			if(index < supplierList.size()){
				factorNames.append(",");
			}
		}
		return factorNames.toString().split(",");
	}
	/**
	 * @Description: 加载 评审汇总表格并 加载数据
	 * @author guoyr
	 * @param evaluationTableComposite
	 */
	private void initData(){
		List<AuthUser> userList = expertService.getEvaluationStepUserList(tenderProjectEntity.getId(), evaluationStep);
		if(null == userList){
			userList = new ArrayList<AuthUser>();
		}
		if(userList.size() == 0){
			AuthUser user = new AuthUser();
			user.setId("");
			user.setUserName("评标专家");
			userList.add(user);
		}
		final List<AuthUser> expertList = new ArrayList<AuthUser>();
		expertList.addAll(userList);
		
	 
		
		supplierExpertEvaluationResultMap = new HashMap<String, Map<String, ExpertEvaluationResult>>();
		
		// 供应商的结果
		final Map<String, SupplierEvaluationStep> supplierEvaluationStepMap = new HashMap<String, SupplierEvaluationStep>();
		if(null != evaluationStep.getStepStatus() && evaluationStep.getStepStatus().equals(CommonEnum.COMPLETE)){
			
			// 以结果表为准
			List<SupplierEvaluationStep> supplierEvaluationStepList = supplierEvaluationStepService.getSupplierEvaluationStepByTenderIdAndStepId(tenderProjectEntity.getId(), evaluationStep.getId());
			if(null != supplierEvaluationStepList && supplierEvaluationStepList.size() > 0){
				for(SupplierEvaluationStep supplierEvaluationStep : supplierEvaluationStepList){
					supplierEvaluationStepMap.put(supplierEvaluationStep.getSupplierId(), supplierEvaluationStep);
				}
			}
		}
		for(Supplier supplier : defaultSupplierList){
			Map<String, ExpertEvaluationResult>  expertEvaluationResultMap = new HashMap<String, ExpertEvaluationResult>();
			List<ExpertEvaluationResult> expertEvaluationResultList = expertEvaluationResultService.getSupplierStepAllExpertEvaluationResultList(tenderProjectEntity.getId(), evaluationStep.getId(), supplier.getId());
			if(null != expertEvaluationResultList){
				BigDecimal evalScoreSum = null;
				BigDecimal evalFinalScoreSum = null;
				int expertCount = 0;
				for(ExpertEvaluationResult expertEvaluationResult : expertEvaluationResultList){
					expertEvaluationResultMap.put(expertEvaluationResult.getUserId(), expertEvaluationResult);
					if(null != expertEvaluationResult.getEvaluationScore()){
						evalScoreSum = BigDecimalUtils.add(evalScoreSum, expertEvaluationResult.getEvaluationScore());
						evalFinalScoreSum = BigDecimalUtils.add(evalFinalScoreSum, expertEvaluationResult.getEvaluationFinalScore());
						expertCount ++;
					}
				}
				supplierExpertEvaluationResultMap.put(supplier.getId(), expertEvaluationResultMap);
			}
		}
		
	}
	/**
	 * @Description: 选择供应商
	 * @author guoyr 
	 */
	private void selectSupplierList(){
		SelectChartSupplierDialog selectChartSupplierDialog = new SelectChartSupplierDialog(getShell(), supplierName, defaultSupplierList, new SelectSupplierListener() {
			public void setSupplierList(List<Supplier> curSupplierList) {
				configSupplierList = curSupplierList;
				loadChartList(configSupplierList, configExpertList);
			}
		});
		selectChartSupplierDialog.setTitle(MessageFormat.format(Messages.Button_selectFormat, supplierName));
		selectChartSupplierDialog.open();
	}
	
	/**
	 * @Description: 选择专家
	 * @author guoyr 
	 */
	private void selectExpertList(){
		SelectChartExpertDialog selectChartExpertDialog = new SelectChartExpertDialog(getShell(), supplierName, defaultExpertList, new SelectExpertListener() {
			public void setExpertList(List<Expert> curExpertList) {
				configExpertList = curExpertList;
				loadChartList(configSupplierList, configExpertList);
			}
		});
		selectChartExpertDialog.setTitle(MessageFormat.format(Messages.Button_selectFormat, Messages.Expert));
		selectChartExpertDialog.open();
	}
	/**
	 * Return the initial size of the dialog.
	 */
	@Override
	protected Point getInitialSize() {
		return new Point(1000, 600);
	}
}
