wangting
2024-12-26 fa261e8c1220b31af54e8167e4de9c3320b1af27
Source/Client/PLTClient/src/com/vci/client/framework/rightdistribution/roleRight/BSTypeRoleRightPanel2.java
@@ -58,7 +58,7 @@
import com.vci.client.portal.utility.UIDataFetcher;
import com.vci.client.portal.utility.UITools;
import com.vci.client.ui.exception.VCIException;
import com.vci.client.ui.image.bundle.BundleImage;
import com.vci.client.ui.image.BundleImage;
import com.vci.client.ui.locale.LocaleDisplay;
import com.vci.client.ui.process.QANProcessBar;
import com.vci.client.ui.process.QANProcessBarFrame;
@@ -142,7 +142,7 @@
      JPanel buttonPanel = new JPanel();
      JPanel midPanel = new JPanel();
      palMain.setLayout(new BorderLayout());
      roleList("");
      initRoleList("");
      contentItem(contentPanel);
      jButtonPanl(buttonPanel);
      initTreeNode();
@@ -235,7 +235,10 @@
      
      BizTypeEx btEx = (BizTypeEx)comboType.getSelectedItem();
      if (btEx == null || btEx.getBizType() == null)
      {
         initUIContextTree(null, null);
         return;
      }
      
      BtmItem bt = btEx.getBizType();
      
