package com.vci.client.framework.systemConfig.volumn; import java.awt.BorderLayout; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.util.LinkedHashMap; import java.util.LinkedList; import javax.swing.DefaultComboBoxModel; import javax.swing.JComboBox; import javax.swing.JPanel; import javax.swing.border.TitledBorder; import com.vci.client.LogonApplication; import com.vci.client.common.VCIBasePanel; import com.vci.client.common.objects.UserObject; import com.vci.client.framework.delegate.PvolumeClientDelegate; import com.vci.client.framework.rightConfig.object.FunctionObject; import com.vci.client.framework.systemConfig.volumn.object.PvolumeObject; import com.vci.client.framework.util.RightControlUtil; 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.VCISwingUtil; import com.vci.client.ui.swing.components.VCIJButton; import com.vci.client.ui.swing.components.VCIJPanel; import com.vci.client.ui.swing.components.table.AbstractVCIJTableDataProvider; import com.vci.client.ui.swing.components.table.VCIJTableNode; import com.vci.client.ui.swing.components.table.VCIJTablePanel; /** * *
Title:
*卷管理panle:
*Copyright: Copyright (c) 2012
*Company: VCI
* @author lilb * @time 2013-1-2 * @version 1.0 */ public class PvolumePanel extends VCIBasePanel { /** * */ private static final long serialVersionUID = 1L; private UserObject logonUserInfo = LogonApplication.getUserObject(); private JComboBox typeCombo = new JComboBox(); DefaultComboBoxModel tempModel = new DefaultComboBoxModel(); private VCIJButton addButton = VCISwingUtil.createVCIJButton("", LocaleDisplay.getI18nString("rmip.stafforg.operate.add", "RMIPFramework", getLocale()), LocaleDisplay.getI18nString( "rmip.stafforg.operate.add", "RMIPFramework", getLocale()), "create.gif", null); private VCIJButton editButton = VCISwingUtil.createVCIJButton("", LocaleDisplay.getI18nString("rmip.stafforg.operate.modify", "RMIPFramework", getLocale()), LocaleDisplay.getI18nString( "rmip.stafforg.operate.modify", "RMIPFramework", getLocale()), "modify.gif", null); private VCIJButton deleteButton = VCISwingUtil.createVCIJButton("", LocaleDisplay.getI18nString("rmip.stafforg.operate.delete", "RMIPFramework", getLocale()), LocaleDisplay.getI18nString( "rmip.stafforg.operate.delete", "RMIPFramework", getLocale()), "delete.gif", null); private VCIJButton rightButton = VCISwingUtil.createVCIJButton("", "分配成员","分配成员", "user.gif" ,null); private LinkedListDescription:
* * @author llb * @time 2013-1-2 */ private void addButton_conform() { new PvolumeDialog(this, "add"); tablePanel.refreshTableData(); } /** * 修改卷操�? *Description:
* * @author llb * @time 2013-1-2 */ private void editButton_conform() { int len = tablePanel.getSelectedRowIndexs().length; if (len == 0) { VCIOptionPane.showMessage(this, LocaleDisplay.getI18nString( "rmip.stafforg.operate.deptedit1", "RMIPFramework", getLocale())); return; } if (len > 1) { VCIOptionPane.showMessage(this, LocaleDisplay.getI18nString( "rmip.stafforg.operate.deptedit2", "RMIPFramework", getLocale())); return; } PvolumeObject obj = tablePanel.getSelectedRowObjects().get(0); new PvolumeDialog(this, "edit", obj); tablePanel.refreshTableData(); } /** * 删除卷操�? *Description:
* * @author llb * @time 2013-1-2 */ private void delPvolume_actionPerfermed() { int len = tablePanel.getSelectedRowIndexs().length; if (len == 0) { VCIOptionPane.showMessage(this, LocaleDisplay.getI18nString( "rmip.stafforg.operate.deptedit1", "RMIPFramework", getLocale())); return; } String[] puids = new String[len]; for (int i = 0; i < len; i++) { PvolumeObject obj = tablePanel.getSelectedRowObjects().get(i); puids[i] = obj.getId(); boolean isvalid = this.checkDelIsvalid(puids[i]); if (isvalid) { VCIOptionPane.showMessageDialog( LogonApplication.frame, obj.getName() + LocaleDisplay.getI18nString( "rmip.stafforg.operate.cannotdel1", "RMIPRm", getLocale())); return; } // int count = this.checkVolumnIsUsed(puids[i]); // if (count != 0) { // VCIOptionPane.showMessageDialog( // LogonApplication.frame, // obj.getName() // + LocaleDisplay.getI18nString( // "rmip.stafforg.operate.cannotdel", // "RMIPRm", getLocale())); // return; // } } int ok = VCIOptionPane.showQuestion(LogonApplication.frame, LocaleDisplay.getI18nString("rmip.stafforg.operate.conformdel", "RMIPRm", getLocale())); if (ok == 0) { boolean rs = true; try { PvolumeClientDelegate pvolumeSrv = new PvolumeClientDelegate(LogonApplication.getUserEntityObject()); rs = pvolumeSrv.deletePvolume(puids); } catch (VCIException ex) { VCIOptionPane.showError(LogonApplication.frame, "RMIPRm", ex); return; } if (!rs) { return; } tablePanel.refreshTableData(); } } /** * 验证删除的卷是否被引�? *Description:
* * @author llb * @time 2013-1-2 * @param id * @return */ // public int checkVolumnIsUsed(String id) { // int count = 0; // try { // count = new PvolumeClientDelegate( // LogonApplication.getUserEntityObject()) // .fetchVolumnInfoByIds(id); // } catch (VCIException e) { // VCIOptionPane.showError(LogonApplication.frame, "RMIPRm", e); // return 0; // } // return count; // } /** * 验证删除的卷是否为首选路�? *Description:
* * @author llb * @time 2013-1-2 * @param id * @return */ public boolean checkDelIsvalid(String id) { boolean res = false; try { res = new PvolumeClientDelegate( LogonApplication.getUserEntityObject()).checkDelIsvalid(id); } catch (VCIException e) { VCIOptionPane.showError(LogonApplication.frame, "RMIPRm", e); return false; } return res; } /** * 分配成员事件 */ private void rightButton_conform(){ int len = tablePanel.getSelectedRowIndexs().length; if (len == 0){ VCIOptionPane.showMessage(this, "请选择文件柜进行成员分�?"); return; }else if (len > 1){ VCIOptionPane.showMessage(this, "一次只能对一个文件柜进行分配人员操作!"); return; }else { PvolumeObject pvolumeObject = tablePanel.getSelectedRowObjects().get(0); PvolumeUserDialog dialog = new PvolumeUserDialog(pvolumeObject); // RightRoleDialog dialog = new RightRoleDialog(pvolumeObject); dialog.setVisible(true); } } }