package com.vci.client.framework.systemConfig.stafforgmanage.listeners; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JPanel; import com.vci.client.ClientSession; import com.vci.client.LogonApplication; import com.vci.client.common.objects.UserObject; import com.vci.client.framework.delegate.UserEntityClientDelegate; import com.vci.client.framework.systemConfig.stafforgmanage.MachSecurityDialog; import com.vci.client.framework.systemConfig.stafforgmanage.MachSecurityPanel; import com.vci.client.ui.swing.VCIOptionPane; import com.vci.corba.common.VCIError; import com.vci.corba.framework.data.MachSecurityInfo; import com.vci.corba.common.data.UserEntityInfo; public class MachSecurityActionListener extends JPanel implements ActionListener { /** * */ private static final long serialVersionUID = 1L; private MachSecurityDialog dialog = null; private MachSecurityPanel tablePanel=null; private String type = null; private String userName = LogonApplication.getUserEntityObject().getUserName(); private UserObject logonUserInfo; private MachSecurityInfo dataInfo; public MachSecurityActionListener(MachSecurityDialog dlg, MachSecurityPanel tablePanel, String type, MachSecurityInfo dataInfo) { this.dialog = dlg; this.tablePanel = tablePanel; this.dataInfo = dataInfo; this.type = type; } public void actionPerformed(ActionEvent e) { if (type.equalsIgnoreCase("add")) { add_actionPerformed(); } else if (type.equalsIgnoreCase("edit")) { edit_actionPerformed(); } else if (type.equalsIgnoreCase("delete")) { delete_actionPerformed(); } } private void add_actionPerformed() { // TODO Auto-generated method stub if (!checkMachSecurity()) { return; } try { UserEntityInfo userInfo = UserEntityClientDelegate.changeUserEntityToInfo(LogonApplication.getUserEntityObject()); ClientSession.getFrameworkService().saveMachSecurity(dataInfo, userInfo); } catch (VCIError e) { VCIOptionPane.showError(LogonApplication.frame, e); return; } dialog.dispose(); tablePanel.refreshTableData(); } private void edit_actionPerformed() { // TODO Auto-generated method stub } private void delete_actionPerformed() { // TODO Auto-generated method stub } private boolean checkMachSecurity() { // TODO Auto-generated method stub return false; } }