Ejemplo n.º 1
0
  @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("Ошибка при удалении кандидата!");
              }
            });
  }
Ejemplo n.º 2
0
  private void queryToDB(final int start, int end) {
    SecureService.Util.getInstance()
        .getReference(
            "CAND",
            start + 1,
            end,
            null,
            this.searchTextBox.getText(),
            new AsyncCallback<List<Reference>>() {
              public void onSuccess(List<Reference> result) {
                CandidateSearchForm.this.dataProvider.updateRowData(start, result);
                CandidateSearchForm.this.rowCounter =
                    Math.max(
                        15 * CandidateSearchForm.this.searchListPager.getPage() + result.size(),
                        CandidateSearchForm.this.rowCounter);
                if (!CandidateSearchForm.this.listIsFull) {
                  CandidateSearchForm.this.dataProvider.updateRowCount(
                      CandidateSearchForm.this.rowCounter, false);
                }
                if (result.size() < 15) {
                  CandidateSearchForm.this.dataProvider.updateRowCount(
                      CandidateSearchForm.this.rowCounter, true);
                  CandidateSearchForm.this.listIsFull = true;
                }
              }

              public void onFailure(Throwable caught) {
                Window.alert("Ошибка при обращении к БД");
              }
            });
  }