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

Getting Rid of Swing #4894

Merged
merged 30 commits into from
Aug 23, 2019
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7efd35f
Add Architecture Test for the usage of Swing and JGoodies
LinusDietz Apr 18, 2019
e47970a
Delete unused classes
LinusDietz Apr 18, 2019
7681ac5
Fix test for matching sub-packages of Swing and JGoodies
LinusDietz Apr 18, 2019
90a64e1
Merge branch 'master' of https://github.com/JabRef/jabref into swing-…
LinusDietz Apr 18, 2019
176a4b9
remove iconset and obsolete key methods
Siedlerchr Apr 18, 2019
3418ca6
remove some more keybindings
Siedlerchr Apr 18, 2019
a9fcb84
Remove FileListTableModel and associated class, improve opening file …
Siedlerchr Apr 18, 2019
5551b60
remove showMessage
Siedlerchr Apr 18, 2019
0f42801
remove swing from file type
Siedlerchr Apr 18, 2019
807e9d0
remove whitespace
Siedlerchr Apr 18, 2019
d214b7f
fix loading of external file type edit dialog
Siedlerchr Apr 18, 2019
69ec0a3
Merge remote-tracking branch 'upstream/master' into swing-test
Siedlerchr Apr 18, 2019
63199fc
remove glazedlists, this time remove all dependencies
Siedlerchr Apr 18, 2019
91e6572
Merge remote-tracking branch 'upstream/master' into swing-test
Siedlerchr Apr 30, 2019
672ca79
remove emacs keybinding
Siedlerchr Apr 30, 2019
47cac3e
remove emacs keybinding rest
Siedlerchr Apr 30, 2019
2104788
Improve tests to exclude the UndoManager
LinusDietz May 2, 2019
76b27a3
Deleted unused FieldSetComponent
LinusDietz May 2, 2019
17d33c0
Merge branch 'master' into swing-test
LinusDietz Jun 6, 2019
f9997ed
Check for awt usages
tobiasdiez Jun 6, 2019
0937d01
Merge remote-tracking branch 'upstream/master' into swing-test
Siedlerchr Jun 8, 2019
70a5c67
Remove awt font and color methods
Siedlerchr Jun 8, 2019
c36af5e
enable backwards compatiblitiy with font size
Siedlerchr Jun 9, 2019
e89333c
Merge remote-tracking branch 'upstream/master' into swing-test
Siedlerchr Jul 25, 2019
4985ca1
Fix remaining swing issues
Siedlerchr Jul 25, 2019
9784798
fix l10n
Siedlerchr Jul 25, 2019
fa25c93
Merge branch 'master' into swing-test
LinusDietz Aug 13, 2019
3e1270d
fix mods tests
LinusDietz Aug 13, 2019
a78f1be
Merge pull request #5189 from JabRef/fix-swing-test
LinusDietz Aug 13, 2019
18ccbb4
Merge remote-tracking branch 'upstream/master' into swing-test
Siedlerchr Aug 23, 2019
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
2 changes: 0 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ dependencies {

compile 'org.postgresql:postgresql:42.2.5'

compile 'net.java.dev.glazedlists:glazedlists_java15:1.9.1'

compile 'com.google.guava:guava:27.1-jre'

// JavaFX stuff
Expand Down
48 changes: 24 additions & 24 deletions src/main/java/org/jabref/gui/BasePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,8 @@
import org.jabref.gui.exporter.SaveDatabaseAction;
import org.jabref.gui.exporter.WriteXMPAction;
import org.jabref.gui.externalfiles.FindFullTextAction;
import org.jabref.gui.externalfiletype.ExternalFileMenuItem;
import org.jabref.gui.externalfiletype.ExternalFileType;
import org.jabref.gui.externalfiletype.ExternalFileTypes;
import org.jabref.gui.filelist.FileListEntry;
import org.jabref.gui.filelist.FileListTableModel;
import org.jabref.gui.icon.JabRefIcon;
import org.jabref.gui.importer.actions.AppendDatabaseAction;
import org.jabref.gui.journals.AbbreviateAction;
import org.jabref.gui.journals.UnabbreviateAction;
Expand All @@ -68,6 +64,7 @@
import org.jabref.gui.undo.UndoableFieldChange;
import org.jabref.gui.undo.UndoableInsertEntry;
import org.jabref.gui.undo.UndoableRemoveEntry;
import org.jabref.gui.util.BackgroundTask;
import org.jabref.gui.util.DefaultTaskExecutor;
import org.jabref.gui.worker.SendAsEMailAction;
import org.jabref.logic.citationstyle.CitationStyleCache;
Expand All @@ -93,6 +90,7 @@
import org.jabref.model.database.shared.DatabaseSynchronizer;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.FieldName;
import org.jabref.model.entry.FileFieldParser;
import org.jabref.model.entry.InternalBibtexFields;
import org.jabref.model.entry.LinkedFile;
import org.jabref.model.entry.event.EntryChangedEvent;
Expand Down Expand Up @@ -571,24 +569,27 @@ private void openExternalFile() {
output(Localization.lang("This operation requires exactly one item to be selected."));
return;
}
JabRefExecutorService.INSTANCE.execute(() -> {
final BibEntry entry = selectedEntries.get(0);
if (!entry.hasField(FieldName.FILE)) {
// no bibtex field
new SearchAndOpenFile(entry, BasePanel.this).searchAndOpen();
return;
}
FileListTableModel fileListTableModel = new FileListTableModel();
entry.getField(FieldName.FILE).ifPresent(fileListTableModel::setContent);
if (fileListTableModel.getRowCount() == 0) {
// content in BibTeX field is not readable
new SearchAndOpenFile(entry, BasePanel.this).searchAndOpen();
return;
}
FileListEntry flEntry = fileListTableModel.getEntry(0);
ExternalFileMenuItem item = new ExternalFileMenuItem(frame(), "", flEntry.getLink(), flEntry.getType().map(ExternalFileType::getIcon).map(JabRefIcon::getSmallIcon).orElse(null), bibDatabaseContext, flEntry.getType());
item.doClick();
});
final BibEntry entry = selectedEntries.get(0);
if (!entry.hasField(FieldName.FILE)) {
// no bibtex field
BackgroundTask.wrap(() -> new SearchAndOpenFile(entry, BasePanel.this).searchAndOpen()).executeWith(Globals.TASK_EXECUTOR);
return;
}

List<LinkedFile> files = new ArrayList<>();
entry.getField(FieldName.FILE).map(FileFieldParser::parse).ifPresent(files::addAll);

if (files.isEmpty()) {
// content in BibTeX field is not readable
BackgroundTask.wrap(() -> new SearchAndOpenFile(entry, BasePanel.this).searchAndOpen()).executeWith(Globals.TASK_EXECUTOR);
return;
}
LinkedFile flEntry = files.get(0);
try {
JabRefDesktop.openExternalFileAnyFormat(this.getBibDatabaseContext(), flEntry.getLink(), ExternalFileTypes.getInstance().fromLinkedFile(flEntry, true));
} catch (IOException ex) {
dialogService.showErrorDialogAndWait(ex);
}
}

