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 for issue 3861 : Preferences Dialog to javafx #4253

Merged
merged 65 commits into from
Aug 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
97cd767
Convert swing dialog to JavaFx
Super-Tang Jul 30, 2018
1868304
convert the swing dialog to javafx
Super-Tang Aug 7, 2018
99caee8
Change the code style to meet the standard
Super-Tang Aug 7, 2018
70d304f
Update CHANGELOG.md
Super-Tang Aug 7, 2018
9f3b3b7
Update SaveOrderConfigDisplay.java
Super-Tang Aug 8, 2018
ee486e7
Merge the latest commits
Super-Tang Aug 8, 2018
ad651fa
Merge the latest commits
Super-Tang Aug 8, 2018
8f5d7f7
merge the latest commits
Super-Tang Aug 8, 2018
ee1c275
Polish the code style
Super-Tang Aug 9, 2018
58b52fa
resolve the conficts
Super-Tang Aug 9, 2018
ab3f78c
polish the code style
Super-Tang Aug 9, 2018
4f1c8ca
reslove the conflicts
Super-Tang Aug 9, 2018
ab409da
resolve the conflict
Super-Tang Aug 9, 2018
f7f5841
Merge branch 'master' into fixDialog
Super-Tang Aug 9, 2018
278693b
Change the CHANGELOG.md
Super-Tang Aug 9, 2018
0b5c0cf
polish the code style
Super-Tang Aug 9, 2018
c2db43a
Merge branch 'fixDialog' of https://github.com/1160300311/jabref into…
Super-Tang Aug 9, 2018
e72485e
polish the code style
Super-Tang Aug 9, 2018
848478e
Modify the code to make test-suite pass
Super-Tang Aug 9, 2018
afbcee0
polish the code style
Super-Tang Aug 9, 2018
760b837
Beautify the option panes
Super-Tang Aug 10, 2018
0fb9d89
Polish the code style
Super-Tang Aug 10, 2018
9a3a89d
Merge the latest commits
Super-Tang Aug 10, 2018
a49ff3e
merge the latest commits
Super-Tang Aug 10, 2018
c755130
Merge the latest commits
Super-Tang Aug 10, 2018
9eb0206
Merge branch 'master' into fixDialog
Super-Tang Aug 10, 2018
3d9de15
Polish the code style
Super-Tang Aug 10, 2018
8cfac86
Merge branch 'fixDialog' of https://github.com/1160300311/jabref into…
Super-Tang Aug 10, 2018
6cf405a
Polish the code style
Super-Tang Aug 10, 2018
2b53f60
Polish the code style
Super-Tang Aug 11, 2018
1aa3703
Polish the code style
Super-Tang Aug 11, 2018
92aff87
Beautify the dialog
Super-Tang Aug 11, 2018
9fb982c
Simplify the long method in PreferencesDialog.java
Super-Tang Aug 11, 2018
ae38d59
Polish the code style
Super-Tang Aug 11, 2018
dbea6b7
Polish the code style
Super-Tang Aug 11, 2018
6e1ebc0
Merge the latest commits
Super-Tang Aug 11, 2018
c9677bc
Merge branch 'master' into fixDialog
Super-Tang Aug 11, 2018
d317c84
Change Integer.parseInt to Double.parseDouble
Super-Tang Aug 11, 2018
edd270d
Change the font size of several labels
Super-Tang Aug 11, 2018
f0715ea
fix a bug regarding the storeing of settings
Super-Tang Aug 12, 2018
ce9b71b
fix the code style
Super-Tang Aug 12, 2018
3f6fd9b
Fix NullPointerException in settings for External Applications
Super-Tang Aug 13, 2018
5b3256e
Polish code style
Super-Tang Aug 13, 2018
eb88a1e
Add a row
Super-Tang Aug 13, 2018
60602a0
Fix NullPointerException in settings for External Application
Super-Tang Aug 13, 2018
fd400d4
push again to make test pass
Super-Tang Aug 13, 2018
7d1304d
Push again to make test pass
Super-Tang Aug 13, 2018
3886515
push again to make test pass
Super-Tang Aug 13, 2018
2c8ddf5
Push again to make test pass
Super-Tang Aug 13, 2018
a9eedbd
Push again to make test pass
Super-Tang Aug 13, 2018
e2cb75b
Update JabRefGUI.java
Super-Tang Aug 13, 2018
f1e391c
Update JabRefGUI.java
Super-Tang Aug 13, 2018
57a7cfa
correct the wrong label name in settings for external Application
Super-Tang Aug 13, 2018
755afae
Merge branch 'fixDialog' of https://github.com/1160300311/jabref into…
Super-Tang Aug 13, 2018
8e1bad8
remove the duplicates and cleanup the code
Super-Tang Aug 13, 2018
aec8003
remove unused imports
Super-Tang Aug 13, 2018
d00704e
remove the duplicates in SaveOrderConfigDisplay.java
Super-Tang Aug 13, 2018
e773285
remove the unused imports in SaveOrderConfigDisplay.java
Super-Tang Aug 13, 2018
d3d0a97
Change the return type to Interface Type
Super-Tang Aug 13, 2018
b8f075b
Change to lambda expression
Super-Tang Aug 13, 2018
6f205f1
cleanup the code
Super-Tang Aug 14, 2018
55fd4ee
Merge latest commits
Super-Tang Aug 14, 2018
73b4315
Merge branch 'master' into fixDialog
Super-Tang Aug 16, 2018
71c5b72
remove the Swing contron in BibtexKeyPatternPanel
Super-Tang Aug 19, 2018
9b9e3d1
Code style :(
Super-Tang Aug 19, 2018
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 @@ -132,3 +132,4 @@ The changelog of JabRef 2.11 and all previous versions is available as [text fil
[4.0-beta]: https://github.com/JabRef/jabref/compare/v3.8.2...v4.0-beta
[2.11.1]: https://github.com/JabRef/jabref/compare/v2.11...v2.11.1
[JavaFX]: https://en.wikipedia.org/wiki/JavaFX

28 changes: 14 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,12 @@ dependencyUpdates.resolutionStrategy = {
}
rules.withModule("org.controlsfx:controlsfx") { ComponentSelection selection ->
if (selection.candidate.version ==~ /9.*/) { // Reject version 9 or higher
selection.reject("Cannot be updated to 9.*.* until Jabref works with Java 9")
selection.reject("Cannot be updated to 9.*.* until Jabref works with Java 9")
}
}
rules.withModule("com.github.tomtung:latex2unicode_2.12") { ComponentSelection selection ->
if (selection.candidate.version ==~ /0.2.2/) { // Reject version higher than 2.0.2
selection.reject("Cannot be updated to 0.2.4 until JabRef is prepared for it")
selection.reject("Cannot be updated to 0.2.4 until JabRef is prepared for it")
}
}
rules.withModule("de.jensd:fontawesomefx-materialdesignfont") { ComponentSelection selection ->
Expand All @@ -220,7 +220,7 @@ dependencyUpdates.resolutionStrategy = {
selection.reject("http://dev.mysql.com/downloads/connector/j/ lists the version 5.* as last stable version.")
}
}

}
}

