@Override
  public void onEditMetadataSelected(EditMetadataSelectedEvent event) {
    MetadataTemplateInfo template = event.getTemplateInfo();
    drSvcFac.getMetadataTemplate(
        template.getId(),
        new AsyncCallback<MetadataTemplate>() {

          @Override
          public void onSuccess(MetadataTemplate result) {
            final IPlantDialog id = createEditDialog();
            editView.edit(result);
            id.addOkButtonSelectHandler(
                new SelectHandler() {

                  @Override
                  public void onSelect(SelectEvent event) {
                    if (editView.validate()) {
                      MetadataTemplate template = editView.getTemplate();
                      Splittable sp = AutoBeanCodex.encode(AutoBeanUtils.getAutoBean(template));
                      LOG.log(Level.INFO, sp.getPayload());
                      doAddOrUpdate(id, template.getId(), sp.getPayload());
                    } else {
                      IplantAnnouncer.getInstance()
                          .schedule(new ErrorAnnouncementConfig(appearance.enumError()));
                    }
                  }
                });

            id.addCancelButtonSelectHandler(
                new SelectHandler() {

                  @Override
                  public void onSelect(SelectEvent event) {
                    id.hide();
                  }
                });
            id.show();
            setDialogDebugIds(id);
          }

          @Override
          public void onFailure(Throwable caught) {
            ErrorHandler.post(appearance.templateRetrieveError(), caught);
          }
        });
  }
Exemple #2
0
 @Override
 public void render(Cell.Context context, MetadataTemplateInfo value, SafeHtmlBuilder sb) {
   appearance.render(sb, value.getId());
 }
Exemple #3
0
 private void doOnClick(Element eventTarget, MetadataTemplateInfo value) {
   EventBus.getInstance().fireEvent(new TemplateDownloadEvent(value.getId()));
 }