Esempio n. 1
0
  /**
   * Returns a boolean indicating if the gui representation still matches item
   *
   * @return false if item matches extractItem(), otherwise false
   */
  public boolean isDifferent() {
    // return item != null && !item.equals(extractItem());
    // If there are no changes to the questions
    if (item == null) {
      return false;
    }
    // if the items are equal they aren't different
    if (item.equals(extractItem())) {
      // javax.swing.JOptionPane.showMessageDialog(null, "String: \"" +
      // item.getText() + "\"" + "\nString: \"" +
      // extractItem().getText() + "\"");
      return false;
    } else {

      DocumentItemApi extrctItem = extractItem();
      Driver driver = new Driver();
      // If both texts are filled with only tags (aka just an empty
      // string).
      if (driver.compareExtracted(extrctItem, item)) {
        extrctItem.setText(item.getText());
        // ATTEMPT at fixing question issues
        if (extrctItem instanceof Question
            && driver.compareExtractedStrings(
                ((Question) extrctItem).getAnswer(), ((Question) item).getAnswer())) {
          ((Question) extrctItem).setAnswer(((Question) item).getAnswer());
        }
        return !item.equals(extrctItem);
      }
      return true;
    }
  }