Example #1
0
        public void onSuccess(GWTFolder result) {
          // Only executes on initalization and the actualItem is root
          // element on initialization
          // We put the id on root
          actualItem.setUserObject(result);
          evaluesFolderIcon(actualItem);
          actualItem.setState(true);
          actualItem.setSelected(true);

          // Enables or disables move button ( evalues security to move to folder with permissions )
          evaluateSecurityToAction(actualItem);

          getChilds(result.getPath());
        }
Example #2
0
  /** Resets all tree values */
  public void reset() {
    actualItem = rootItem;
    actualItem.setSelected(true);
    while (actualItem.getChildCount() > 0) {
      actualItem.getChild(0).remove();
    }

    int mainPanelView = Main.get().mainPanel.desktop.navigator.getStackIndex();

    switch (mainPanelView) {
      case UIDesktopConstants.NAVIGATOR_TAXONOMY:
      case UIDesktopConstants.NAVIGATOR_TRASH:
        Main.get().activeFolderTree.folderSelectPopup.enableTaxonomy();
        getRoot();
        break;

      case UIDesktopConstants.NAVIGATOR_CATEGORIES:
        Main.get().activeFolderTree.folderSelectPopup.enableCategories();
        getCategories();
        break;

      case UIDesktopConstants.NAVIGATOR_TEMPLATES:
        switch (Main.get().activeFolderTree.folderSelectPopup.getAction()) {
          case FolderSelectPopup.ACTION_CREATE_FROM_TEMPLATE:
            Main.get().activeFolderTree.folderSelectPopup.enableTaxonomy();
            getRoot();
            break;

          default:
            Main.get().activeFolderTree.folderSelectPopup.enableTemplates();
            getTemplatesFolder();
            break;
        }

        break;

      case UIDesktopConstants.NAVIGATOR_PERSONAL:
        Main.get().activeFolderTree.folderSelectPopup.enableMyDocuments();
        getPersonal();
        break;

      case UIDesktopConstants.NAVIGATOR_MAIL:
        Main.get().activeFolderTree.folderSelectPopup.enableMails();
        getMail();
        break;
    }
  }
 @Override
 public void onSelection(SelectionEvent<TreeItem> event) {
   TreeItem item = event.getSelectedItem();
   currentlySelected = item;
   TreeItem child = item.getChild(0);
   if (child != null && child.getText().equals(DatasetWidget.LOADING)) {
     CategorySerializable cat = (CategorySerializable) item.getUserObject();
     Util.getRPCService().getCategories(cat.getID(), null, categoryCallback);
   }
   // Open the item.  Work around double firing bug.
   // http://code.google.com/p/google-web-toolkit/issues/detail?id=3660&q=Tree%20selection&colspec=ID%20Type%20Status%20Owner%20Milestone%20Summary%20Stars
   TreeItem selItem = event.getSelectedItem();
   TreeItem parent = selItem.getParentItem();
   selItem.getTree().setSelectedItem(parent, false); // null is ok
   if (parent != null) parent.setSelected(false); // not compulsory
   selItem.setState(!selItem.getState(), false);
 }
Example #4
0
  /** Folder Tree */
  public FolderSelectTree() {
    tree = new Tree();
    rootItem.setStyleName("okm-TreeItem");
    rootItem.setUserObject(new GWTFolder());
    rootItem.setSelected(true);
    rootItem.setState(true);
    tree.setStyleName("okm-Tree");
    tree.addItem(rootItem);
    tree.addSelectionHandler(
        new SelectionHandler<TreeItem>() {

          @Override
          public void onSelection(SelectionEvent<TreeItem> event) {
            boolean refresh = true;
            TreeItem item = event.getSelectedItem();

            // Enables or disables move button ( evalues security to move to folder with permissions
            // )
            evaluateSecurityToAction(item);

            // Case that not refreshing tree and file browser ( right click )
            if (actualItem.equals(item)) {
              refresh = false;
            } else {
              // Disables actual item because on changing active node by
              // application this it's not changed automatically
              if (!actualItem.equals(item)) {
                actualItem.setSelected(false);
                actualItem = item;
              } else {
                refresh = false;
              }
            }

            if (refresh) {
              refresh(true);
            }
          }
        });
    actualItem = tree.getItem(0);
    initWidget(tree);
  }