Search in sources :

Example 1 with FieldEditor

use of org.jabref.gui.fieldeditors.FieldEditor in project jabref by JabRef.

the class EntryEditorTest method changingSomeFieldUpdatesAutoCompleter.

@Test
@Ignore
public void changingSomeFieldUpdatesAutoCompleter() {
    TestUtils.initJabRef();
    BibEntry bibEntry = new BibEntry();
    bibEntry.setField("journal", "Testtext");
    FieldEditor authorTextField = new TextArea("journal", "New Testtext");
    EntryEditor editor = new EntryEditor(JabRefGUI.getMainFrame(), JabRefGUI.getMainFrame().getCurrentBasePanel(), bibEntry);
    // perform action ...
    editor.getStoreFieldAction().actionPerformed(new ActionEvent(authorTextField, 0, ""));
    // test content of stored words in autocompleter ...
    AutoCompleter<String> autoCompleter = JabRefGUI.getMainFrame().getCurrentBasePanel().getAutoCompleters().get("journal");
    List<String> result = autoCompleter.complete("Ne");
    Assert.assertEquals(Arrays.asList("New Testtext"), result);
    TestUtils.closeJabRef();
}
Also used : FieldEditor(org.jabref.gui.fieldeditors.FieldEditor) BibEntry(org.jabref.model.entry.BibEntry) TextArea(org.jabref.gui.fieldeditors.TextArea) ActionEvent(java.awt.event.ActionEvent) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 2 with FieldEditor

use of org.jabref.gui.fieldeditors.FieldEditor in project jabref by JabRef.

the class EntryEditorTest method changingAuthorUpdatesAutoCompleter.

@Test
@Ignore
public void changingAuthorUpdatesAutoCompleter() {
    TestUtils.initJabRef();
    BibEntry bibEntry = new BibEntry();
    bibEntry.setField("author", "Brigitte Laurant");
    FieldEditor authorTextField = new TextArea("author", "Hans Meiser");
    EntryEditor editor = new EntryEditor(JabRefGUI.getMainFrame(), JabRefGUI.getMainFrame().getCurrentBasePanel(), bibEntry);
    // perform action ...
    editor.getStoreFieldAction().actionPerformed(new ActionEvent(authorTextField, 0, ""));
    // test content of stored words in autocompleter ...
    AutoCompleter<String> autoCompleter = JabRefGUI.getMainFrame().getCurrentBasePanel().getAutoCompleters().get("author");
    List<String> result = autoCompleter.complete("Hans");
    Assert.assertEquals(Arrays.asList("Hans Meiser"), result);
    TestUtils.closeJabRef();
}
Also used : FieldEditor(org.jabref.gui.fieldeditors.FieldEditor) BibEntry(org.jabref.model.entry.BibEntry) TextArea(org.jabref.gui.fieldeditors.TextArea) ActionEvent(java.awt.event.ActionEvent) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

ActionEvent (java.awt.event.ActionEvent)2 FieldEditor (org.jabref.gui.fieldeditors.FieldEditor)2 TextArea (org.jabref.gui.fieldeditors.TextArea)2 BibEntry (org.jabref.model.entry.BibEntry)2 Ignore (org.junit.Ignore)2 Test (org.junit.Test)2