/**
Expand Down Expand Up @@ -948,8 +949,7 @@ public void entryEditorClosing(EntryEditor editor) {
* Closes the entry editor or preview panel if it is showing the given entry.
*/
public void ensureNotShowingBottomPanel(BibEntry entry) {
if (((mode == BasePanelMode.SHOWING_EDITOR) && (entryEditor.getEntry() == entry))
|| ((mode == BasePanelMode.SHOWING_PREVIEW))) {
if (((mode == BasePanelMode.SHOWING_EDITOR) && (entryEditor.getEntry() == entry)) || ((mode == BasePanelMode.SHOWING_PREVIEW))) {
closeBottomPane();
}
}
Expand Down
18 changes: 6 additions & 12 deletions src/main/java/org/jabref/gui/GUIGlobals.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package org.jabref.gui;

import java.awt.Color;
import java.awt.Font;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;

import org.jabref.Globals;
import org.jabref.gui.icon.IconTheme;
import org.jabref.gui.keyboard.EmacsKeyBindings;
import org.jabref.gui.util.CustomLocalDragboard;
import org.jabref.logic.l10n.Localization;
import org.jabref.preferences.JabRefPreferences;
Expand Down Expand Up @@ -45,21 +44,16 @@ public static void updateEntryEditorColors() {
* on Un*x is unavailable.
*/
public static void init() {
if (Globals.prefs.getBoolean(JabRefPreferences.EDITOR_EMACS_KEYBINDINGS)) {
EmacsKeyBindings.load();
}

// Set up entry editor colors, first time:
GUIGlobals.updateEntryEditorColors();

IconTheme.loadFonts();
GUIGlobals.currentFont = new Font(Globals.prefs.get(JabRefPreferences.FONT_FAMILY),
Globals.prefs.getInt(JabRefPreferences.FONT_STYLE), Globals.prefs.getInt(JabRefPreferences.FONT_SIZE));
GUIGlobals.currentFont = new Font(Globals.prefs.get(JabRefPreferences.FONT_FAMILY), Globals.prefs.getInt(JabRefPreferences.FONT_SIZE));
}

public static void setFont(int size) {
currentFont = new Font(currentFont.getFamily(), currentFont.getStyle(), size);
public static void setFont(double size) {
currentFont = new Font(currentFont.getFamily(), size);
// update preferences
Globals.prefs.putInt(JabRefPreferences.FONT_SIZE, size);
Globals.prefs.putDouble(JabRefPreferences.FONT_SIZE, size);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess with this we will run into backwards compatibility issues similar to the ones we had with a different preference option.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, yeah will look if it makes sense to either convert to int or store in new settings

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naive question: can't be stick to Int and just convert to Double during setting the stuff? I would assume that 14.5pt is currently not used --> future work ^^

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it already to int again. Globals.prefs.putInt(JabRefPreferences.FONT_SIZE, size);
So it's fine

}
}
54 changes: 0 additions & 54 deletions src/main/java/org/jabref/gui/JabRefDialog.java

This file was deleted.

18 changes: 2 additions & 16 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import java.util.TimerTask;
import java.util.stream.Collectors;

import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;

import javafx.application.Platform;
Expand Down Expand Up @@ -1061,18 +1060,9 @@ public void setProgressBarVisible(final boolean visible) {
/**
* Sets the indeterminate status of the progress bar.
* <p>
* If not called on the event dispatch thread, this method uses SwingUtilities.invokeLater() to do the actual
* operation on the EDT.
*/
public void setProgressBarIndeterminate(final boolean value) {
// TODO: Reimplement
/*
if (SwingUtilities.isEventDispatchThread()) {
progressBar.setIndeterminate(value);
} else {
SwingUtilities.invokeLater(() -> progressBar.setIndeterminate(value));
}
*/
progressBar.setProgress(ProgressBar.INDETERMINATE_PROGRESS);
}

/**
Expand Down Expand Up @@ -1105,10 +1095,6 @@ private boolean isExistURLorDOI(List<BibEntry> selectEntryList) {
return false;
}

public void showMessage(String message) {
JOptionPane.showMessageDialog(null, message);
}

/**
* Ask if the user really wants to close the given database
*
Expand Down Expand Up @@ -1295,7 +1281,7 @@ private void increaseTableFontSize() {
}

private void decreaseTableFontSize() {
int currentSize = GUIGlobals.currentFont.getSize();
double currentSize = GUIGlobals.currentFont.getSize();
if (currentSize < 2) {
return;
}
Expand Down
139 changes: 0 additions & 139 deletions src/main/java/org/jabref/gui/customentrytypes/EntryTypeList.java

This file was deleted.

Loading