Пример #1
0
 private void saveTaxonomy() {
   UriBuilders.SYSTEM_CONF_TAXONOMY.create().build(taxonomy.getName());
   fireEvent(new TaxonomyUpdatedEvent(taxonomy.getName()));
   ResourceRequestBuilderFactory.<TaxonomyDto>newBuilder()
       .forResource(UriBuilders.SYSTEM_CONF_TAXONOMY.create().build(taxonomy.getName())) //
       .withResourceBody(TaxonomyDto.stringify(taxonomy)) //
       .withCallback(
           new ResponseCodeCallback() {
             @Override
             public void onResponseCode(Request request, Response response) {
               getEventBus().fireEvent(new TaxonomyUpdatedEvent(taxonomy.getName()));
               getView().setDirty(false);
             }
           },
           Response.SC_OK,
           Response.SC_CREATED) //
       .withCallback(
           new ResponseCodeCallback() {
             @Override
             public void onResponseCode(Request request, Response response) {
               if (response.getText() != null && !response.getText().isEmpty()) {
                 fireEvent(NotificationEvent.newBuilder().error(response.getText()).build());
               }
             }
           },
           Response.SC_BAD_REQUEST,
           Response.SC_INTERNAL_SERVER_ERROR) //
       .put()
       .send();
 }
Пример #2
0
  protected Widget newTaxonomyLink(
      final TaxonomiesUiHandlers handlers, final TaxonomyDto taxonomy) {
    FlowPanel titlePanel = new FlowPanel();
    Label taxonomyTitle = new Label(taxonomy.getName());
    taxonomyTitle.addStyleName("inline-block");
    taxonomyTitle.setTitle(taxonomy.getName());
    taxonomyTitle.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent clickEvent) {
            handlers.onTaxonomySelection(taxonomy);
          }
        });

    titlePanel.add(taxonomyTitle);
    IconAnchor edit = new IconAnchor();
    edit.setIcon(IconType.EDIT);
    edit.addStyleName("small-dual-indent");
    edit.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent clickEvent) {
            handlers.onTaxonomyEdit(taxonomy);
          }
        });

    titlePanel.add(edit);

    Heading head = new Heading(4);
    head.addStyleName("inline-block small-right-indent");
    head.add(titlePanel);
    return head;
  }
Пример #3
0
  private void retrieveCommitInfos() {
    String requestUri =
        UriBuilders.SYSTEM_CONF_TAXONOMY_COMMITS_INFO.create().build(taxonomy.getName());

    ResourceRequestBuilderFactory.<VcsCommitInfosDto>newBuilder() //
        .forResource(requestUri)
        .withCallback(
            new ResourceCallback<VcsCommitInfosDto>() {
              @Override
              public void onResource(Response response, VcsCommitInfosDto commitInfos) {
                getView().setData(commitInfos.getCommitInfosArray());
              }
            })
        .get()
        .send();
  }
Пример #4
0
 @Override
 public void onResetChanges() {
   refreshTaxonomy(taxonomy.getName());
 }
Пример #5
0
 @Override
 public void onDownload() {
   String downloadUrl =
       UriBuilders.SYSTEM_CONF_TAXONOMY.create().build(taxonomy.getName()) + "/_download";
   fireEvent(new FileDownloadRequestEvent(downloadUrl));
 }