コード例 #1
0
  public void passivate(final AsyncCallback<Boolean> callback) {
    if (newRoleAssignments.size() > 0) {
      MessageDialogBox dialog =
          new MessageDialogBox(
              "ABS",
              "Save changes? Choosing \"No\" will result is the loss of changes made.",
              false,
              true,
              true,
              "Yes",
              "No",
              "Cancel");
      dialog.setCallback(
          new IThreeButtonDialogCallback() {

            public void okPressed() {
              saveSecuritySettings(callback);
            }

            public void cancelPressed() {
              callback.onSuccess(false);
            }

            public void notOkPressed() {
              callback.onSuccess(true);
            }
          });
      dialog.center();
    } else {
      callback.onSuccess(true);
    }
  }
コード例 #2
0
  private void promptDueToBlockoutConflicts(
      final boolean alwaysConflict,
      final boolean conflictsSometimes,
      final JSONObject schedule,
      final JsJobTrigger trigger) {
    StringBuffer conflictMessage = new StringBuffer();

    final String updateScheduleButtonText =
        Messages.getString("blockoutUpdateSchedule"); // $NON-NLS-1$
    final String continueButtonText = Messages.getString("blockoutContinueSchedule"); // $NON-NLS-1$

    boolean showContinueButton = conflictsSometimes;
    boolean isScheduleConflict = alwaysConflict || conflictsSometimes;

    if (conflictsSometimes) {
      conflictMessage.append(Messages.getString("blockoutPartialConflict")); // $NON-NLS-1$
      conflictMessage.append("\n"); // $NON-NLS-1$
      conflictMessage.append(Messages.getString("blockoutPartialConflictContinue")); // $NON-NLS-1$
    } else {
      conflictMessage.append(Messages.getString("blockoutTotalConflict")); // $NON-NLS-1$
    }

    if (isScheduleConflict) {
      final MessageDialogBox dialogBox =
          new MessageDialogBox(
              Messages.getString("blockoutTimeExists"), // $NON-NLS-1$
              conflictMessage.toString(),
              false,
              false,
              true,
              updateScheduleButtonText,
              showContinueButton ? continueButtonText : null,
              null);
      dialogBox.setCallback(
          new IDialogCallback() {
            // If user clicked on 'Continue' we want to add the schedule. Otherwise we dismiss the
            // dialog
            // and they have to modify the recurrence schedule
            public void cancelPressed() {
              // User clicked on continue, so we need to proceed adding the schedule
              handleWizardPanels(schedule, trigger);
            }

            public void okPressed() {
              // Update Schedule Button pressed
              dialogBox.setVisible(false);
            }
          });

      dialogBox.center();
    }
  }