boolean isFieldModified(FieldEditor f) { String text = f.getText().trim(); if (text.length() == 0) { return getEntry().getField(f.getFieldName()) != null; } else { Object entryValue = getEntry().getField(f.getFieldName()); return entryValue == null || !entryValue.toString().equals(text); } }
public void setEntry(BibtexEntry entry) { try { updating = true; Iterator<FieldEditor> i = editors.values().iterator(); while (i.hasNext()) { FieldEditor editor = i.next(); Object content = entry.getField(editor.getFieldName()); String toSet = (content == null) ? "" : content.toString(); if (!toSet.equals(editor.getText())) editor.setText(toSet); } this.entry = entry; } finally { updating = false; } }