@Override
  public void onAddMetadataSelected(AddMetadataSelectedEvent event) {
    final IPlantDialog d = createEditDialog();
    d.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.SEVERE, sp.getPayload());
              doAddOrUpdate(d, null, sp.getPayload());
            } else {
              IplantAnnouncer.getInstance()
                  .schedule(new ErrorAnnouncementConfig(appearance.enumError()));
            }
          }
        });
    d.addCancelButtonSelectHandler(
        new SelectHandler() {

          @Override
          public void onSelect(SelectEvent event) {
            d.hide();
          }
        });
    d.show();
    setDialogDebugIds(d);
  }
 private IPlantDialog createEditDialog() {
   final IPlantDialog d = new IPlantDialog();
   d.setHeadingText(appearance.templateAttributeEditorHeading());
   editView.reset();
   d.add(editView.asWidget());
   d.setSize("800px", "600px");
   d.setHideOnButtonClick(false);
   return d;
 }
Пример #3
0
 @Override
 protected void onButtonPressed(TextButton button) {
   if (button.getText().equals(PredefinedButton.OK.toString())) {
     // Validate current card
     boolean isValid = FormPanelHelper.isValid((HasWidgets) cardLC.getActiveWidget());
     if (isValid) {
       super.onButtonPressed(button);
     }
   } else {
     super.onButtonPressed(button);
   }
 }
 private void setDialogDebugIds(IPlantDialog dialog) {
   dialog.ensureDebugId(Belphegor.MetadataIds.EDIT_DIALOG);
   dialog
       .getOkButton()
       .ensureDebugId(Belphegor.MetadataIds.EDIT_DIALOG + Belphegor.MetadataIds.OK);
 }