package com.kingdee.eas.scm.sm.pur.client;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import com.kingdee.bos.BOSException;
import com.kingdee.bos.ctrl.swing.KDWorkButton;
import com.kingdee.bos.dao.ormapping.ObjectStringPK;
import com.kingdee.bos.ui.face.IUIWindow;
import com.kingdee.bos.ui.face.UIException;
import com.kingdee.bos.ui.face.UIFactory;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.common.client.OprtState;
import com.kingdee.eas.common.client.UIContext;
import com.kingdee.eas.common.client.UIFactoryName;
import com.kingdee.eas.custom.htjd.client.ContractEndEditUI;
import com.kingdee.eas.scm.sm.pur.PurContractFactory;
import com.kingdee.eas.scm.sm.pur.PurContractInfo;

public class PurContractListUIPIEx extends PurContractListUI{

	public PurContractListUIPIEx() throws Exception {
		super();
		
	}
	
	@Override
	public void onLoad() throws Exception {
		// TODO Auto-generated method stub
		super.onLoad();	
		KDWorkButton btnJiaodi = new KDWorkButton("ΊΟΝ¬½»΅Χ");
		btnJiaodi.setIcon(com.kingdee.eas.util.client.EASResource.getIcon("tbtn_circumscription.gif"));
		this.toolBar.add(btnJiaodi);
		btnJiaodi.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e)  {
				
				try {
					
					String selectedKeyValue = getSelectedKeyValue ();
					PurContractInfo purContractinfo;
					purContractinfo = PurContractFactory.getRemoteInstance().getPurContractInfo(new ObjectStringPK(selectedKeyValue));
					UIContext  context = new UIContext(this);
					context.put("PurContractInfo", purContractinfo);				
					IUIWindow create = UIFactory.createUIFactory(UIFactoryName.NEWWIN).create(ContractEndEditUI.class.getName(),context,null,OprtState.ADDNEW);
					create.show();
				} catch (EASBizException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				} catch (BOSException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
			}
			
			
		});
	}
	

}
