package com.gx.obe.management.action;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;

import com.gx.obe.action.bean.Action;
import com.gx.obe.action.listener.ActionListener;
import com.gx.obe.components.core.Constants;
import com.gx.obe.config.ConfigConstants;
import com.gx.obe.config.utils.PropertiesUtils;
import com.gx.obe.web.entity.tender.TenderProjectEntity;
import com.gx.tools.ole.bjca.BJCASaomaCircleSignatureComposite;
import com.gx.tools.ole.cfca.CFCASaoMaLoaderImpl;
import com.gx.tools.ole.cfca.CFCASaomaCircleSignatureComposite;

/**
 * @Description: 扫码签章
 * @author wangxiang
 */
public class LoadSignetureCodeAction extends Action{

	public void run() {
		ActionListener listener = this.getListener();
		TenderProjectEntity tenderProjectEntity = this.getTenderProject();
		if (null != tenderProjectEntity) {
			final String signaturePdfvalue = PropertiesUtils.getProperty(ConfigConstants.SAOMA_SIGNATURE_PDF, "");
			// CFCA 中招扫码app
			Composite composite = listener.getParentComposite();
			for(Control control : composite.getChildren()) {
				control.dispose();
			}
			if(CFCASaoMaLoaderImpl.PDF_TYPE.equals(signaturePdfvalue)) {
				CFCASaomaCircleSignatureComposite signatureComposite= new CFCASaomaCircleSignatureComposite(composite, SWT.NONE);
				signatureComposite.refreshSignatureFiles(tenderProjectEntity, Constants.USER);
			}else {
				// 北京CA扫码签章
				BJCASaomaCircleSignatureComposite signatureComposite= new BJCASaomaCircleSignatureComposite(composite, SWT.NONE);
				signatureComposite.refreshSignatureFiles(tenderProjectEntity, Constants.USER);
			}
			
			composite.layout();
		}
	}
}
