@Override
 public void onClick(ClickEvent event) {
   if (event.getSource() == delPortalImage) {
     if (Window.confirm(messages.portal_confirm_delete_image())) {
       deleteImage();
     }
   } else if (event.getSource() == delFacebook) {
     if (Window.confirm(messages.portal_confirm_delete_facebook())) {
       delField("facebook");
     }
   } else if (event.getSource() == delHomepage) {
     if (Window.confirm(messages.portal_confirm_delete_hompeage())) {
       delField("homepage");
     }
   } else if (event.getSource() == delLinkedin) {
     if (Window.confirm(messages.portal_confirm_delete_linkedin())) {
       delField("linkedin");
     }
   } else if (event.getSource() == delTwitter) {
     if (Window.confirm(messages.portal_confirm_delete_twitter())) {
       delField("twitter");
     }
   } else if (event.getSource() == blockAccessButton) {
     setBlocked(true);
   } else if (event.getSource() == grantAccessButton) {
     setBlocked(false);
   }
 }
  @Override
  public void onClick(ClickEvent event) {
    if (event.getSource() == editButton) {
      webApp.setMain(new GroupEditForm(webApp, group));
    } else if (event.getSource() == removeButton) {
      boolean removeContacts =
          Window.confirm(
              "Do you want to remove the contacts in the group " + group.getName() + "?");
      String message =
          removeContacts ? Message.CONFIRM_REMOVE_GROUP_AND_CONTACTS : Message.CONFIRM_REMOVE_GROUP;

      if (Window.confirm(message)) {
        webApp
            .getBusinessService()
            .removeGroup(
                group,
                removeContacts,
                new AsyncCallback<Boolean>() {
                  public void onSuccess(Boolean result) {
                    webApp.showInfo(Message.GROUP, Message.REMOVE_GROUP_SUCCESS);
                    webApp.setMain(new HTML(""));
                  }

                  public void onFailure(Throwable caught) {
                    webApp.showError(Message.ERROR, Message.REMOVE_GROUP_FAILURE);
                  }
                });
      }
    }
  }
  private void delete() {
    final ClientParamSet setToDelete = getSelectedParamSet();
    if (selectionController.getClientParamSets().size() <= 1) {
      Window.alert("Cannot delete all parameter sets - at least one must remain.");
    } else {
      if (Window.confirm(
          "Do you really want to delete parameter set " + setToDelete.getName() + "?")) {
        serviceAsync.delete(
            new Service.Token(true),
            selector.getSelectedParamSet(),
            new AsyncCallback<Void>() {
              public void onFailure(Throwable throwable) {
                handleGlobalError(throwable);
              }

              public void onSuccess(Void aVoid) {
                selectionController.refresh(
                    new ParamSetSelectionController.Callback() {
                      public void refreshed() {
                        final List<ClientParamSet> paramSets =
                            selectionController.getClientParamSets();
                        selectionController.select(paramSets.get(0));
                      }
                    });
              }
            });
      }
    }
  }
 /** {@inheritDoc} */
 @Override
 public boolean promptDeleteConfirmation(String prefix) {
   return Window.confirm(
       "Are you sure you want to delete the prefix '"
           + prefix
           + "'.\n\nThis will also remove all data and information that belongs to it.");
 }
  /** Called when one selects the save button. */
  private void save() {
    try {
      // first see if the user is logged in.
      String user = UserInfo.getCurrentUser();
      if (user == null) {
        statusLabel.setText(LocaleText.get("mustLoginFirst"));
        DOM.setStyleAttribute(statusLabel.getElement(), "color", "red");
        return;
      }

      // check and see if this form already exists
      String form = UserInfo.getForm(user, txtFormName.getText());

      if (form != null) {
        // Window.alert("This form already exists and will be over written");
        if (!Window.confirm(
            "A form by this name is already saved in this browser. Do you want to overwrite it?")) {
          return;
        }
      }

      UserInfo.setForm(user, txtFormName.getText(), formXmlStr);
      // clear dirty flags
      FormDesignerController.clearIsDirty();

      hide();
    } catch (Exception e) // in case there's an error with storage
    {
      statusLabel.setText(e.getMessage());
      DOM.setStyleAttribute(statusLabel.getElement(), "color", "red");
    }
  }
  @UiHandler({"deleteButton"})
  void onDeleteButtonClick(ClickEvent event) {
    if ((this.candidatesModel.getSelectedObject() == null)
        || (((Reference) this.candidatesModel.getSelectedObject()).getId().isEmpty())) {
      Window.alert("Выберите кандидата!");
      return;
    }
    if (!Window.confirm("Удалить запись?")) {
      return;
    }
    SecureService.Util.getInstance()
        .deleteCand(
            ((Reference) this.candidatesModel.getSelectedObject()).getId(),
            new AsyncCallback<Integer>() {
              public void onSuccess(Integer result) {
                CandidateSearchForm.this.candidateEditPanel.setWidget(null);
                CandidateSearchForm.this.startSearch();
                Window.alert("Кандидат успешно удален!");
              }

              public void onFailure(Throwable caught) {
                Window.alert("Ошибка при удалении кандидата!");
              }
            });
  }
