示例#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;
    }
  }
示例#2
0
 private void addItemInstructionsView(DocumentItemApi toAdd) {
   File image;
   // If the image has been changed
   if (imageChanged) {
     try {
       image = ((InstructionsView) this).getImageFile();
       // If the question is associated with an image
       if (image != null) {
         toAdd.setImage(image);
       }
     } catch (IOException e) {
       JOptionPane.showMessageDialog(null, "Instruction contains a " + "bad file");
     }
   } else {
     toAdd.setShallowImage(item);
   }
 }
示例#3
0
 /**
  * Returns a String of the DocumentItem type of item
  *
  * @return a String of the DocumentItem type of item
  */
 public final String getType() {
   return item.getType();
 }