package com.vci.client.framework.appConfig; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.Locale; import com.vci.client.LogonApplication; import com.vci.client.framework.appConfig.object.AppConfigDetailObject; import com.vci.client.framework.delegate.AppConfigDetailClientDelegate; import com.vci.client.ui.exception.VCIException; import com.vci.client.ui.locale.LocaleDisplay; import com.vci.client.ui.swing.VCIOptionPane; import com.vci.client.ui.swing.components.VCIJPanel; public class AppConfigDetailPanelActionListener implements ActionListener { private IConfigDetailPanel owner = null; private LinkedHashMap actionMaps = new LinkedHashMap(); public AppConfigDetailPanelActionListener(IConfigDetailPanel owner){ this.owner = owner; this.initActionMap(); } private void initActionMap(){ actionMaps.put("create", new Runnable() { public void run() { createAppConfigDetail();// }}); actionMaps.put("edit", new Runnable() { public void run() { editAppConfigDetail();// }}); actionMaps.put("delete", new Runnable() { public void run() { deleteAppConfigDetail();// }}); } @Override public void actionPerformed(ActionEvent e) { String key = e.getActionCommand(); if(actionMaps.containsKey(key)){ actionMaps.get(key).run(); } } private void createAppConfigDetail() { String clsfId = owner.getConfigCategory(); if (clsfId == null || clsfId.equals("")) { VCIOptionPane.showMessage((VCIJPanel)owner, "请先选择分类!"); return; } AppConfigDetailDialog dialog = new AppConfigDetailDialog(LogonApplication.frame, owner, clsfId); owner.getTablePanel().refreshTableData(); } private void editAppConfigDetail() { int[] chk = owner.getTablePanel().getSelectedRowIndexs(); Integer[] chkSelRows = new Integer[chk.length]; for (int i = 0 ;i 1){ VCIOptionPane.showMessage(((VCIJPanel)owner), LocaleDisplay.getI18nString("rmip.stafforg.operate.deptedit2", "RMIPFramework", ((VCIJPanel)owner).getLocale())); return; } AppConfigDetailObject obj = owner.getTablePanel().getSelectedRowObjects().get(0); new AppConfigDetailDialog(LogonApplication.frame, owner, obj); owner.getTablePanel().refreshTableData(); } private void deleteAppConfigDetail() { int[] chk =owner.getTablePanel().getSelectedRowIndexs(); Integer[] chkSelRows = new Integer[chk.length]; for (int i = 0 ;i list= owner.getTablePanel().getSelectedRowObjects(); puids[i] = list.get(i).getId(); int ok=VCIOptionPane.showQuestion(LogonApplication.frame,"您确定要删除选中的对象吗?"); if (ok == 0) { boolean rs=true; try { rs = new AppConfigDetailClientDelegate(LogonApplication.getUserEntityObject()).deleteAppConfigDetail(puids); } catch (VCIException e) { VCIOptionPane.showError(LogonApplication.frame, LocaleDisplay.getI18nString(e, "RMIPFramework", Locale.getDefault())); return; } if (!rs) { return; } owner.getTablePanel().refreshTableData(); } } } }