Exemple #7
0
 @Override
 public void criteria() {
   if (presenter.isUpdatePending() && !Window.confirm(messages.updatePendingContinue())) {
     return;
   }
   filters.clearFilters();
   resetForm();
 }
 @UiHandler("uploadButton")
 protected void uploadClick(ClickEvent e) {
   boolean doUpload =
       Window.confirm("Are you sure you want to upload a new file, replacing all old data?");
   if (doUpload) {
     uploadForm.submit();
   }
 }
    public boolean confirm(String message) {

      boolean x = Window.confirm(message);
      Log.debug("DONE WITH CONFIRM = " + x);
      if (!x) { // set tab to correct place on cancel
        cf.getHome().setTab(cf);
      }
      return x;
    }
 @Override
 public boolean showAgreeNormalizeNameWindow(final String normalizedName) {
   return Window.confirm(
       CoreConstants.INSTANCE.RepositoryNameInvalid()
           + " \""
           + normalizedName
           + "\". "
           + CoreConstants.INSTANCE.DoYouAgree());
 }
Exemple #11
0
 @UiHandler("deleteButton")
 public void handleDeleteOrganism(ClickEvent clickEvent) {
   if (Window.confirm(
       "Are you sure you want to delete " + singleSelectionModel.getSelectedObject().getName())) {
     deleteButton.setEnabled(false);
     deleteButton.setText("Processing");
     savingNewOrganism = true;
     OrganismRestService.deleteOrganism(
         new UpdateInfoListCallback(), singleSelectionModel.getSelectedObject());
     loadingDialog.show();
   }
 }
    @Override
    public void execute() {
      Tracking.trackEvent(
          Tracking.PROJECT_EVENT, Tracking.PROJECT_ACTION_DOWNLOAD_ALL_PROJECTS_SOURCE_YA);

      // Is there a way to disable the Download All button until this completes?
      if (Window.confirm(MESSAGES.downloadAllAlert())) {

        Downloader.getInstance()
            .download(
                ServerLayout.DOWNLOAD_SERVLET_BASE + ServerLayout.DOWNLOAD_ALL_PROJECTS_SOURCE);
      }
    }
Exemple #13
0
 public static void rebuildBinaries() {
   if (Window.confirm(Constants.INSTANCE.SnapshotRebuildWarning())) {
     LoadingPopup.showMessage(
         Constants.INSTANCE.RebuildingSnapshotsPleaseWaitThisMayTakeSomeTime());
     ModuleServiceAsync moduleService = GWT.create(ModuleService.class);
     moduleService.rebuildSnapshots(
         new GenericCallback<java.lang.Void>() {
           public void onSuccess(Void v) {
             LoadingPopup.close();
             Window.alert(Constants.INSTANCE.SnapshotsWereRebuiltSuccessfully());
           }
         });
   }
 }
