Skip to content

Commit

Permalink
Initializing EntryEditor Tabs on focus (#3331)
Browse files Browse the repository at this point in the history
* Setting up the tab when it is initialized. All tabs that are not visible (end from FieldsEditor) will cost no memory or CPU

* Added entry to changelog
  • Loading branch information
Patrick Scheibe authored and lenhard committed Oct 21, 2017
1 parent a7bf676 commit f71c5a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We now set the WM_CLASS of the UI to org-jabref-JabRefMain to allow certain Un*x window managers to properly identify its windows
- We changed the default paths for the OpenOffice/LibreOffice binaries to the default path for LibreOffice
- We no longer create a new entry editor when selecting a new entry to increase performance. [#3187](https://github.com/JabRef/jabref/pull/3187)
- We increased performance and decreased the memory footprint of the entry editor drastically. [#3331](https://github.com/JabRef/jabref/pull/3331)


### Fixed
- We fixed the translation of \textendash in the entry preview [#3307](https://github.com/JabRef/jabref/issues/3307)
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/org/jabref/gui/entryeditor/FieldsEditorTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,21 @@
*/
class FieldsEditorTab extends EntryEditorTab {

private final Region panel;
private final List<String> fields;
private final EntryEditor parent;
private final Map<String, FieldEditorFX> editors = new LinkedHashMap<>();
private final JabRefFrame frame;
private final BasePanel basePanel;
private final BibEntry entry;
private final boolean isCompressed;
private Region panel;
private FieldEditorFX activeField;


public FieldsEditorTab(JabRefFrame frame, BasePanel basePanel, List<String> fields, EntryEditor parent, boolean addKeyField, boolean compressed, BibEntry entry) {
this.entry = Objects.requireNonNull(entry);
this.fields = new ArrayList<>(Objects.requireNonNull(fields));

this.isCompressed = compressed;
// Add the edit field for Bibtex-key.
if (addKeyField) {
this.fields.add(BibEntry.KEY_FIELD);
Expand All @@ -61,8 +63,6 @@ public FieldsEditorTab(JabRefFrame frame, BasePanel basePanel, List<String> fiel
this.frame = frame;
this.basePanel = basePanel;

panel = setupPanel(frame, basePanel, compressed);

// The following line makes sure focus cycles inside tab instead of being lost to other parts of the frame:
//panel.setFocusCycleRoot(true);
}
Expand Down Expand Up @@ -305,6 +305,7 @@ public void requestFocus() {

@Override
protected void initialize() {
panel = setupPanel(frame, basePanel, isCompressed);
setContent(panel);
}
}

0 comments on commit f71c5a8

Please sign in to comment.