Ejemplo n.º 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);
     }
   }
 }
Ejemplo n.º 2
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);
  }