Exemple #14
0
  @Test
  public void confirm() {
    // Arrange
    mockedHandler.confirm(EasyMock.eq("this is a confirmation"));
    EasyMock.expectLastCall().andReturn(true);
    EasyMock.replay(mockedHandler);

    // Act
    boolean result = Window.confirm("this is a confirmation");

    // Assert
    EasyMock.verify(mockedHandler);
    assertTrue(result);
  }
  private void deleteSelected() {
    if (Window.confirm(
        constants.AreYouSureYouWantToDeleteCategory() + explorer.getSelectedPath())) {
      RepositoryServiceFactory.getCategoryService()
          .removeCategory(
              explorer.getSelectedPath(),
              new GenericCallback<java.lang.Void>() {

                public void onSuccess(Void v) {
                  explorer.refresh();
                }
              });
    }
  }
 /**
  * If a confirmation question is set (see {@link #setOnLeaveConfirmation(String)}), this asks the
  * user if he wants to leave the current page.
  *
  * @return true if the user accepts to leave. false if he refuses.
  */
 private boolean confirmLeaveState() {
   if (onLeaveQuestion == null) {
     return true;
   }
   boolean confirmed = Window.confirm(onLeaveQuestion);
   if (confirmed) {
     // User has confirmed, don't ask any more question.
     setOnLeaveConfirmation(null);
   } else {
     NavigationRefusedEvent.fire(this);
     setBrowserHistoryToken(currentHistoryToken, false);
   }
   return confirmed;
 }
  public void bulkAbort(List<ProcessInstanceVariableSummary> processInstances) {
    if (processInstances != null) {
      if (Window.confirm("Are you sure that you want to abort the selected process instances?")) {
        List<Long> ids = new ArrayList<Long>();
        for (ProcessInstanceVariableSummary selected : processInstances) {

          ids.add(selected.getProcessInstanceId());

          view.displayNotification(
              constants.Aborting_Process_Instance() + "(id=" + selected.getId() + ")");
        }
        abortProcessInstance(ids);
      }
    }
  }
 private boolean deleteConfirmation(List<Project> projects) {
   String message;
   if (projects.size() == 1) {
     message = MESSAGES.confirmDeleteSingleProject(projects.get(0).getProjectName());
   } else {
     StringBuilder sb = new StringBuilder();
     String separator = "";
     for (Project project : projects) {
       sb.append(separator).append(project.getProjectName());
       separator = ", ";
     }
     String projectNames = sb.toString();
     message = MESSAGES.confirmDeleteManyProjects(projectNames);
   }
   return Window.confirm(message);
 }
Exemple #19
0
  private void deleteItems() {
    if (!Window.confirm("Are You Sure?")) return;
    List<Setting> selectedItems = display.getSelectedItems();
    for (Setting setting : selectedItems) {
      group.removeSetting(setting);
    }
    settingService.saveSettingGroup(
        group,
        new HelpCallBack<Void>() {

          @Override
          public void onSuccessPost(Void result) {
            eventBus.fireEvent(
                new LoadRequetEvent<SettingGroup>(
                    SettingGroup.class, LoadRequetEvent.TYPE.REFRESH));
          }
        });
  }
  @SuppressWarnings("deprecation")
  @Override
  public void deleteClicked() {
    if (!Window.confirm("Really delete this entry? You cannot undo this change.")) {
      return;
    }
    requests
        .clinicRequest()
        .remove()
        .using(clinicProxy)
        .fire(
            new Receiver<Void>() {

              public void onSuccess(Void ignore) {
                if (widget == null) {
                  return;
                }
                placeController.goTo(new ClinicPlace("ClinicPlace!DELETED"));
              }
            });
  }
