Ejemplo n.º 1
0
  @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);
  }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 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);
   }
 }
Ejemplo n.º 4
0
 private void setDialogDebugIds(IPlantDialog dialog) {
   dialog.ensureDebugId(Belphegor.MetadataIds.EDIT_DIALOG);
   dialog
       .getOkButton()
       .ensureDebugId(Belphegor.MetadataIds.EDIT_DIALOG + Belphegor.MetadataIds.OK);
 }