Ejemplo n.º 1
0
  private void initAnswerView() {

    if (answerRangeChangeHandler != null) {
      answerRangeChangeHandler.removeHandler();
      answerRangeChangeHandler = null;
    }

    requests
        .answerRequestNonRoo()
        .contAnswersByQuestion(question.getId())
        .fire(
            new Receiver<Long>() {

              @Override
              public void onSuccess(Long response) {

                answerTable.setRowCount(response.intValue(), true);

                onAnswerTableRangeChanged();
              }

              public void onFailure(ServerFailure error) {
                ErrorPanel erorPanel = new ErrorPanel();
                erorPanel.setErrorMessage(error.getMessage());
                Log.error(error.getMessage());
              }

              @Override
              public void onViolation(Set<Violation> errors) {
                Iterator<Violation> iter = errors.iterator();
                String message = "";
                while (iter.hasNext()) {
                  message += iter.next().getMessage() + "<br>";
                }
                Log.warn(
                    McAppConstant.ERROR_WHILE_DELETE_VIOLATION
                        + " in Antwort hinzufügen -"
                        + message);

                ErrorPanel erorPanel = new ErrorPanel();
                erorPanel.setErrorMessage(message);
              }
            });

    answerRangeChangeHandler =
        answerTable.addRangeChangeHandler(
            new RangeChangeEvent.Handler() {
              public void onRangeChange(RangeChangeEvent event) {
                ActivityQuestionDetails.this.onAnswerTableRangeChanged();
              }
            });
  }
Ejemplo n.º 2
0
  protected void onAnswerTableRangeChanged() {
    final Range range = answerTable.getVisibleRange();

    requests
        .answerRequestNonRoo()
        .findAnswersEntriesByQuestion(question.getId(), range.getStart(), range.getLength())
        .fire(
            new Receiver<List<AnswerProxy>>() {

              @Override
              public void onSuccess(List<AnswerProxy> response) {

                answerTable.setRowData(range.getStart(), response);
              }

              public void onFailure(ServerFailure error) {
                ErrorPanel erorPanel = new ErrorPanel();
                erorPanel.setErrorMessage(error.getMessage());
                Log.error(error.getMessage());
              }

              @Override
              public void onViolation(Set<Violation> errors) {
                Iterator<Violation> iter = errors.iterator();
                String message = "";
                while (iter.hasNext()) {
                  message += iter.next().getMessage() + "<br>";
                }
                Log.warn(
                    McAppConstant.ERROR_WHILE_DELETE_VIOLATION
                        + " in Antwort hinzufügen -"
                        + message);

                ErrorPanel erorPanel = new ErrorPanel();
                erorPanel.setErrorMessage(message);
              }
            });
  }
Ejemplo n.º 3
0
  @Override
  public void deleteAnswerClicked(AnswerProxy answer) {

    requests
        .answerRequestNonRoo()
        .eliminateAnswer()
        .using(answer)
        .fire(
            new Receiver<Void>() {

              @Override
              public void onSuccess(Void arg0) {
                initAnswerView();
              }

              public void onFailure(ServerFailure error) {
                ErrorPanel erorPanel = new ErrorPanel();
                erorPanel.setErrorMessage(error.getMessage());
                Log.error(error.getMessage());
              }

              @Override
              public void onViolation(Set<Violation> errors) {
                Iterator<Violation> iter = errors.iterator();
                String message = "";
                while (iter.hasNext()) {
                  message += iter.next().getMessage() + "<br>";
                }
                Log.warn(
                    McAppConstant.ERROR_WHILE_DELETE_VIOLATION + " in Antwort löschen -" + message);

                ErrorPanel erorPanel = new ErrorPanel();
                erorPanel.setErrorMessage(message);
              }
            });
  }