@@ -255,11 +258,102 @@
   
   private void UIContextSelectChanged(ItemEvent e) {
      // TODO Auto-generated method stub
      BtmItem bt = null;
      PLUILayout uiContext = null;
      
      BizTypeEx btEx = (BizTypeEx)comboType.getSelectedItem();
      if (btEx != null)
         bt = btEx.getBizType();
      UILayoutEx uiEx = (UILayoutEx)comboUIContext.getSelectedItem();
      if (uiEx != null)
         uiContext = uiEx.getUIContext();
      initUIContextTree(bt, uiContext);
   }
   private String getNodeText(Object obj) {
      String text = "";
      if (obj == null)
         return null;
      if (obj instanceof BtmItem) {
         BtmItem bt = (BtmItem)obj;
         return bt.name+" ["+ bt.label+"]";
      } else if (obj instanceof PLUILayout) {
         PLUILayout ui = (PLUILayout)obj;
         return ui.plCode+" ["+ui.plName+"]";
      } else if (obj instanceof PLTabPage) {
         PLTabPage tab = (PLTabPage)obj;
         return tab.plName;
      } else if (obj instanceof PLPageDefination) {
         PLPageDefination page = (PLPageDefination)obj;
         return page.name;
      } else if (obj instanceof PLTabButton) {
         PLTabButton btn = (PLTabButton)obj;
         return btn.plLabel;
      }
      return text;
   }
   private void initUIContextTree(BtmItem bt, PLUILayout uiContext) {
      treeManager.getSelectionModel().removeSelectionPath(new TreePath(rootNode.getPath()));
      //先清除所有展开的节点
      rootNode.removeAllChildren();
      treeModel.reload();
//      for(int i=rootNode.getChildCount(); i>0; i--){
//         VCIBaseTreeNode childNode = (VCIBaseTreeNode)rootNode.getChildAt(i-1);
//         treeModel.removeNodeFromParent(childNode);
//      }
      funMap.clear();
      //rootNode.setExpand(true);
      if(bt != null) {
         if (uiContext != null) {
            Map<String, VCIBaseTreeNode> showNodes = new HashMap<String, VCIBaseTreeNode>();
            VCIBaseTreeNode typeNode = showNodes.get(bt.name);
            if(typeNode == null){
               //添加类型节点
               typeNode = new VCIBaseTreeNode(getNodeText(bt), bt);//bt.name+" ["+ bt.label+"]", bt);
               treeModel.insertNodeInto(typeNode, rootNode,rootNode.getChildCount());
               //typeNode.setExpand(true);
               funMap.put(bt.name, bt.name);
               showNodes.put(bt.name, typeNode);
            }
            //添加上下文节点及子节点
            VCIBaseTreeNode curNode  = new VCIBaseTreeNode(getNodeText(uiContext), uiContext);//uiContext.plName+" ["+uiContext.plCode+"]", uiContext);
            //curNode.setExpand(true);
            treeModel.insertNodeInto(curNode, typeNode,typeNode.getChildCount());
            funMap.put(uiContext.plOId, uiContext.plCode);
            setChildNode(curNode, uiContext);
         } else {
            VCIBaseTreeNode typeNode = new VCIBaseTreeNode(getNodeText(bt), bt);//bt.label+" ["+ bt.name+"]", bt);
            treeModel.insertNodeInto(typeNode, rootNode,rootNode.getChildCount());
            //typeNode.setExpand(true);
            funMap.put(bt.name, bt.name);
            setChildNode(typeNode, bt, uiDataFechter);
         }
      }else{
         BtmItem[] btmItems = BtmProvider.getInstance().getAllBtmItems();
         for (int i = 0; i < btmItems.length; i++) {
            VCIBaseTreeNode typeNode = new VCIBaseTreeNode(getNodeText(btmItems[i]), btmItems[i]);//btmItems[i].label+"("+ btmItems[i].name+")", btmItems[i]);
            treeModel.insertNodeInto(typeNode, rootNode,rootNode.getChildCount());
            //typeNode.setExpand(true);
            funMap.put(btmItems[i].name, btmItems[i].name);
            setChildNode(typeNode, bt, uiDataFechter);
         }
      }
      tree.scrollPathToVisible(new TreePath(rootNode.getPath()));
      //tree.expandAllTreeNode(new TreePath(rootNode.getPath()), true);
      if (curRole != null)
         initRoleRight(curRole.getId());
   }
   public void roleList(String searchText) {
   public void initRoleList(String searchText) {
      setRoleList(searchText);
      roleList.setCellRenderer(new ListLabelCellRender());
      roleList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
@@ -276,72 +370,22 @@
      leftPanel.getViewport().add(roleList);
   }
   
   Map<String,RoleRightObject> allRightRoleMap = new HashMap<String,RoleRightObject>();
   
   public void initRoleRight(String roleId){
      try{
         //先清除所有展开的节点
         /*for(int i=rootNode.getChildCount(); i>0; i--){
            VCIBaseTreeNode childNode = (VCIBaseTreeNode)rootNode.getChildAt(i-1);
            for(int j=childNode.getChildCount();j>0;j--){
               VCIBaseTreeNode cchildNode = (VCIBaseTreeNode)childNode.getChildAt(j-1);
               treeModel.removeNodeFromParent(cchildNode);
            }
         }*/
         initTreeNode();
         //allRightRoleMap = new HashMap<String,RoleRightObject>();
         funMap.clear();
         //开始展示我的权限内容
         long s = System.currentTimeMillis();
      try {
         allRightRoleMap = new HashMap<String,RoleRightObject>();
         RoleRightObject[] roleRightObjs = new RoleRightClientDelegate().getRoleRightList(roleId, LogonApplication.getUserEntityObject().getUserName());
         long t = System.currentTimeMillis();
         System.out.println("1: " + (t - s));
         s = System.currentTimeMillis();
         BtmItem[] btmItems = BtmProvider.getInstance().getAllBtmItems();
         t = System.currentTimeMillis();
         System.out.println("2: " + (t - s));
         s = System.currentTimeMillis();
         Map<String,Long> rightMap = new HashMap<String,Long>();
         for(RoleRightObject obj:roleRightObjs){
            allRightRoleMap.put(obj.getFuncId(), obj);
            rightMap.put(obj.getFuncId(), obj.getRightValue());
         }
         t = System.currentTimeMillis();
         System.out.println("3: " + (t - s));
         //添加type节点
         UIDataFetcher uiDataFechter = new UIDataFetcher();
         s = System.currentTimeMillis();
         int ii=0;
         for(BtmItem btmItem: btmItems){
            if(rightMap.containsKey(btmItem.name))
            {
               //VCIBaseTreeNode node = new VCIBaseTreeNode(btmItem.label+"("+ btmItem.name+")", btmItem);
               VCIBaseTreeNode node = (VCIBaseTreeNode)rootNode.getChildAt(ii);
               //node.setExpand(true);
               funMap.put(btmItem.name, btmItem.name);
            //   treeModel.insertNodeInto(node, rootNode,rootNode.getChildCount());
            //   setChildNode(node, btmItem, rightMap);
               setChildNode(node, btmItem, uiDataFechter);
            }
            ii++;
         }
         t = System.currentTimeMillis();
         System.out.println("4: " + (t - s));
         s = System.currentTimeMillis();
         visitAllTreeNode(rootNode, roleRightObjs);
         //treeManager.getSelectionModel().addSelectionPath(new TreePath(rootNode.getPath()));
         t = System.currentTimeMillis();
         System.out.println("5: " + (t - s));
      } catch (VCIException e) {
         e.printStackTrace();
         VCIOptionPane.showError(LogonApplication.frame, LocaleDisplay.getI18nString(e,"RMIPFramework", getLocale()));
      }
   }
   private void setChildNode(VCIBaseTreeNode node ,Object funcObj, UIDataFetcher uiDataFechter) {
      if (funcObj instanceof BtmItem) {
         BtmItem btmItem = (BtmItem) funcObj;
@@ -350,7 +394,7 @@
            return;
         }
         for(PLUILayout context : contexts){
            VCIBaseTreeNode curNode  = new VCIBaseTreeNode(context.plName+"("+context.plCode+")", context);
            VCIBaseTreeNode curNode  = new VCIBaseTreeNode(getNodeText(context), context);// context.plName+"("+context.plCode+")", context);
            treeModel.insertNodeInto(curNode, node,node.getChildCount());
            funMap.put(context.plOId, context.plCode);
            setChildNode(curNode, context, uiDataFechter);
@@ -362,7 +406,7 @@
            return;
         }
         for(PLTabPage tab : tabs){
            VCIBaseTreeNode curNode  = new VCIBaseTreeNode(tab.plName, tab);
            VCIBaseTreeNode curNode  = new VCIBaseTreeNode(getNodeText(tab), tab);//tab.plName, tab);
            treeModel.insertNodeInto(curNode, node,node.getChildCount());
            funMap.put(tab.plOId, tab.plName);
            setChildNode(curNode, tab, uiDataFechter);
@@ -374,7 +418,7 @@
            return;
         }
         for (PLPageDefination pageDefination : pageDefinations) {
            VCIBaseTreeNode curNode  = new VCIBaseTreeNode(pageDefination.name, pageDefination);
            VCIBaseTreeNode curNode  = new VCIBaseTreeNode(getNodeText(pageDefination), pageDefination);//pageDefination.name, pageDefination);
            treeModel.insertNodeInto(curNode, node,node.getChildCount());
            funMap.put(pageDefination.plOId, pageDefination.name);
            setChildNode(curNode, pageDefination, uiDataFechter);
@@ -389,7 +433,7 @@
            if(!button.show.equals("0")){
               continue;
            }
            VCIBaseTreeNode curNode  = new VCIBaseTreeNode(button.plLabel, button);
            VCIBaseTreeNode curNode  = new VCIBaseTreeNode(getNodeText(button), button);//button.plLabel, button);
            treeModel.insertNodeInto(curNode, node,node.getChildCount());
            funMap.put(button.plTableOId, button.plLabel);
            setChildNode(curNode, button, uiDataFechter);
@@ -563,13 +607,13 @@
         }
      });
      
      reAddButton.setText(LocaleDisplay.getI18nString("rmip.framework.rightdistribution.moduleRight.reAddButton.file","RMIPFramework", getLocale()));
      reAddButton.setIcon(new BundleImage().createImageIcon("create.gif"));
      reAddButton.addActionListener(new ActionListener() {
         public void actionPerformed(ActionEvent e) {
            reAdd_actionPerform();
         }
      });
//      reAddButton.setText(LocaleDisplay.getI18nString("rmip.framework.rightdistribution.moduleRight.reAddButton.file","RMIPFramework", getLocale()));
//      reAddButton.setIcon(new BundleImage().createImageIcon("create.gif"));
//      reAddButton.addActionListener(new ActionListener() {
//         public void actionPerformed(ActionEvent e) {
//            reAdd_actionPerform();
//         }
//      });
      
      delButton.setText(LocaleDisplay.getI18nString("rmip.framework.rightdistribution.moduleRight.delButton.file","RMIPFramework", getLocale()));
@@ -581,21 +625,21 @@
         }
      });
      
      removeButton.setText(LocaleDisplay.getI18nString("rmip.framework.rightdistribution.moduleRight.removeButton.file","RMIPFramework", getLocale()));
      removeButton.setIcon(new BundleImage().createImageIcon("remove.gif"));
      removeButton.addActionListener(new ActionListener() {
         public void actionPerformed(ActionEvent e) {
            remove_actionPerform();
         }
      });
