示例#1
0
  private void setupPackagesTree() {
    TreeItem packageRootNode =
        new TreeItem(Util.getHeader(images.chartOrganisation(), constants.Packages()));
    setupPackageNode(packageRootNode);
    mainTree.addItem(packageRootNode);

    setupGlobalNode(mainTree, itemWidgets);
  }
示例#2
0
  private void showNewCommentButton() {
    newCommentLayout.clear();

    HorizontalPanel hp = new HorizontalPanel();

    Button createNewComment = new Button(constants.AddADiscussionComment());
    createNewComment.setEnabled(!this.readOnly);
    hp.add(createNewComment);

    if (UserCapabilities.INSTANCE.hasCapability(Capability.SHOW_ADMIN)) {
      Button adminClearAll = new Button(constants.EraseAllComments());
      adminClearAll.setEnabled(!readOnly);
      hp.add(adminClearAll);
      adminClearAll.addClickHandler(
          new ClickHandler() {
            public void onClick(ClickEvent sender) {
              if (Window.confirm(constants.EraseAllCommentsWarning())) {
                assetService.clearAllDiscussionsForAsset(
                    artifact.getUuid(),
                    new GenericCallback<java.lang.Void>() {
                      public void onSuccess(Void v) {
                        updateCommentList(new ArrayList<DiscussionRecord>());
                      }
                    });
              }
            }
          });
    }

    final String feedURL =
        GWT.getModuleBaseURL()
            + "feed/discussion?package="
            + ((Asset) artifact).getMetaData().getModuleName()
            + "&assetName="
            + URL.encode(artifact.getName())
            + "&viewUrl="
            + Util.getSelfURL();
    Image image = new Image(images.feed());
    image.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent arg0) {
            Window.open(feedURL, "_blank", null);
          }
        });
    hp.add(image);

    newCommentLayout.add(hp);

    newCommentLayout.setCellHorizontalAlignment(hp, HasHorizontalAlignment.ALIGN_RIGHT);
    createNewComment.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent sender) {
            showAddNewComment();
          }
        });
  }
示例#3
0
  private void buildPkgTree(TreeItem root, PackageHierarchy.Folder folder) {
    if (folder.getConfig() != null) {
      root.addItem(loadPackage(folder.getName(), folder.getConfig()));
    } else {
      TreeItem treeItem = new TreeItem(Util.getHeader(images.emptyPackage(), folder.getName()));
      root.addItem(treeItem);

      for (PackageHierarchy.Folder childFolder : folder.getChildren()) {
        buildPkgTree(treeItem, childFolder);
      }
    }
  }
示例#4
0
  private void buildPkgTree(TreeItem root, PackageHierarchy.Folder fldr) {
    if (fldr.conf != null) {
      root.addItem(loadPackage(fldr.name, fldr.conf));
    } else {
      TreeItem tn = new TreeItem(Util.getHeader(images.emptyPackage(), fldr.name));
      // itemWidgets.put(item, AssetFormats.BUSINESS_RULE_FORMATS[0]);
      root.addItem(tn);

      for (PackageHierarchy.Folder c : fldr.children) {
        buildPkgTree(tn, c);
      }
    }
  }
示例#5
0
  private void setupPackagesTree() {
    TreeItem packageRootNode =
        mainTree.addItem(Util.getHeader(images.chartOrganisation(), constants.Packages()));
    packageRootNode.setState(true);
    loadPackages(packageRootNode, itemWidgets);
    mainTree.addItem(packageRootNode);

    loadGlobal(mainTree, itemWidgets);

    /*            @Override
    public void onCollapseNode(final TreeItem node) {
        if (node.getText().equals(constants.Packages())) {
            Node[] children = node.getChildNodes();
            for (Node child : children) {
                node.removeChild(child);
            }
            loadPackages(node, itemWidgets);
        }
    }*/

    // return mainTree;
  }