Example #1
0
 public void treeExpanded(TreeExpansionEvent event) {
   TreePath treePath = event.getPath();
   if (treePath != null) {
     TreeUINode targetNode = (TreeUINode) treePath.getLastPathComponent();
     if (!targetNode.isChildrenLoaded()) {
       String targetPathText = TreeUtil.makePathText(treePath);
       String absPathText = PathUtil.makeChildPath(_tree.getRelativeRoot(), targetPathText);
       expandNode(targetNode, absPathText);
     }
   }
 }
Example #2
0
 private HashMap expandNode(TreeUINode targetNode, String absPathText) {
   HashMap vals = null;
   try {
     vals = getBizContext().getBizContent().list(absPathText, List_Attrs);
   } catch (KDRSException e1) {
     log.error("取文件夹内容列表时发生异常。", e1);
   }
   if (vals != null) {
     targetNode.setUserObject(vals);
     targetNode.setChildrenLoaded(true);
     createUnloadedChildNode(targetNode, vals);
   }
   return vals;
 }
Example #3
0
 public boolean showDialog() {
   if (!isAddControls) {
     String absPath = PathUtil.makeChildPath("/EAS_Note.kdrs", _tree.getPathTextToShow());
     HashMap multiResult[] = null;
     if (_rpcReducer != null)
       try {
         multiResult =
             (HashMap[])
                 (HashMap[])
                     _rpcReducer.getBatchResult(
                         "IBizContent.list2", new Object[] {absPath, List_Attrs});
       } catch (NotFoundException e) {
         WindowUtil.msgboxError(
             (new StringBuilder())
                 .append(
                     MultiLanguageUtil.getMLS("ui.NoteFileDialogEx.pathError1", "程序指定模板所在文件夹:"))
                 .append(_tree.getPathTextToShow())
                 .append(
                     MultiLanguageUtil.getMLS(
                         "ui.NoteFileDialogEx.pathError", "不存在,请联系套打管理员检查套打管理中该路径是否正确!"))
                 .toString(),
             MultiLanguageUtil.getMLS("ui.NoteFileDialogEx.pathErrorTitle", "路径错误"),
             this);
         return false;
       } catch (KDRSException e) {
         log.error("GetBatchResult list2 error.", e);
       }
     else
       try {
         multiResult = getBizContext().getBizContent().list2(absPath, List_Attrs);
       } catch (NotFoundException e) {
         WindowUtil.msgboxError(
             (new StringBuilder())
                 .append(
                     MultiLanguageUtil.getMLS("ui.NoteFileDialogEx.pathError1", "程序指定模板所在文件夹:"))
                 .append(_tree.getPathTextToShow())
                 .append(
                     MultiLanguageUtil.getMLS(
                         "ui.NoteFileDialogEx.pathError", "不存在,请联系套打管理员检查套打管理中该路径是否正确!"))
                 .toString(),
             MultiLanguageUtil.getMLS("ui.NoteFileDialogEx.pathErrorTitle", "路径错误"),
             this);
         return false;
       } catch (KDRSException e) {
         log.error("", e);
         if (e instanceof NotFoundException) {
           WindowUtil.msgboxError(
               (new StringBuilder())
                   .append(
                       MultiLanguageUtil.getMLS("ui.NoteFileDialogEx.pathError1", "程序指定模板所在文件夹:"))
                   .append(_tree.getPathTextToShow())
                   .append(
                       MultiLanguageUtil.getMLS(
                           "ui.NoteFileDialogEx.pathError", "不存在,请联系套打管理员检查套打管理中该路径是否正确!"))
                   .toString(),
               MultiLanguageUtil.getMLS("ui.NoteFileDialogEx.pathErrorTitle", "路径错误"),
               this);
           return false;
         }
       }
     TreeUINode node = _tree.getTreeUI().getRootNode();
     node.setChildrenLoaded(true);
     if (multiResult != null) {
       int relaRootDeep = PathUtil.splitPath("/EAS_Note.kdrs").length - 1;
       int i = relaRootDeep;
       do {
         if (i >= multiResult.length - 1) break;
         String name = (String) multiResult[i].get("name");
         String alias = (String) multiResult[i].get("alias");
         TreeUINode childNode;
         try {
           childNode = _tree.newTreeNode("folder", name, alias);
         } catch (Exception e) {
           log.error("", e);
           break;
         }
         _tree.getTreeUI().addChildNode(childNode, node);
         childNode.setChildrenLoaded(true);
         node = childNode;
         i++;
       } while (true);
       node.setUserObject(multiResult[multiResult.length - 1]);
       createUnloadedChildNode(node, multiResult[multiResult.length - 1]);
       _tree.getTreeUI().setSelectionNode(node);
       _tree.getTreeUI().expand(_tree.getTreeUI().getSelectionPath());
     }
   }
   return super.showDialog();
 }
