/**
   * Sets the backend to another object. Useful to switch it during running animation/interaction.
   *
   * @param backendObj A valid backend object to switch to.
   */
  public void setBackend(BackendInterface backendObj) {
    if (DEBUG) System.out.println("\nsetting new Backend to \"" + backendObj.toString() + "\"");

    backend = backendObj;

    return;
  }
  /**
   * Gets called if the Submitbutton of the given question was pressed and therefore a processing
   * method has to be triggered.
   *
   * @param aQuestion The question which answer was submitted.
   */
  public void submitPressed(Question aQuestion) {
    String groupID;
    GroupInfo group;
    boolean displayAnswer;
    String interactionID;

    interactionID = aQuestion.objectID;

    // get group id
    groupID = aQuestion.getGroupID();
    // lookup group infos
    group = (GroupInfo) groupInfos.get(groupID);
    if ((groupID != "") && (group != null)) {
      // if amount of correct questions of group
      // already reached we dont have to
      // continue with this interaction
      if ((group.processed >= group.repeats) && (group.processed != 0) && (group.repeats != 0)) {
        if (DEBUG)
          System.out.println("\t\tNecessary amount of questions of group " + "answered correct.");

        return;
      }
    }

    aQuestion.getJDialog().setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    displayAnswer =
        backend.submitAnswer(
            interactionID,
            aQuestion.isCorrect(),
            aQuestion.getPoints(),
            aQuestion.getAchievedPoints(),
            aQuestion.getConceptIdentifiers());

    // If question is part of an existing group
    // and question was answered correct, then
    // increment the number of correctly answered
    // questions in this group
    if ((!groupID.equals("")) && (group != null) && (aQuestion.isCorrect())) group.processed++;

    aQuestion.setFeedbackBlack();

    if (displayAnswer) {
      // make the interface display the answer or a comment, if
      // one exists.
      if (!(aQuestion.getComment().equals(""))) aQuestion.setFeedback(aQuestion.getComment());
      else if (aQuestion.isCorrect()) aQuestion.setFeedback("Yes, you are right!");
      else aQuestion.setFeedback("No, this is wrong!");
    } else {
      // wait till user closes the frame
      aQuestion.setFeedback("Answer submitted. Please close the window now.");
    }
  }