Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The textarea in the PersonsEditor is focused when the field is focused #4112

Merged
merged 2 commits into from
Jun 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We fixed an issue where the groups tree of the last database was still shown even after the database was already closed.
- We fixed an issue where the "Open file dialog" may disappear behind other windows. https://github.com/JabRef/jabref/issues/3410
- We fixed an issue where the default icon of a group was not colored correctly.
- We fixed an issue where the first field in entry editor was not focused when adding a new entry. [#4024](https://github.com/JabRef/jabref/issues/4024)
- We reworked the "Edit file" dialog to make it resizeable and improved the workflow for adding and editing files https://github.com/JabRef/jabref/issues/2970
- We fixed an issue where the month was not shown in the preview https://github.com/JabRef/jabref/issues/3239.
- Rewritten logic to detect a second jabref instance. [#4023](https://github.com/JabRef/jabref/issues/4023)
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/org/jabref/gui/entryeditor/FieldsEditorTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ private Region setupPanel(BibEntry entry, boolean compressed, SuggestionProvider
fields = determineFieldsToShow(entry, entryType);

List<Label> labels = new ArrayList<>();
boolean isFirstField = true;
for (String fieldName : fields) {
FieldEditorFX fieldEditor = FieldEditors.getForField(fieldName, Globals.TASK_EXECUTOR, dialogService,
Globals.journalAbbreviationLoader, Globals.prefs.getJournalAbbreviationPreferences(), Globals.prefs,
Expand All @@ -88,12 +89,10 @@ private Region setupPanel(BibEntry entry, boolean compressed, SuggestionProvider
fieldEditor.bindToEntry(entry);

editors.put(fieldName, fieldEditor);
/*
// TODO: Reenable this
if (i == 0) {
if (isFirstField) {
activeField = fieldEditor;
isFirstField = false;
}
*/

labels.add(new FieldNameLabel(fieldName));
}
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/org/jabref/gui/fieldeditors/PersonsEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ public class PersonsEditor extends HBox implements FieldEditorFX {

@FXML private final PersonsEditorViewModel viewModel;

private EditorTextArea textArea;

public PersonsEditor(String fieldName, AutoCompleteSuggestionProvider<?> suggestionProvider, JabRefPreferences preferences, FieldCheckers fieldCheckers) {
this.viewModel = new PersonsEditorViewModel(fieldName, suggestionProvider, preferences.getAutoCompletePreferences(), fieldCheckers);

EditorTextArea textArea = new EditorTextArea();
textArea = new EditorTextArea();
HBox.setHgrow(textArea, Priority.ALWAYS);
textArea.textProperty().bindBidirectional(viewModel.textProperty());
textArea.addToContextMenu(EditorMenus.getNameMenu(textArea));
Expand All @@ -39,4 +41,10 @@ public void bindToEntry(BibEntry entry) {
public Parent getNode() {
return this;
}

@Override
public void requestFocus() {
textArea.requestFocus();
}

}