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

Fix setting of title (and simplify BasePanel to LibraryTab) #6129

Merged
merged 25 commits into from
Oct 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f56e171
Fix setting of title (and remove obsolete comments)
koppor Mar 15, 2020
ffad7e8
Tab titles is determined in JabRefFrame only
koppor Mar 16, 2020
97145ba
Merge remote-tracking branch 'upstream/master' into fix-title
calixtus Sep 27, 2020
ce0e098
Fixed some small merge errors and code optimizations
calixtus Sep 27, 2020
f3dacfc
Refactored BasePanel to LibraryTab and applied some IntelliJ suggestions
calixtus Sep 28, 2020
5ef16b9
Merge remote-tracking branch 'upstream/master' into fix-title-revisited
calixtus Oct 11, 2020
f923a48
Move title logic to LibraryTab
calixtus Oct 13, 2020
f302e73
Merge remote-tracking branch 'upstream/master' into fix-title-revisited
calixtus Oct 13, 2020
ed3fc40
Refactored property methods and removed unused code
calixtus Oct 16, 2020
9d78f28
Removed BasePanelPreferences.java
calixtus Oct 16, 2020
25646f2
Removed calls to JabRefPreferences in LibraryTab.java
calixtus Oct 16, 2020
f82b09a
Merge remote-tracking branch 'upstream/master' into fix-title-revisited
calixtus Oct 17, 2020
add74ef
Reworded panel to libraryTab and suggested switch statement refactor
calixtus Oct 17, 2020
5ae3c58
Refactored setting window title
calixtus Oct 17, 2020
36dbc4b
Refactored setting window title
calixtus Oct 17, 2020
be77a2a
Refactored collectDatabaseFilePaths to stream
calixtus Oct 17, 2020
0ab5e55
Reenabled unique path parsing
calixtus Oct 18, 2020
1ad25fe
Changed getOpenTabs to getOpenDatabases in StateManager
calixtus Oct 18, 2020
85fc785
Fixed refresh of tab title on tab close and open
calixtus Oct 18, 2020
067325d
Fixed SaveDatabaseActionTest
calixtus Oct 18, 2020
5324a9f
Removed nameProperty and bound tab title to frame title
calixtus Oct 19, 2020
9c8b91b
CHANGELOG.md
calixtus Oct 19, 2020
506e8de
Changed tooltip to display multiline texts
calixtus Oct 19, 2020
45514a2
Reordered display and added comments
calixtus Oct 19, 2020
d1257a2
Merge branch 'master' into fix-title
calixtus Oct 19, 2020
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 @@ inserting new citations in a OpenOffic/LibreOffice document. [#6957](https://git
- We improved the duplicate detection when identifiers like DOI or arxiv are semantiaclly the same, but just syntactically differ (e.g. with or without http(s):// prefix). [#6707](https://github.com/JabRef/jabref/issues/6707)
- We changed in the group interface "Generate groups from keywords in a BibTeX field" by "Generate groups from keywords in the following field". [#6983](https://github.com/JabRef/jabref/issues/6983)
- We changed the name of a group type from "Searching for keywords" to "Searching for a keyword". [6995](https://github.com/JabRef/jabref/pull/6995)
- We changed the way JabRef displays the title of a tab and of the window. [4161](https://github.com/JabRef/jabref/issues/4161)
- We changed connect timeouts for server requests to 30 seconds in general and 5 seconds for GROBID server (special) and improved user notifications on connection issues. [7026](https://github.com/JabRef/jabref/pull/7026)

### Fixed
Expand Down
79 changes: 0 additions & 79 deletions src/main/java/org/jabref/gui/BasePanelPreferences.java

This file was deleted.

13 changes: 7 additions & 6 deletions src/main/java/org/jabref/gui/EntryTypeView.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.jabref.gui.util.IconValidationDecorator;
import org.jabref.gui.util.ViewModelListCellFactory;
import org.jabref.logic.importer.IdBasedFetcher;
import org.jabref.logic.importer.WebFetcher;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.database.BibDatabaseMode;
import org.jabref.model.entry.BibEntryType;
Expand Down Expand Up @@ -60,16 +61,16 @@ public class EntryTypeView extends BaseDialog<EntryType> {
@FXML private TitledPane customTitlePane;
@FXML private TitledPane biblatexSoftwareTitlePane;

private final BasePanel basePanel;
private final LibraryTab libraryTab;
private final DialogService dialogService;
private final JabRefPreferences prefs;

private EntryType type;
private EntryTypeViewModel viewModel;
private final ControlsFxVisualizer visualizer = new ControlsFxVisualizer();

public EntryTypeView(BasePanel basePanel, DialogService dialogService, JabRefPreferences preferences) {
this.basePanel = basePanel;
public EntryTypeView(LibraryTab libraryTab, DialogService dialogService, JabRefPreferences preferences) {
this.libraryTab = libraryTab;
this.dialogService = dialogService;
this.prefs = preferences;

Expand Down Expand Up @@ -120,7 +121,7 @@ private void addEntriesToPane(FlowPane pane, Collection<? extends BibEntryType>
@FXML
public void initialize() {
visualizer.setDecoration(new IconValidationDecorator());
viewModel = new EntryTypeViewModel(prefs, basePanel, dialogService, stateManager);
viewModel = new EntryTypeViewModel(prefs, libraryTab, dialogService, stateManager);

idBasedFetchers.itemsProperty().bind(viewModel.fetcherItemsProperty());
idTextField.textProperty().bindBidirectional(viewModel.idTextProperty());
Expand All @@ -133,7 +134,7 @@ public void initialize() {
}
});

new ViewModelListCellFactory<IdBasedFetcher>().withText(item -> item.getName()).install(idBasedFetchers);
new ViewModelListCellFactory<IdBasedFetcher>().withText(WebFetcher::getName).install(idBasedFetchers);

// we set the managed property so that they will only be rendered when they are visble so that the Nodes only take the space when visible
// avoids removing and adding from the scence graph
Expand All @@ -143,7 +144,7 @@ public void initialize() {
customTitlePane.managedProperty().bind(customTitlePane.visibleProperty());
biblatexSoftwareTitlePane.managedProperty().bind(biblatexSoftwareTitlePane.visibleProperty());

if (basePanel.getBibDatabaseContext().isBiblatexMode()) {
if (libraryTab.getBibDatabaseContext().isBiblatexMode()) {
addEntriesToPane(biblatexPane, BiblatexEntryTypeDefinitions.ALL);
addEntriesToPane(biblatexSoftwarePane, BiblatexSoftwareEntryTypeDefinitions.ALL);

Expand Down
26 changes: 13 additions & 13 deletions src/main/java/org/jabref/gui/EntryTypeViewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ public class EntryTypeViewModel {
private final StringProperty idText = new SimpleStringProperty();
private final BooleanProperty focusAndSelectAllProperty = new SimpleBooleanProperty();
private Task<Optional<BibEntry>> fetcherWorker = new FetcherWorker();
private final BasePanel basePanel;
private final LibraryTab libraryTab;
private final DialogService dialogService;
private final Validator idFieldValidator;
private final StateManager stateManager;

public EntryTypeViewModel(JabRefPreferences preferences, BasePanel basePanel, DialogService dialogService, StateManager stateManager) {
this.basePanel = basePanel;
public EntryTypeViewModel(JabRefPreferences preferences, LibraryTab libraryTab, DialogService dialogService, StateManager stateManager) {
this.libraryTab = libraryTab;
this.prefs = preferences;
this.dialogService = dialogService;
this.stateManager = stateManager;
Expand Down Expand Up @@ -147,31 +147,31 @@ public void runFetcherWorker() {
Optional<BibEntry> result = fetcherWorker.getValue();
if (result.isPresent()) {
final BibEntry entry = result.get();
ImportCleanup cleanup = new ImportCleanup(basePanel.getBibDatabaseContext().getMode());
ImportCleanup cleanup = new ImportCleanup(libraryTab.getBibDatabaseContext().getMode());
cleanup.doPostCleanup(entry);
Optional<BibEntry> duplicate = new DuplicateCheck(Globals.entryTypesManager).containsDuplicate(basePanel.getDatabase(), entry, basePanel.getBibDatabaseContext().getMode());
Optional<BibEntry> duplicate = new DuplicateCheck(Globals.entryTypesManager).containsDuplicate(libraryTab.getDatabase(), entry, libraryTab.getBibDatabaseContext().getMode());
if ((duplicate.isPresent())) {
DuplicateResolverDialog dialog = new DuplicateResolverDialog(entry, duplicate.get(), DuplicateResolverDialog.DuplicateResolverType.IMPORT_CHECK, basePanel.getBibDatabaseContext(), stateManager);
DuplicateResolverDialog dialog = new DuplicateResolverDialog(entry, duplicate.get(), DuplicateResolverDialog.DuplicateResolverType.IMPORT_CHECK, libraryTab.getBibDatabaseContext(), stateManager);
switch (dialog.showAndWait().orElse(DuplicateResolverDialog.DuplicateResolverResult.BREAK)) {
case KEEP_LEFT:
basePanel.getDatabase().removeEntry(duplicate.get());
basePanel.getDatabase().insertEntry(entry);
libraryTab.getDatabase().removeEntry(duplicate.get());
libraryTab.getDatabase().insertEntry(entry);
break;
case KEEP_BOTH:
basePanel.getDatabase().insertEntry(entry);
libraryTab.getDatabase().insertEntry(entry);
break;
case KEEP_MERGE:
basePanel.getDatabase().removeEntry(duplicate.get());
basePanel.getDatabase().insertEntry(dialog.getMergedEntry());
libraryTab.getDatabase().removeEntry(duplicate.get());
libraryTab.getDatabase().insertEntry(dialog.getMergedEntry());
break;
default:
// Do nothing
break;
}
} else {
// Regenerate CiteKey of imported BibEntry
new CitationKeyGenerator(basePanel.getBibDatabaseContext(), prefs.getCitationKeyPatternPreferences()).generateAndSetKey(entry);
basePanel.insertEntry(entry);
new CitationKeyGenerator(libraryTab.getBibDatabaseContext(), prefs.getCitationKeyPatternPreferences()).generateAndSetKey(entry);
libraryTab.insertEntry(entry);
}
searchSuccesfulProperty.set(true);
} else if (StringUtil.isBlank(idText.getValue())) {
Expand Down
Loading