package com.vci.client.framework.systemConfig.stafforgmanage; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import javax.swing.JOptionPane; import com.vci.client.LogonApplication; import com.vci.client.framework.delegate.RightManagementClientDelegate; import com.vci.client.framework.systemConfig.object.CombinationObject; import com.vci.client.framework.systemConfig.object.CombinationValueObject; import com.vci.client.ui.exception.VCIException; import com.vci.client.ui.swing.VCIOptionPane; import com.vci.client.ui.swing.components.VCIJComboBox; public class CombinationValueActionListener implements ActionListener { private CombinationValueTablePanel combValPanel; private String optType; private CombinationObject combObject; public CombinationValueActionListener(CombinationValueTablePanel combValPanel,String optType){ this.combValPanel = combValPanel; this.optType = optType; } @Override public void actionPerformed(ActionEvent e) { if (optType.equals("add")) { createButton_actionEvent(); } else if (optType.equals("modify")) { editButton_actionEvent(); } else if (optType.equals("delete")) { deleteButton_actionEvent(); } } /** * 添加 *
Description:
* * @author wangxl * @time 2013-1-3 */ private void createButton_actionEvent(){ VCIJComboBox combox = combValPanel.getClassComBox(); if(combox.getSelectedIndex() < 0){ VCIOptionPane.showMessageDialog(LogonApplication.frame, "请选择组合方式"); return; } String value = combValPanel.getValueText(); boolean checkValue = checkValue(value); if (!checkValue) { return; } int length = value.length(); ArrayListDescription:
* * @author wangxl * @time 2013-1-3 */ private void editButton_actionEvent(){ VCIJComboBox combox = combValPanel.getClassComBox(); if(combox.getSelectedIndex() < 0){ VCIOptionPane.showMessageDialog(LogonApplication.frame, "请选择组合方式"); return; } String value = combValPanel.getValueText(); boolean checkValue = checkValue(value); if (!checkValue) { return; } CombinationValueObject combValObject = combValPanel.getCombinationValueObject(); String oldValue = combValObject.getValue();//选到的值 try { combValObject.setValue(value); if(!oldValue.equals(value)){ //add by liujw new RightManagementClientDelegate(LogonApplication.getUserEntityObject()).updateCombinationValue(combValObject); } VCIOptionPane.showMessageDialog(combValPanel, "修改成功!"); } catch (VCIException e) { combValObject.setValue(oldValue); VCIOptionPane.showError(LogonApplication.frame, "RMIPFramework",e); } combObject = combValPanel.getCombinationObject(); combValPanel.initTableProperty(combObject.getId()); combValPanel.setValueText(""); } /** * 删除 *Description:
* * @author wangxl * @time 2013-1-3 */ private void deleteButton_actionEvent(){ VCIJComboBox combox = combValPanel.getClassComBox(); if(combox.getSelectedIndex() < 0){ VCIOptionPane.showMessageDialog(LogonApplication.frame, "请选择组合方式"); return; } CombinationValueObject combValObject = combValPanel.getCombinationValueObject(); if(combValObject == null){ JOptionPane.showMessageDialog(combValPanel,"请选择要删除的取值范围"); return; } ArrayList