Expand Down Expand Up @@ -502,16 +502,16 @@ jmh {

// Source: https://stackoverflow.com/a/44168582/873282
task downloadDependencies {
description "Pre-downloads *most* dependencies"
doLast {
configurations.getAsMap().each { name, config ->
println "Retrieving dependencies for $name"
try {
config.files
} catch (e) {
// some cannot be resolved, just log them
project.logger.info e.message
}
description "Pre-downloads *most* dependencies"
doLast {
configurations.getAsMap().each { name, config ->
println "Retrieving dependencies for $name"
try {
config.files
} catch (e) {
// some cannot be resolved, just log them
project.logger.info e.message
}
}
}
}
}
20 changes: 10 additions & 10 deletions src/main/java/org/jabref/JabRefGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ public JabRefGUI(Stage mainStage, List<ParserResult> argsDatabases, boolean isBl

// passed file (we take the first one) should be focused
focusedFile = argsDatabases.stream()
.findFirst()
.flatMap(ParserResult::getFile)
.map(File::getAbsolutePath)
.orElse(Globals.prefs.get(JabRefPreferences.LAST_FOCUSED));
.findFirst()
.flatMap(ParserResult::getFile)
.map(File::getAbsolutePath)
.orElse(Globals.prefs.get(JabRefPreferences.LAST_FOCUSED));

openWindow(mainStage);
JabRefGUI.checkForNewVersion(false);
Expand Down Expand Up @@ -109,15 +109,15 @@ private void openWindow(Stage mainStage) {
try {
new SharedDatabaseUIManager(mainFrame).openSharedDatabaseFromParserResult(pr);
} catch (SQLException | DatabaseNotSupportedException | InvalidDBMSConnectionPropertiesException |
NotASharedDatabaseException e) {
NotASharedDatabaseException e) {
pr.getDatabaseContext().clearDatabaseFile(); // do not open the original file
pr.getDatabase().clearSharedDatabaseID();

LOGGER.error("Connection error", e);
dialogService.showErrorDialogAndWait(
Localization.lang("Connection error"),
Localization.lang("A local copy will be opened."),
e);
Localization.lang("Connection error"),
Localization.lang("A local copy will be opened."),
e);
}
toOpenTab.add(pr);
} else if (pr.toOpenTab()) {
Expand Down Expand Up @@ -166,7 +166,7 @@ private void openWindow(Stage mainStage) {

for (ParserResult pr : failed) {
String message = Localization.lang("Error opening file '%0'.", pr.getFile().get().getName()) + "\n"
+ pr.getErrorMessage();
+ pr.getErrorMessage();

dialogService.showErrorDialogAndWait(Localization.lang("Error opening file"), message);

Expand Down Expand Up @@ -223,7 +223,7 @@ private void openLastEditedDatabases() {
}

ParserResult parsedDatabase = OpenDatabase.loadDatabase(fileName,
Globals.prefs.getImportFormatPreferences(), Globals.getFileUpdateMonitor());
Globals.prefs.getImportFormatPreferences(), Globals.getFileUpdateMonitor());

if (parsedDatabase.isEmpty()) {
LOGGER.error(Localization.lang("Error opening file") + " '" + dbFile.getPath() + "'");
Expand Down
82 changes: 41 additions & 41 deletions src/main/java/org/jabref/gui/BasePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -396,33 +396,33 @@ private void setupActions() {
actions.put(Actions.REPLACE_ALL, ()-> (new ReplaceStringAction(this)).execute());

actions.put(new SpecialFieldValueViewModel(SpecialField.RELEVANCE.getValues().get(0)).getCommand(),
new SpecialFieldViewModel(SpecialField.RELEVANCE, undoManager).getSpecialFieldAction(SpecialField.RELEVANCE.getValues().get(0), frame));
new SpecialFieldViewModel(SpecialField.RELEVANCE, undoManager).getSpecialFieldAction(SpecialField.RELEVANCE.getValues().get(0), frame));

actions.put(new SpecialFieldValueViewModel(SpecialField.QUALITY.getValues().get(0)).getCommand(),
new SpecialFieldViewModel(SpecialField.QUALITY, undoManager).getSpecialFieldAction(SpecialField.QUALITY.getValues().get(0), frame));
new SpecialFieldViewModel(SpecialField.QUALITY, undoManager).getSpecialFieldAction(SpecialField.QUALITY.getValues().get(0), frame));

actions.put(new SpecialFieldValueViewModel(SpecialField.PRINTED.getValues().get(0)).getCommand(),
new SpecialFieldViewModel(SpecialField.PRINTED, undoManager).getSpecialFieldAction(SpecialField.PRINTED.getValues().get(0), frame));
new SpecialFieldViewModel(SpecialField.PRINTED, undoManager).getSpecialFieldAction(SpecialField.PRINTED.getValues().get(0), frame));

for (SpecialFieldValue prio : SpecialField.PRIORITY.getValues()) {
actions.put(new SpecialFieldValueViewModel(prio).getCommand(),
new SpecialFieldViewModel(SpecialField.PRIORITY, undoManager).getSpecialFieldAction(prio, this.frame));
new SpecialFieldViewModel(SpecialField.PRIORITY, undoManager).getSpecialFieldAction(prio, this.frame));
}
for (SpecialFieldValue rank : SpecialField.RANKING.getValues()) {
actions.put(new SpecialFieldValueViewModel(rank).getCommand(),
new SpecialFieldViewModel(SpecialField.RANKING, undoManager).getSpecialFieldAction(rank, this.frame));
new SpecialFieldViewModel(SpecialField.RANKING, undoManager).getSpecialFieldAction(rank, this.frame));
}
for (SpecialFieldValue status : SpecialField.READ_STATUS.getValues()) {
actions.put(new SpecialFieldValueViewModel(status).getCommand(),
new SpecialFieldViewModel(SpecialField.READ_STATUS, undoManager).getSpecialFieldAction(status, this.frame));
new SpecialFieldViewModel(SpecialField.READ_STATUS, undoManager).getSpecialFieldAction(status, this.frame));
}