Exemple #21
0
  /**
   * Updates the metadata from the given temporary ontology info object, confirming with the user in
   * case of any possible overwriting of attributes.
   */
  public void tempOntologyInfoObtained(TempOntologyInfo tempOntologyInfo) {

    // get the new values from temp file:
    OntologyMetadata ontologyMetadata = tempOntologyInfo.getOntologyMetadata();

    // get current values in the editor:

    Map<String, String> valuesInEditor = new HashMap<String, String>();
    putValues(valuesInEditor, false);

    // and from the file
    Map<String, String> tempValues = ontologyMetadata.getOriginalValues();

    Set<String> commonKeysWithDiffValues = new HashSet<String>();

    // see if there're common attributes with different values in both the editor and the new file
    for (String tempKey : tempValues.keySet()) {
      if (valuesInEditor.keySet().contains(tempKey)) {
        String valueInEditor = valuesInEditor.get(tempKey);
        String valueInTemp = tempValues.get(tempKey);
        if (((valueInEditor == null) ^ (valueInTemp == null))
            || !valueInEditor.equals(valueInTemp)) {
          commonKeysWithDiffValues.add(tempKey);
        }
      }
    }

    if (!commonKeysWithDiffValues.isEmpty()) {

      // prompt the user for the action to take:

      String confirmationMsg =
          "There are different values in the uploaded file for "
              + commonKeysWithDiffValues.size()
              + " of the "
              + "non-empty attributes in the metadata editor. "
              + "Do you want to replace the existing values in the editor with those from the file?\n"
              + "\n"
              + "Select Accept to replace those attributes with values from the file.\n"
              + "\n"
              + "Select Cancel to keep the values in the editor.\n"
              + "\n"
              + "In either case, missing attributes in the editor will be updated with "
              + "available values from the file. \n";

      // add the attribute names for administrators:
      if (PortalControl.getInstance().getLoginResult() != null) {
        LoginResult loginResult = PortalControl.getInstance().getLoginResult();
        if (loginResult.isAdministrator()) {
          confirmationMsg += "\n" + "The attributes are:\n" + commonKeysWithDiffValues;
        }
      }

      if (true) { // this block is just a quick way to open the enclosing DisclosurePanel, if any
        Widget parent = this.getParent();
        while (parent != null) {
          if (parent instanceof DisclosurePanel) {
            ((DisclosurePanel) parent).setOpen(true);
            break;
          }
          parent = parent.getParent();
        }
      }

      if (Window.confirm(confirmationMsg)) {
        // replace common attributes with values from the file.
        // Keep tempValues map as it is. See below.
      } else {
        // keep values in the editor, so remove the corresponding keys from tempValues:
        for (String tempKey : commonKeysWithDiffValues) {
          tempValues.remove(tempKey);
        }
      }

      // use valuesInEditor map to collect the final set of attributes:
      for (String tempKey : tempValues.keySet()) {
        valuesInEditor.put(tempKey, tempValues.get(tempKey));
      }

      // and set the final set of attributes:
      ontologyMetadata.setOriginalValues(valuesInEditor);
    }

    for (int i = 0, c = tabPanel.getWidgetCount(); i < c; i++) {
      Widget w = tabPanel.getWidget(i);
      if (w instanceof MetadataGroupPanel) {
        ((MetadataGroupPanel) w).resetToOriginalOrNewValues(ontologyMetadata, true, false);
      }
    }
  }
 @Override
 public boolean confirmClose() {
   return Window.confirm(CommonConstants.INSTANCE.DiscardUnsavedData());
 }
 @Override
 public boolean askCancelConfirmation() {
   return Window.confirm(MESSAGES.cancel_changes_message_text());
 }
 @UiHandler("deleteButton")
 void onDeleteButtonClicked(ClickEvent event) {
   if (Window.confirm("Are you sure you want to delete '" + getSelectedConfig() + "'?")) {
     deleteConfiguration(getSelectedConfiguration());
   }
 }
 public void onCancel() {
   if (Window.confirm("Are you sure you want to cancel?")) {
     pages.goTo(product.getAlias()).execute();
   }
 }
Exemple #26
0
 @UiHandler("deleteIcon")
 void deleteClick(ClickEvent event) {
   if (Window.confirm(constants.AreYouSureYouWantToRemoveThisFact())) {
     deleteEvent.execute();
   }
 }
Exemple #27
0
 protected void onDelete() {
   if (Window.confirm(TestScenarioConstants.INSTANCE.AreYouSureToRemoveCallMethod())) {
     scenario.removeFixture(mCall);
     parent.renderEditor();
   }
 }
    public void onClick(ClickEvent event) {

      boolean response = Window.confirm(messages.confirmDelete() + "?");
      if (response) updateSoftwarePackageCommand.removeSoftwarePackage(current);
      this.dialog.hide(true);
    }
 public void onClick(Widget sender) {
   if (Window.confirm(mensajes.confirmacionBorrarCaballo())) {
     ctrlABMCaballos.doBorrarCaballo(caballo);
   }
 }