Exemplo n.º 1
0
  @SuppressWarnings("serial")
  private void createModalAdministrationPanel() {
    // Create modal feedback window
    adminWindow = new WizardAdministrationWindow("adminWindow");

    adminWindow.setCancelLink("CancelConsent");
    adminWindow.setCloseButtonCallback(
        new CloseButtonCallback() {

          public boolean onCloseButtonClicked(AjaxRequestTarget target, Status status) {
            if (status.equals(Status.ERROR)) {
              showFeedbackWindow(target);
              return false;
            }
            adminWindowClosed = true;
            return true;
          }
        });

    adminWindow.setWindowClosedCallback(
        new WindowClosedCallback() {
          public void onClose(AjaxRequestTarget target, Status status) {
            switch (status) {
              case SUCCESS:
                onFinishSubmit(target, ConsentWizardForm.this);
                break;
              case ERROR:
                onFinishError(target, ConsentWizardForm.this);
                break;
              case CLOSED:
                onCancelClick(target);
            }
          }
        });
    adminWindowClosed = false;
    add(adminWindow);
  }
Exemplo n.º 2
0
  @SuppressWarnings("serial")
  private void createModalAdministrationPanel() {
    // Create modal feedback window
    adminWindow = new WizardAdministrationWindow("adminWindow");

    AjaxLink cancelLink =
        new AjaxLink("cancelStage") {

          private static final long serialVersionUID = 1L;

          @Override
          public void onClick(AjaxRequestTarget target) {
            Label label =
                new Label(
                    "content",
                    new StringResourceModel("ConfirmCancellationOfMeasurement", this, null));
            label.add(
                new AttributeModifier("class", true, new Model("confirmation-dialog-content")));

            ConfirmationDialog confirmationDialog =
                ((ReusableDialogProvider) getPage()).getConfirmationDialog();
            confirmationDialog.setContent(label);
            confirmationDialog.setTitle(
                new StringResourceModel("ConfirmCancellationOfMeasurementTitle", this, null));
            confirmationDialog.setYesButtonCallback(
                new OnYesCallback() {

                  private static final long serialVersionUID = -6691702933562884991L;

                  public void onYesButtonClicked(AjaxRequestTarget target) {
                    adminWindow.setStatus(Status.CLOSED);
                    if (adminWindow.getCloseButtonCallback() == null
                        || (adminWindow.getCloseButtonCallback() != null
                            && adminWindow
                                .getCloseButtonCallback()
                                .onCloseButtonClicked(target, adminWindow.getStatus())))
                      adminWindow.close(target);
                  }
                });
            confirmationDialog.show(target);
          }
        };

    adminWindow.setCancelLink("CancelMeasurement", cancelLink);

    adminWindow.setCloseButtonCallback(
        new CloseButtonCallback() {

          public boolean onCloseButtonClicked(AjaxRequestTarget target, Status status) {
            adminWindowClosed = true;
            return true;
          }
        });

    adminWindow.setWindowClosedCallback(
        new WindowClosedCallback() {
          public void onClose(AjaxRequestTarget target, Status status) {
            switch (status) {
              case OTHER:
                onInterrupt(target);
                break;
              case SUCCESS:
                onFinishSubmit(target, InstrumentWizardForm.this);
                break;
              case ERROR:
                onFinishError(target, InstrumentWizardForm.this);
                break;
              case CLOSED:
                onCancelClick(target);
            }
          }
        });
    adminWindowClosed = false;
    add(adminWindow);
  }