actions.put(Actions.TOGGLE_PREVIEW, () -> {
PreviewPreferences previewPreferences = Globals.prefs.getPreviewPreferences();
boolean enabled = !previewPreferences.isPreviewPanelEnabled();
PreviewPreferences newPreviewPreferences = previewPreferences.getBuilder()
.withPreviewPanelEnabled(enabled)
.build();
.withPreviewPanelEnabled(enabled)
.build();
Globals.prefs.storePreviewPreferences(newPreviewPreferences);
DefaultTaskExecutor.runInJavaFXThread(() -> setPreviewActiveBasePanels(enabled));
});
Expand Down Expand Up @@ -516,9 +516,9 @@ private void copyTitle() {
if (!selectedBibEntries.isEmpty()) {
// Collect all non-null titles.
List<String> titles = selectedBibEntries.stream()
.filter(bibEntry -> bibEntry.getTitle().isPresent())
.map(bibEntry -> bibEntry.getTitle().get())
.collect(Collectors.toList());
.filter(bibEntry -> bibEntry.getTitle().isPresent())
.map(bibEntry -> bibEntry.getTitle().get())
.collect(Collectors.toList());

if (titles.isEmpty()) {
output(Localization.lang("None of the selected entries have titles."));
Expand Down Expand Up @@ -550,8 +550,8 @@ private void copyCiteKey() {

String sb = String.join(",", keys);
String citeCommand = Optional.ofNullable(Globals.prefs.get(JabRefPreferences.CITE_COMMAND))
.filter(cite -> cite.contains("\\")) // must contain \
.orElse("\\cite");
.filter(cite -> cite.contains("\\")) // must contain \
.orElse("\\cite");
Globals.clipboardManager.setContent(citeCommand + "{" + sb + '}');

if (keys.size() == bes.size()) {
Expand Down Expand Up @@ -595,7 +595,7 @@ private void copyKeyAndTitle() {
Layout layout;
try {
layout = new LayoutHelper(sr, Globals.prefs.getLayoutFormatterPreferences(Globals.journalAbbreviationLoader))
.getLayoutFromText();
.getLayoutFromText();
} catch (IOException e) {
LOGGER.info("Could not get layout", e);
return;
Expand Down Expand Up @@ -685,7 +685,7 @@ private boolean saveDatabase(File file, boolean selectedOnly, Charset encoding,
final String SAVE_DATABASE = Localization.lang("Save library");
try {
SavePreferences prefs = Globals.prefs.loadForSaveFromPreferences()
.withEncoding(encoding)
.withEncoding(encoding)
.withSaveType(saveType);
BibtexDatabaseWriter<SaveSession> databaseWriter = new BibtexDatabaseWriter<>(
FileSaveSession::new);
Expand Down Expand Up @@ -718,7 +718,7 @@ private boolean saveDatabase(File file, boolean selectedOnly, Charset encoding,
boolean commit = true;
if (!session.getWriter().couldEncodeAll()) {
FormBuilder builder = FormBuilder.create()
.layout(new FormLayout("left:pref, 4dlu, fill:pref", "pref, 4dlu, pref"));
.layout(new FormLayout("left:pref, 4dlu, fill:pref", "pref, 4dlu, pref"));
JTextArea ta = new JTextArea(session.getWriter().getProblemCharacters());
ta.setEditable(false);
builder.add(Localization.lang("The chosen encoding '%0' could not encode the following characters:", session.getEncoding().displayName())).xy(1, 1);
Expand Down Expand Up @@ -867,12 +867,12 @@ private void createMainTable() {

// Update entry editor and preview according to selected entries
mainTable.addSelectionListener(event -> mainTable.getSelectedEntries()
.stream()
.findFirst()
.ifPresent(entry -> {
preview.setEntry(entry);
entryEditor.setEntry(entry);
}));
.stream()
.findFirst()
.ifPresent(entry -> {
preview.setEntry(entry);
entryEditor.setEntry(entry);
}));

// TODO: Register these actions globally
/*
Expand Down Expand Up @@ -962,8 +962,8 @@ public void setupMainPanel() {
// Saves the divider position as soon as it changes
// We need to keep a reference to the subscription, otherwise the binding gets garbage collected
dividerPositionSubscription = EasyBind.monadic(Bindings.valueAt(splitPane.getDividers(), 0))
.flatMap(SplitPane.Divider::positionProperty)
.subscribe((observable, oldValue, newValue) -> saveDividerLocation(newValue));
.flatMap(SplitPane.Divider::positionProperty)
.subscribe((observable, oldValue, newValue) -> saveDividerLocation(newValue));
}

/**
Expand Down Expand Up @@ -1093,9 +1093,9 @@ public void previousPreviewStyle() {

private void cyclePreview(int newPosition) {
PreviewPreferences previewPreferences = Globals.prefs.getPreviewPreferences()
.getBuilder()
.withPreviewCyclePosition(newPosition)
.build();
.getBuilder()
.withPreviewCyclePosition(newPosition)
.build();
Globals.prefs.storePreviewPreferences(previewPreferences);

preview.updateLayout(previewPreferences);
Expand Down Expand Up @@ -1259,11 +1259,11 @@ public boolean showDeleteConfirmationDialog(int numberOfEntries) {
}

return dialogService.showConfirmationDialogWithOptOutAndWait(title,
message,
okButton,
cancelButton,
Localization.lang("Disable this confirmation dialog"),
optOut -> Globals.prefs.putBoolean(JabRefPreferences.CONFIRM_DELETE, !optOut));
message,
okButton,
cancelButton,
Localization.lang("Disable this confirmation dialog"),
optOut -> Globals.prefs.putBoolean(JabRefPreferences.CONFIRM_DELETE, !optOut));
} else {
return true;
}
Expand Down Expand Up @@ -1303,9 +1303,9 @@ private void saveDividerLocation(Number position) {

if (mode == BasePanelMode.SHOWING_PREVIEW) {
PreviewPreferences previewPreferences = Globals.prefs.getPreviewPreferences()
.getBuilder()
.withPreviewPanelDividerPosition(position)
.build();
.getBuilder()
.withPreviewPanelDividerPosition(position)
.build();
Globals.prefs.storePreviewPreferences(previewPreferences);
} else if (mode == BasePanelMode.SHOWING_EDITOR) {
preferences.setEntryEditorDividerPosition(position.doubleValue());
Expand Down Expand Up @@ -1600,18 +1600,18 @@ public void action() {
List<LinkedFile> files = bes.get(0).getFiles();

Optional<LinkedFile> linkedFile = files.stream()
.filter(file -> (FieldName.URL.equalsIgnoreCase(file.getFileType())
|| FieldName.PS.equalsIgnoreCase(file.getFileType())
|| FieldName.PDF.equalsIgnoreCase(file.getFileType())))
.findFirst();
.filter(file -> (FieldName.URL.equalsIgnoreCase(file.getFileType())
|| FieldName.PS.equalsIgnoreCase(file.getFileType())
|| FieldName.PDF.equalsIgnoreCase(file.getFileType())))
.findFirst();

if (linkedFile.isPresent()) {

try {

JabRefDesktop.openExternalFileAnyFormat(bibDatabaseContext,
linkedFile.get().getLink(),
ExternalFileTypes.getInstance().fromLinkedFile(linkedFile.get(), true));
linkedFile.get().getLink(),
ExternalFileTypes.getInstance().fromLinkedFile(linkedFile.get(), true));

output(Localization.lang("External viewer called") + '.');
} catch (IOException e) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/ReplaceString.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<TextField fx:id="replaceField" GridPane.columnIndex="1" GridPane.rowIndex="2"
GridPane.columnSpan="4"/>
<CheckBox fx:id="selectFieldOnly" GridPane.columnIndex="0" GridPane.rowIndex="4" GridPane.columnSpan="2"
text="%Limit to Selected Entries"/>
text="%Limit to Selected Entries"/>
<RadioButton fx:id="allReplace" GridPane.columnIndex="0" GridPane.rowIndex="5" GridPane.columnSpan="2"
selected="true" text="%All Field Replace">
<toggleGroup>
Expand Down
Loading