//      removeButton.setText(LocaleDisplay.getI18nString("rmip.framework.rightdistribution.moduleRight.removeButton.file","RMIPFramework", getLocale()));
//      removeButton.setIcon(new BundleImage().createImageIcon("remove.gif"));
//      removeButton.addActionListener(new ActionListener() {
//         public void actionPerformed(ActionEvent e) {
//            remove_actionPerform();
//         }
//      });
      
      clearButton.setText(LocaleDisplay.getI18nString("rmip.framework.rightdistribution.moduleRight.clearButton.file","RMIPFramework", getLocale()));
      clearButton.setIcon(new BundleImage().createImageIcon("clear.gif"));
      clearButton.addActionListener(new ActionListener() {
         public void actionPerformed(ActionEvent e) {
            clear_actionPerform();
         }
      });
//      clearButton.setText(LocaleDisplay.getI18nString("rmip.framework.rightdistribution.moduleRight.clearButton.file","RMIPFramework", getLocale()));
//      clearButton.setIcon(new BundleImage().createImageIcon("clear.gif"));
//      clearButton.addActionListener(new ActionListener() {
//         public void actionPerformed(ActionEvent e) {
//            clear_actionPerform();
//         }
//      });
      
      sBtn.addActionListener(new ActionListener() {
         public void actionPerformed(ActionEvent e) {
@@ -675,100 +719,100 @@
//      p.add(contextText);
//      p.add(sBtn);
      p.add(addButton);
      p.add(reAddButton);
//      p.add(reAddButton);
      p.add(delButton);
      p.add(removeButton);
      p.add(clearButton);
//      p.add(removeButton);
//      p.add(clearButton);
   }
   
   private void remove_actionPerform(){
      if (!checkItem()) {
         return;
      }
      final QANProcessBarFrame frame = new QANProcessBarFrame();
      TreePath[] treePath = treeManager.getSelectionModel().getSelectionPaths();
      if (treePath == null || treePath.length == 0) {
         VCIOptionPane.showMessage(LogonApplication.frame, "请选择要删除的权限");
         return ;
      }
      QANProcessBar bar = null;
      Thread t = new Thread(){
         public void run() {
            frame.setContent("正在授权,请稍等......");
            try {
               rightMap.clear();
               boolean refresh = true;
               TreePath[] treePath = treeManager.getSelectionModel().getSelectionPaths();
               //当没有选中模块的时候
               if (treePath == null && treePath.length == 0){
                  refresh = false;
               }else{
                  RoleRightObject[] roleRightObjs = getRemoveedSelectedRoleRightObjs(treePath);
                  boolean res = new RoleRightClientDelegate(LogonApplication.getUserEntityObject()).removeRoleRight(roleRightObjs,curRole.getId(),currentUserName);
                  frame.setProcessBarCancel(true);
                  if(res){
                     VCIOptionPane.showMessage(LogonApplication.frame, "移除UI操作权限成功!");
                  }
               }
               if(refresh){
                  treeManager.getSelectionModel().clearSelection();
                  initRoleRight(curRole.getId());
               }
            } catch (VCIException e1) {
               e1.printStackTrace();
               VCIOptionPane.showError(LogonApplication.frame, "RMIPFramework", e1);
            } finally {
               frame.setProcessBarCancel(true);
            }
         }
      };
      bar = new QANProcessBar(t, frame, frame,"UI操作授权",false);
      bar.setVisible(true);
   }
   private void clear_actionPerform(){
      if (!checkItem()) {
         return;
      }
      final QANProcessBarFrame frame = new QANProcessBarFrame();
      TreePath[] treePath = treeManager.getSelectionModel().getSelectionPaths();
      if (treePath == null || treePath.length == 0) {
         int result = VCIOptionPane.showConfirmDialog(LogonApplication.frame, this, "您确定要清除所有的UI操作权限吗?", "注意,您确定要清除所有的UI权限吗?", VCIOptionPane.YES_NO_OPTION, VCIOptionPane.WARNING_MESSAGE);
         if(result != VCIOptionPane.YES_OPTION){
            return;
         }
      }
      QANProcessBar bar = null;
      Thread t = new Thread(){
         public void run() {
            frame.setContent("正在清除授权,请稍等......");
            try {
               rightMap.clear();
               boolean refresh = true;
               TreePath[] treePath = treeManager.getSelectionModel().getSelectionPaths();
               //当没有选中模块的时候
               RoleRightObject[] roleRightObjs = new RoleRightObject[0];
               boolean res = new RoleRightClientDelegate(LogonApplication.getUserEntityObject()).clearRight(curRole.getId(),currentUserName, RightType.UI);
               frame.setProcessBarCancel(true);
               if(res){
                  VCIOptionPane.showMessage(LogonApplication.frame, "UI操作权限清空成功!");
               }
               if(refresh){
                  treeManager.getSelectionModel().clearSelection();
                  initRoleRight(curRole.getId());
               }
            } catch (VCIException e1) {
               e1.printStackTrace();
               VCIOptionPane.showError(LogonApplication.frame, "RMIPFramework", e1);
            } finally {
               frame.setProcessBarCancel(true);
            }
         }
      };
      bar = new QANProcessBar(t, frame, frame,"UI操作授权",false);
      bar.setVisible(true);
   }
//   private void remove_actionPerform(){
//      if (!checkItem()) {
//         return;
//      }
//      final QANProcessBarFrame frame = new QANProcessBarFrame();
//      TreePath[] treePath = treeManager.getSelectionModel().getSelectionPaths();
//      if (treePath == null || treePath.length == 0) {
//         VCIOptionPane.showMessage(LogonApplication.frame, "请选择要删除的权限");
//         return ;
//      }
//      QANProcessBar bar = null;
//      Thread t = new Thread(){
//         public void run() {
//            frame.setContent("正在授权,请稍等......");
//            try {
//               rightMap.clear();
//               boolean refresh = true;
//               TreePath[] treePath = treeManager.getSelectionModel().getSelectionPaths();
//               //当没有选中模块的时候
//               if (treePath == null && treePath.length == 0){
//                  refresh = false;
//               }else{
//                  RoleRightObject[] roleRightObjs = getRemoveedSelectedRoleRightObjs(treePath);
//                  boolean res = new RoleRightClientDelegate(LogonApplication.getUserEntityObject()).removeRoleRight(roleRightObjs,curRole.getId(),currentUserName);
//                  frame.setProcessBarCancel(true);
//                  if(res){
//                     VCIOptionPane.showMessage(LogonApplication.frame, "移除UI操作权限成功!");
//                  }
//               }
//               if(refresh){
//                  treeManager.getSelectionModel().clearSelection();
//                  initRoleRight(curRole.getId());
//               }
//            } catch (VCIException e1) {
//               e1.printStackTrace();
//               VCIOptionPane.showError(LogonApplication.frame, "RMIPFramework", e1);
//            } finally {
//               frame.setProcessBarCancel(true);
//            }
//         }
//      };
//      bar = new QANProcessBar(t, frame, frame,"UI操作授权",false);
//      bar.setVisible(true);
//   }
//
//   private void clear_actionPerform(){
//      if (!checkItem()) {
//         return;
//      }
//      final QANProcessBarFrame frame = new QANProcessBarFrame();
//      TreePath[] treePath = treeManager.getSelectionModel().getSelectionPaths();
//      if (treePath == null || treePath.length == 0) {
//         int result = VCIOptionPane.showConfirmDialog(LogonApplication.frame, this, "您确定要清除所有的UI操作权限吗?", "注意,您确定要清除所有的UI权限吗?", VCIOptionPane.YES_NO_OPTION, VCIOptionPane.WARNING_MESSAGE);
//         if(result != VCIOptionPane.YES_OPTION){
//            return;
//         }
//      }
//      QANProcessBar bar = null;
//      Thread t = new Thread(){
//         public void run() {
//            frame.setContent("正在清除授权,请稍等......");
//            try {
//               rightMap.clear();
//               boolean refresh = true;
//               TreePath[] treePath = treeManager.getSelectionModel().getSelectionPaths();
//               //当没有选中模块的时候
//               RoleRightObject[] roleRightObjs = new RoleRightObject[0];
//               boolean res = new RoleRightClientDelegate(LogonApplication.getUserEntityObject()).clearRight(curRole.getId(),currentUserName, RightType.UI);
//               frame.setProcessBarCancel(true);
//               if(res){
//                  VCIOptionPane.showMessage(LogonApplication.frame, "UI操作权限清空成功!");
//               }
//
//               if(refresh){
//                  treeManager.getSelectionModel().clearSelection();
//                  initRoleRight(curRole.getId());
//               }
//            } catch (VCIException e1) {
//               e1.printStackTrace();
//               VCIOptionPane.showError(LogonApplication.frame, "RMIPFramework", e1);
//            } finally {
//               frame.setProcessBarCancel(true);
//            }
//         }
//      };
//      bar = new QANProcessBar(t, frame, frame,"UI操作授权",false);
//      bar.setVisible(true);
//   }
   
   public void initTreeNode(){
      rootNode = new VCIBaseTreeNode(LocaleDisplay.getI18nString("rmip.framework.rightdistribution.moduleRight.moduleTree","RMIPFramework", getLocale()), "root");
@@ -780,46 +824,47 @@
      comboType.addItem(new BizTypeEx(null));
      
      for(int k = 0;k < btmItems.length;k++) {
         funMap.put(btmItems[k].name, btmItems[k].name);
         comboType.addItem(new BizTypeEx(btmItems[k]));
      }
      
      for (int i = 0; i < btmItems.length; i++) {
         VCIBaseTreeNode node = new VCIBaseTreeNode(btmItems[i].label+"("+ btmItems[i].name+")", btmItems[i]);
         VCIBaseTreeNode node = new VCIBaseTreeNode(btmItems[i].label+" ["+ btmItems[i].name+"]", btmItems[i]);
         treeModel.insertNodeInto(node, rootNode,rootNode.getChildCount());
         funMap.put(btmItems[i].name, btmItems[i].name);
         setChildNode(node, btmItems[i]);
      }
      treeManager = new CheckBoxTreeManager(tree);
      scrollTree.getViewport().removeAll();
      scrollTree.getViewport().add(tree);
      scrollTree.repaint();
      tree.addTreeExpansionListener(new TreeExpansionListener() {
         @Override
         public void treeExpanded(TreeExpansionEvent event) {
            TreePath path = event.getPath();
            VCIBaseTreeNode selNode = (VCIBaseTreeNode)path.getLastPathComponent();
            if(!selNode.isLeaf() && selNode.getChildCount() == 0 && !selNode.isExpand()){
               setChildNode(selNode, selNode.getObj());
            }
         }
         @Override
         public void treeCollapsed(TreeExpansionEvent event) {
         }
      });
//      tree.addTreeExpansionListener(new TreeExpansionListener() {
//
//         @Override
//         public void treeExpanded(TreeExpansionEvent event) {
//            TreePath path = event.getPath();
//            VCIBaseTreeNode selNode = (VCIBaseTreeNode)path.getLastPathComponent();
//            if(!selNode.isLeaf() && selNode.getChildCount() == 0 && !selNode.isExpand()){
//               setChildNode(selNode, selNode.getObj());
//            }
//         }
//
//         @Override
//         public void treeCollapsed(TreeExpansionEvent event) {
//
//         }
//      });
   }
   
   private void refreshRole() {
      roleList("");
      initRoleList("");
      treeManager.getSelectionModel().clearSelection();
   }
   
   /**查询满足条件的角色信息**/
   private void searchRoleList() {
      String search = this.searchTxt.getText().trim();
      roleList(search);
      initRoleList(search);
      treeManager.getSelectionModel().clearSelection();
   }
   
@@ -878,141 +923,54 @@
      bar.setVisible(true);
   }
   
/*   private void remove_actionPerform(){
      if (!checkItem()) {
         return;
      }
      final QANProcessBarFrame frame = new QANProcessBarFrame();
      TreePath[] treePath = treeManager.getSelectionModel().getSelectionPaths();
      if (treePath == null || treePath.length == 0) {
         VCIOptionPane.showMessage(LogonApplication.frame, "请选择要删除的权限");
         return ;
      }
      QANProcessBar bar = null;
      Thread t = new Thread(){
         public void run() {
            frame.setContent("正在授权,请稍等......");
            try {
               rightMap.clear();
               boolean refresh = true;
               TreePath[] treePath = treeManager.getSelectionModel().getSelectionPaths();
               //当没有选中模块的时候
               if (treePath == null && treePath.length == 0){
                  refresh = false;
               }else{
                  RoleRightObject[] roleRightObjs = getRemoveedSelectedRoleRightObjs(treePath);
                  boolean res = new RoleRightClientDelegate(LogonApplication.getUserEntityObject()).removeRoleRight(roleRightObjs,curRole.getId(),currentUserName);
                  frame.setProcessBarCancel(true);
                  if(res){
                     VCIOptionPane.showMessage(LogonApplication.frame, "移除UI操作权限成功!");
                  }
               }
               if(refresh){
                  treeManager.getSelectionModel().clearSelection();
                  initRoleRight(curRole.getId());
               }
            } catch (VCIException e1) {
               e1.printStackTrace();
               VCIOptionPane.showError(LogonApplication.frame, "RMIPFramework", e1);
            } finally {
               frame.setProcessBarCancel(true);
            }
         }
      };
      bar = new QANProcessBar(t, frame, frame,"UI操作授权",false);
      bar.setVisible(true);
   }*/
/*   private void clear_actionPerform(){
      if (!checkItem()) {
         return;
      }
      final QANProcessBarFrame frame = new QANProcessBarFrame();
      TreePath[] treePath = treeManager.getSelectionModel().getSelectionPaths();
      if (treePath == null || treePath.length == 0) {
         int result = VCIOptionPane.showConfirmDialog(LogonApplication.frame, this, "您确定要清除所有的UI操作权限吗?", "注意,您确定要清除所有的UI权限吗?", VCIOptionPane.YES_NO_OPTION, VCIOptionPane.WARNING_MESSAGE);
         if(result != VCIOptionPane.YES_OPTION){
            return;
         }
      }
      QANProcessBar bar = null;
      Thread t = new Thread(){
         public void run() {
            frame.setContent("正在清除授权,请稍等......");
            try {
               rightMap.clear();
               boolean refresh = true;
               TreePath[] treePath = treeManager.getSelectionModel().getSelectionPaths();
               //当没有选中模块的时候
               RoleRightObject[] roleRightObjs = new RoleRightObject[0];
               boolean res = new RoleRightClientDelegate(LogonApplication.getUserEntityObject()).clearRight(curRole.getId(),currentUserName,1);
               frame.setProcessBarCancel(true);
               if(res){
                  VCIOptionPane.showMessage(LogonApplication.frame, "UI操作权限清空成功!");
               }
               if(refresh){
                  treeManager.getSelectionModel().clearSelection();
                  initRoleRight(curRole.getId());
               }
            } catch (VCIException e1) {
               e1.printStackTrace();
               VCIOptionPane.showError(LogonApplication.frame, "RMIPFramework", e1);
            } finally {
               frame.setProcessBarCancel(true);
            }
         }
      };
      bar = new QANProcessBar(t, frame, frame,"UI操作授权",false);
      bar.setVisible(true);
   }*/
   /*
    * 该方法作为补充添加授权功能应用
    */
   private void reAdd_actionPerform(){
      if (!checkItem()) {
         return;
      }
      TreePath[] treePath = treeManager.getSelectionModel().getSelectionPaths();
      if (treePath == null || treePath.length == 0) {
         VCIOptionPane.showMessage(LogonApplication.frame, "您没有在当前页面选择任何的权限,所以将不执行追加权限");
         return ;
      }
      final QANProcessBarFrame frame = new QANProcessBarFrame();
      Thread t = new Thread(){
         public void run() {
            frame.setContent("正在授权,请稍等......");
            try {
               rightMap.clear();
               boolean refresh = true;
               TreePath[] treePath = treeManager.getSelectionModel().getSelectionPaths();
               //当没有选中模块的时候
               if (treePath == null) {
                  refresh = false;
               }
               RoleRightObject[] roleRightObjs = getSelectedRoleRightObjs(treePath);
               boolean res = new RoleRightClientDelegate(LogonApplication.getUserEntityObject()).addRoleRight(roleRightObjs,curRole.getId(),currentUserName);
               frame.setProcessBarCancel(true);
               if(res){
                  VCIOptionPane.showMessage(LogonApplication.frame, "功能模块授权成功!");
               }
               if(refresh){
                  treeManager.getSelectionModel().clearSelection();
                  initRoleRight(curRole.getId());
               }
            } catch (VCIException e1) {
               e1.printStackTrace();
               VCIOptionPane.showError(LogonApplication.frame, "RMIPFramework", e1);
            } finally {
               if (frame.isActive()) {
                  frame.setProcessBarCancel(true);
               }
            }
         }
      };
      QANProcessBar bar = new QANProcessBar(t, frame, frame,"功能模块授权",false);
      bar.setVisible(true);
   }
//   private void reAdd_actionPerform(){
//      if (!checkItem()) {
//         return;
//      }
//      TreePath[] treePath = treeManager.getSelectionModel().getSelectionPaths();
//      if (treePath == null || treePath.length == 0) {
//         VCIOptionPane.showMessage(LogonApplication.frame, "您没有在当前页面选择任何的权限,所以将不执行追加权限");
//         return ;
//      }
//      final QANProcessBarFrame frame = new QANProcessBarFrame();
//      Thread t = new Thread(){
//         public void run() {
//            frame.setContent("正在授权,请稍等......");
//            try {
//               rightMap.clear();
//               boolean refresh = true;
//               TreePath[] treePath = treeManager.getSelectionModel().getSelectionPaths();
//               //当没有选中模块的时候
//               if (treePath == null) {
//                  refresh = false;
//               }
//               RoleRightObject[] roleRightObjs = getSelectedRoleRightObjs(treePath);
//               boolean res = new RoleRightClientDelegate(LogonApplication.getUserEntityObject()).addRoleRight(roleRightObjs,curRole.getId(),currentUserName);
//               frame.setProcessBarCancel(true);
//               if(res){
//                  VCIOptionPane.showMessage(LogonApplication.frame, "功能模块授权成功!");
//               }
//               if(refresh){
//                  treeManager.getSelectionModel().clearSelection();
//                  initRoleRight(curRole.getId());
//               }
//            } catch (VCIException e1) {
//               e1.printStackTrace();
//               VCIOptionPane.showError(LogonApplication.frame, "RMIPFramework", e1);
//            } finally {
//               if (frame.isActive()) {
//                  frame.setProcessBarCancel(true);
//               }
//            }
//         }
//      };
//      QANProcessBar bar = new QANProcessBar(t, frame, frame,"功能模块授权",false);
//      bar.setVisible(true);
//   }
   
   private RoleRightObject[] getSelectedRoleRightObjs(TreePath[] treePath){
      rightMap.clear();