Ejemplo n.º 1
0
  public void objectsChanged(int mode, IDfPersistentObject[] objects) {

    // String selected = (String)combo.getSelectedItem();

    for (int i = 0; i < objects.length; i++) {
      if (objects[i] instanceof IDfSysObject) {
        IDfSysObject sys = (IDfSysObject) objects[i];

        try {

          if (mode == ApiObjectChanged.DELETED) {
            tree.objectDelete(sys.getObjectId());
          } else {

            for (int j = 0; j < sys.getFolderIdCount(); j++) {
              IDfFolder folderObject =
                  (IDfFolder) con.getExistingObject(((IDfSysObject) objects[i]).getFolderId(j));

              String folder = folderObject.getString("r_folder_path");

              // if ( folder.startsWith( selected ) ||
              // "[All]".equals( selected ) ) {
              if (mode == ApiObjectChanged.CREATED) tree.objectAdd(objects[i]);
              else if (mode == ApiObjectChanged.CHANGED) tree.objectUpdate(objects[i]);
              // }
            }
          }
        } catch (DfException e) {
          e.printStackTrace();
        }
      }
    }
  }
Ejemplo n.º 2
0
  protected void apiObjectHotSelected0(
      DMConnection con, IDfPersistentObject[] parents2, IDfPersistentObject[] obj)
      throws Exception {

    if (!TREE_HOT_SELECT) return;

    if (obj == null || obj.length != 1) return;

    String path = ObjectTool.getPath(obj[0]);

    boolean flag = true;
    DefaultMutableTreeNode docbasetreenode = tree.getRootNode();

    Vector vector = new Vector();
    vector.addElement(tree.getRootNode());
    for (StringTokenizer stringtokenizer = new StringTokenizer(path, "/");
        stringtokenizer.hasMoreElements(); ) {
      String s1 = stringtokenizer.nextToken();

      DefaultMutableTreeNode docbasetreenode1 = null;
      for (Enumeration enumeration = docbasetreenode.children(); enumeration.hasMoreElements(); ) {
        DefaultMutableTreeNode docbasetreenode2 =
            (DefaultMutableTreeNode) enumeration.nextElement();
        Object uo = docbasetreenode2.getUserObject();
        if (uo instanceof ContentTree.NodeValue) {
          if (stringtokenizer.hasMoreTokens()) {
            if (((ContentTree.NodeValue) uo).getName().equals(s1)) {
              docbasetreenode1 = docbasetreenode2;
              break;
            }
          } else {
            // find last element by id
            if (((ContentTree.NodeValue) uo).getId().equals(obj[0].getObjectId())) {
              docbasetreenode1 = docbasetreenode2;
              break;
            }
          }
        }
      }
      if (docbasetreenode1 != null) {

        tree.loadChilds(docbasetreenode1, false);
        vector.addElement(docbasetreenode1);
        docbasetreenode = docbasetreenode1;
      } else if (!stringtokenizer.hasMoreTokens()) flag = false;
    }

    TreePath treePath = vectorToPath(vector);
    tree.getTree().expandPath(treePath);
    tree.getTree().setSelectionPath(treePath);
    tree.getTree().scrollPathToVisible(treePath);
  }
Ejemplo n.º 3
0
  private void actionHotSelect() {
    // combo.setEnabled( false );
    try {
      treepanel.removeAll();
      treepanel.add(new JLabel("Loading...", LUF.DOT_RED, JLabel.CENTER));
      addWorkInProgress();
      treepanel.revalidate();
      treepanel.repaint();
      // String folderName = (String)combo.getSelectedItem();
      IDfId folderId = null;
      /*
       * if ( !"[All]".equals( folderName ) ) { IDfFolder folder =
       * con.getSession().getFolderByPath( folderName ); if( folder ==
       * null ) {
       * System.out.println("Folder or cabinet does not exist in the Docbase!"
       * ); return; } folderId = folder.getObjectId(); }
       */

      tree =
          new ContentTree(con, folderId, timer, (ApiTypes) node.getSingleApi(ApiTypes.class), this);
      tree.setShowDocuments(showDocuments);
      treepanel.removeAll();
      removeWorkInProgress();
      treepanel.add(tree, BorderLayout.CENTER);
    } catch (Exception ex) {
      ex.printStackTrace();
    }
    // combo.setEnabled( true );
    treepanel.revalidate();
    treepanel.repaint();
  }