Example #1
0
  @Override
  public void deleteButtonClick(EditionToolbar.ClickNavigationEvent event) {
    final Calendar editingCalendar = (Calendar) event.getRegister();

    ConfirmDialog.show(
        getWindow(),
        "Borrar Calendario",
        "¿Estás seguro?",
        "Si",
        "No",
        new ConfirmDialog.Listener() {

          public void onClose(ConfirmDialog dialog) {
            if (dialog.isConfirmed()) {
              try {
                calendarService.delete(editingCalendar);

                bsCalendar.removeItem(editingCalendar);
              } catch (IllegalArgumentException e) {
                throw new RuntimeException("¡No se pudo borrar el calendario!", e);
              } catch (Exception e) {
                throw new RuntimeException("¡No se pudo borrar el calendario!", e);
              }
            }
          }
        });
  }
Example #2
0
  @Override
  public void onClose(ConfirmDialog dialog) {
    if (dialog.isConfirmed()) {
      eliminar();
    } else {

    }
  }
Example #3
0
  @Override
  public void buttonClick(ClickEvent event) {
    if (event.getButton() == this.btn_eliminar) {

      ConfirmDialog.show(getUI(), "", Messages.CONFIRM_DELETE_MESSAGE, "SI", "NO", this);
    }
    if (event.getButton() == this.btn_limpiar) {
      this.frm_organismo.update();
    }
  }
Example #4
0
  @Override
  public ConfirmDialog create(
      String caption, String message, String okCaption, String cancelCaption, String notOkCaption) {
    ConfirmDialog d = super.create(caption, message, okCaption, cancelCaption, notOkCaption);

    d.getContent().setStyleName("custom-dialog");
    d.getContent().setHeightUndefined();
    d.setHeightUndefined();

    Button ok = d.getOkButton();
    ok.setStyleName(UIConstants.BUTTON_ACTION);

    HorizontalLayout buttons = (HorizontalLayout) ok.getParent();
    buttons.setHeightUndefined();

    Button cancelBtn = d.getCancelButton();
    cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK);
    cancelBtn.focus();

    return d;
  }
 @SuppressWarnings("serial")
 @Override
 public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {
   if (event.getSource() == btnCreate) {
     createCategory();
   } else if (event.getSource() == btnUpdate) {
     ConfirmDialog.show(
         UI.getCurrent(),
         "Confirm update",
         "Are you sure you want to the update the selected category details?",
         "Yes",
         "No",
         new ConfirmDialog.Listener() {
           @Override
           public void onClose(ConfirmDialog dialog) {
             if (dialog.isConfirmed()) {
               updateCategory();
             }
           }
         });
   } else if (event.getSource() == btnDelete) {
     ConfirmDialog.show(
         UI.getCurrent(),
         "Confirm deletion",
         "Are you sure you want to the delete the selected category?",
         "Yes",
         "No",
         new ConfirmDialog.Listener() {
           @Override
           public void onClose(ConfirmDialog dialog) {
             if (dialog.isConfirmed()) {
               deleteCategory();
             }
           }
         });
   }
 }
  public void deleteForm() {
    final Object itemId = view.getTable().getValue();

    if (itemId != null) {
      ConfirmDialog.Listener konfirmDialogListener =
          new ConfirmDialog.Listener() {
            @Override
            public void onClose(ConfirmDialog dialog) {
              if (dialog.isConfirmed()) {
                // Confirmed to continue
                try {
                  model.getsMerkJpaService().removeObject(model.getItemHeader());

                  model.getBeanItemContainerHeader().removeItem(itemId);

                  view.getTable().refreshRowCache();
                  view.setDisplay();
                  Notification.show("Delete Sukses", Notification.TYPE_TRAY_NOTIFICATION);
                } catch (Exception ex) {
                  Notification.show("Error Delete!!", Notification.TYPE_TRAY_NOTIFICATION);
                }
              } else {
                // User did not confirm
              }
              view.getTable().focus();
            }
          };

      final ConfirmDialog d =
          ConfirmDialog.show(
              view.getUI(),
              "Konfirmasi Hapus",
              "Yakin akan hapus data?",
              "Oke Delete..",
              "Cancel",
              konfirmDialogListener);

      final ShortcutListener enter =
          new ShortcutListener("Oke", KeyCode.ENTER, null) {
            @Override
            public void handleAction(Object sender, Object target) {
              d.close();
            }
          };

      d.setStyleName("dialog");
      d.getOkButton().setStyleName("small");
      d.getCancelButton().setStyleName("small");
      d.focus();

    } else {
      Notification.show("Tidak ada yang dipilih!!!", Notification.TYPE_TRAY_NOTIFICATION);
    }
  }
  public int discardForm() {
    ConfirmDialog discardDialog =
        ConfirmDialog.show(
            view.getUI(),
            "Konfirmasi Discard",
            "Yakin keluar mode editing(discard)?",
            "Yes",
            "No",
            new ConfirmDialog.Listener() {
              public void onClose(ConfirmDialog dialog) {
                if (dialog.isConfirmed()) {
                  // Confirmed to continue
                  try {
                    // 1. form discard
                    model.getBinderHeader().discard();
                    model.setOperationStatus(EnumOperationStatus.OPEN.getStrCode());
                    view.setFormButtonAndTextState();
                    // 2. focust ke table
                    view.getTable().focus();

                  } catch (Exception ex) {
                    Notification.show(
                        "Terjadi Kesalahan Discard", Notification.TYPE_TRAY_NOTIFICATION);
                  }
                  view.closeWindowForm();
                } else {
                  view.focustIdOrDesc();
                }
              }
            });
    discardDialog.setStyleName("dialog");
    discardDialog.getOkButton().setStyleName("small");
    discardDialog.getCancelButton().setStyleName("small");
    // Jangan lupa
    discardDialog.focus();

    return 0;
  }