Example #4
0
  private void refreshTemplateList() {
    TreeUINode selectedNode = _tree.getTreeUI().getSelectionNode();
    HashMap cacheValues = (HashMap) selectedNode.getUserObject();
    super.btnOk.setEnabled(false);
    _lstFile.removeAllElements();
    HashMap vals = null;
    if (cacheValues == null) {
      if (selectedNode.isChildrenLoaded()) return;
      vals = expandNode(selectedNode, getNoteDir());
    } else {
      vals = cacheValues;
    }
    if (vals == null) return;
    String names[] = (String[]) (String[]) vals.get("name");
    String alias[] = (String[]) (String[]) vals.get("alias");
    String categories[] = (String[]) (String[]) vals.get("category");
    String orgss[] = (String[]) (String[]) vals.get("eas_template_relation_orgs");
    if (names != null && log.isDebugEnabled())
      log.debug((new StringBuilder()).append("entries:").append(names.length).toString());
    boolean doFilter = _rightPanel.cbUseOrgFilter.isSelected();
    int idxKDFStart = 0;
    IBizContent bizCtn = _tree.getBizContent();
    for (int i = 0; i < names.length; i++) {
      boolean isKDF = "kdrs-form".equals(categories[i]);
      boolean isR1 = "r1-print".equals(categories[i]);
      if (!isKDF && !isR1 || !_rightPanel.lang.equal(Language.readTempLang(names[i])) && !isKDF)
        continue;
      try {
        boolean isCanUse =
            NoteUseUtil.isCanUse(
                bizCtn,
                (new StringBuilder())
                    .append(((ResObjectNode) selectedNode).getResPath())
                    .append("/")
                    .append(names[i])
                    .toString());
        if (!isCanUse) continue;
      } catch (KDRSException ex) {
        log.debug(
            (new StringBuilder())
                .append(selectedNode)
                .append("获取属性:NoteUseUtil.")
                .append("user_enabled_users")
                .append("失败")
                .toString());
        continue;
      }
      if (doFilter
          && (orgss[i] == null
              || orgss[i].length() == 0
              || orgss[i].indexOf(NoteUtil.getCurrentOrgUnitId()) == -1)) {
        if (log.isDebugEnabled())
          log.debug(
              (new StringBuilder())
                  .append("ignore teplate/r1templat:")
                  .append(names[i])
                  .toString());
        continue;
      }
      ListElement element = new ListElement(names[i], alias[i], categories[i]);
      element.setSeleted(true);
      int idx = idxKDFStart;
      if (isR1) {
        int j = 0;
        do {
          if (j >= idxKDFStart) break;
          if (element.compareTo(_lstFile.getElement(j)) < 0) {
            idx = j;
            break;
          }
          j++;
        } while (true);
        idxKDFStart++;
      } else if (isKDF) {
        int j = _lstFile.getElementCount() - 1;
        do {
          if (j < idxKDFStart) break;
          if (element.compareTo(_lstFile.getElement(j)) > 0) {
            idx = j + 1;
            break;
          }
          j--;
        } while (true);
      }
      _lstFile.insertElement(element, idx);
    }

    if (_lstFile.getElementCount() > 0) _lstFile.setSelectedIndex(0);
    btnOk.setEnabled(_lstFile.getSelectedIndex() != -1);
  }