public void build(
      final List<FolderItem> segments,
      final FolderItem file,
      final ParameterizedCommand<FolderItem> onPathClick,
      final Dropdown... headers) {

    build(headers);

    if (segments != null) {
      for (final FolderItem activeItem : segments) {
        breadcrumbs.add(
            new NavLink(activeItem.getFileName()) {
              {
                setStyleName(NavigatorResources.INSTANCE.css().directory());
                addClickHandler(
                    new ClickHandler() {
                      @Override
                      public void onClick(ClickEvent event) {
                        onPathClick.execute(activeItem);
                      }
                    });
              }
            });
      }
      if (file != null) {
        breadcrumbs.add(
            new ListItem(new InlineLabel(file.getFileName())) {
              {
                setStyleName(NavigatorResources.INSTANCE.css().directory());
              }
            });
      }
    }
  }
 private void setResourceToLoad(final FolderItem folderItem) {
   if (folderItem.getType().equals(FolderItemType.FILE) && folderItem.getItem() instanceof Path) {
     if (((Path) folderItem.getItem()).getFileName().indexOf(CURRENT_RESOURCE) > -1) {
       _item = folderItem.getItem();
     }
   }
 }
 @Override
 public void itemSelected(final FolderItem folderItem) {
   final Object _item = folderItem.getItem();
   if (_item == null) {
     return;
   }
   if (folderItem.getType().equals(FolderItemType.FILE) && _item instanceof Path) {
     placeManager.goTo((Path) _item);
   } else {
     activeFolderItemSelected(folderItem);
   }
 }
  @Override
  public void setItems(final FolderListing folderListing) {
    itemsContainer.clear();
    sortedFolderItems.clear();
    for (final FolderItem content : folderListing.getContent()) {
      if (!content.getType().equals(FolderItemType.FOLDER)) {
        sortedFolderItems.add(content);
      }
    }

    if (!sortedFolderItems.isEmpty()) {
      final Map<ClientResourceType, Collection<FolderItem>> resourceTypeGroups =
          classifier.group(sortedFolderItems);
      final TreeMap<ClientResourceType, Collection<FolderItem>> sortedResourceTypeGroups =
          new TreeMap<ClientResourceType, Collection<FolderItem>>(
              Sorters.RESOURCE_TYPE_GROUP_SORTER);
      sortedResourceTypeGroups.putAll(resourceTypeGroups);

      final Iterator<Map.Entry<ClientResourceType, Collection<FolderItem>>> itr =
          sortedResourceTypeGroups.entrySet().iterator();
      while (itr.hasNext()) {
        final Map.Entry<ClientResourceType, Collection<FolderItem>> e = itr.next();

        final CollapseTrigger collapseTrigger = makeTriggerWidget(e.getKey());

        final Collapse collapse = new Collapse();
        collapse.setExistTrigger(true);
        collapse.setId(getCollapseId(e.getKey()));
        final NavList itemsNavList = new NavList();
        collapse.add(itemsNavList);
        for (FolderItem folderItem : e.getValue()) {
          if (folderItem.getItem() != null) {
            setResourceToLoad(folderItem);
          }
        }
        collapse.setDefaultOpen(false);

        itemsContainer.add(collapseTrigger);
        itemsContainer.add(collapse);
        if (itr.hasNext()) {
          itemsContainer.add(new Divider());
        }
      }
      loadResourceSelected();

    } else {
      itemsContainer.add(new Label(ProjectExplorerConstants.INSTANCE.noItemsExist()));
    }
  }
Exemplo n.º 5
0
  void fireContextChangeEvent() {
    if (activeFolderItem == null) {
      contextChangedEvent.fire(
          new ProjectContextChangeEvent(activeOrganizationalUnit, activeRepository, activeProject));
      return;
    }

    if (activeFolderItem.getItem() instanceof Package) {
      setActivePackage((Package) activeFolderItem.getItem());
      contextChangedEvent.fire(
          new ProjectContextChangeEvent(
              activeOrganizationalUnit, activeRepository, activeProject, activePackage));
    } else if (activeFolderItem.getType().equals(FolderItemType.FOLDER)) {
      explorerService.call(getResolvePackageRemoteCallback()).resolvePackage(activeFolderItem);
    }
  }
Exemplo n.º 6
0
  boolean setupActiveFolderAndPackage(final ProjectExplorerContent content) {
    if (Utils.hasFolderItemChanged(content.getFolderListing().getItem(), activeFolderItem)) {
      setActiveFolderItem(content.getFolderListing().getItem());
      if (activeFolderItem != null
          && activeFolderItem.getItem() != null
          && activeFolderItem.getItem() instanceof Package) {
        setActivePackage((Package) activeFolderItem.getItem());
      } else if (activeFolderItem == null || activeFolderItem.getItem() == null) {
        setActivePackage(null);
      }

      return true;
    } else {
      return false;
    }
  }
  private void fireContextChangeEvent() {
    if (activeFolderItem == null) {
      contextChangedEvent.fire(
          new ProjectContextChangeEvent(activeOrganizationalUnit, activeRepository, activeProject));
      return;
    }

    if (activeFolderItem.getItem() instanceof Package) {
      activePackage = (Package) activeFolderItem.getItem();
      contextChangedEvent.fire(
          new ProjectContextChangeEvent(
              activeOrganizationalUnit, activeRepository, activeProject, activePackage));
    } else if (activeFolderItem.getType().equals(FolderItemType.FOLDER)) {
      explorerService
          .call(
              new RemoteCallback<Package>() {
                @Override
                public void callback(final Package pkg) {
                  if (Utils.hasPackageChanged(pkg, activePackage)) {
                    activePackage = pkg;
                    contextChangedEvent.fire(
                        new ProjectContextChangeEvent(
                            activeOrganizationalUnit,
                            activeRepository,
                            activeProject,
                            activePackage));
                  } else {
                    contextChangedEvent.fire(
                        new ProjectContextChangeEvent(
                            activeOrganizationalUnit, activeRepository, activeProject));
                  }
                }
              })
          .resolvePackage(activeFolderItem);
    }
  }
  private IsWidget makeItemNavLink(
      final ClientResourceType resourceType, final FolderItem folderItem) {
    String fileName = folderItem.getFileName();
    if (!(resourceType instanceof AnyResourceType)) {
      fileName = Utils.getBaseFileName(fileName);
    }
    fileName = fileName.replaceAll(" ", "\u00a0");
    final NavLink navLink = new NavLink(fileName);
    navLink.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            Window.alert("click en el boton del resurso");
            presenter.itemSelected(folderItem);
          }
        });
    return navLink;
  }