Example #8
0
 @Override
 public void onClose(ConfirmDialog dialog) {
   if (dialog.isConfirmed()) {
     deleteCompany();
   }
 }
  @Override
  public void buttonClick(ClickEvent event) {
    // TODO Auto-generated method stub
    // Antisipasi
    if (model.getOperationStatus() == null)
      model.setOperationStatus(EnumOperationStatus.OPEN.getStrCode());
    if (model.getOperationStatus().equals(""))
      model.setOperationStatus(EnumOperationStatus.OPEN.getStrCode());

    if (event.getButton() == view.getBtnNewForm()) {
      addItem();
      view.showWindowForm();
    } else if (event.getButton() == view.getBtnEditForm()) {
      view.showWindowForm();
    } else if (event.getButton() == view.getBtnDeleteForm()) {
      deleteForm();
    } else if (event.getButton() == view.getBtnSaveForm()) {
      ConfirmDialog commitDialog =
          ConfirmDialog.show(
              view.getUI(),
              "Konfirmasi Simpan",
              "Simpan Data?",
              "Save",
              "No",
              new ConfirmDialog.Listener() {
                public void onClose(ConfirmDialog dialog) {
                  if (dialog.isConfirmed()) {
                    // Confirmed to continue
                    try {
                      if (model
                          .getOperationStatus()
                          .equals(EnumOperationStatus.ADDING.getStrCode())) {
                        if (insertAndValidateForm() == 0) {
                          view.getTable().focus();
                          view.closeWindowForm();
                        } else {
                          view.focustIdOrDesc();
                        }
                      } else if (model
                          .getOperationStatus()
                          .equals(EnumOperationStatus.EDITING.getStrCode())) {
                        if (updateAndValidateForm() == 0) {
                          view.getTable().focus();
                          view.closeWindowForm();
                        } else {
                          view.focustIdOrDesc();
                        }
                      }

                    } catch (Exception ex) {
                      Notification.show("Terjadi Kesalahan Simpan");
                    }

                  } else {
                    view.focustIdOrDesc();
                  }
                }
              });
      commitDialog.setStyleName("dialog");
      commitDialog.getOkButton().setStyleName("small");
      commitDialog.getCancelButton().setStyleName("small");
      // Jangan lupa
      commitDialog.focus();

    } else if (event.getButton() == view.getBtnCancelForm()) {
      if (model.getOperationStatus().equals(EnumOperationStatus.ADDING.getStrCode())) {
        discardForm();
      } else if (model.getOperationStatus().equals(EnumOperationStatus.ADDING.getStrCode())
          || model.getOperationStatus().equals(EnumOperationStatus.EDITING.getStrCode())) {
        if (view.getFormLayout().isVisible()) {
          discardForm();
        }
      } else {
        view.getTable().focus();
      }

      //			discardForm(operationStatus);
    } else if (event.getButton() == view.getBtnSearch()) {
      searchForm();
    } else if (event.getButton() == view.getBtnPrint()) {
      printForm();
    } else if (event.getButton() == view.getBtnHelp()) {
      helpForm();
    } else if (event.getButton() == view.getBtnUtility()) {
      view.showWindowUtility();
    }
    // Tidak semua akan di refresh container nya >> Jadi refresh container tidak bisa di taruh
    // disini

  }