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

Remove dependency to jgoodies-looks #3458

Merged
merged 8 commits into from
Jan 2, 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#

### Changed


### Fixed

### Removed
- We removed the Look and Feels from jgoodies, because these are not compatible with Java 9



Expand Down
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ dependencies {

compile 'com.jgoodies:jgoodies-common:1.8.1'
compile 'com.jgoodies:jgoodies-forms:1.9.0'
compile 'com.jgoodies:jgoodies-looks:2.7.0'

// update to 2.0.x is not possible - see https://github.com/JabRef/jabref/pull/1096#issuecomment-208857517
compile 'org.apache.pdfbox:pdfbox:1.8.13'
Expand Down
5 changes: 0 additions & 5 deletions external-libraries.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ Project: JGoodies Forms
URL: http://www.jgoodies.com/downloads/libraries/
License: BSD

Id: com.jgoodies:jgoodies-looks
Project: JGoodies Looks
URL: http://www.jgoodies.com/downloads/libraries/
License: BSD

Id: com.mashape.unirest
Project: Unirest for Java
URL: https://github.com/Mashape/unirest-java
Expand Down
8 changes: 1 addition & 7 deletions src/main/java/org/jabref/JabRefGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.plaf.FontUIResource;
import javax.swing.plaf.metal.MetalLookAndFeel;

import org.jabref.gui.BasePanel;
import org.jabref.gui.GUIGlobals;
Expand All @@ -35,8 +34,6 @@
import org.jabref.shared.exception.InvalidDBMSConnectionPropertiesException;
import org.jabref.shared.exception.NotASharedDatabaseException;

import com.jgoodies.looks.plastic.Plastic3DLookAndFeel;
import com.jgoodies.looks.plastic.theme.SkyBluer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

Expand Down Expand Up @@ -251,10 +248,7 @@ private void setLookAndFeel() {
if (UIManager.getCrossPlatformLookAndFeelClassName().equals(lookFeel)
&& !System.getProperty("java.runtime.name").contains("OpenJDK")) {
// try to avoid ending up with the ugly Metal L&F
Plastic3DLookAndFeel lnf = new Plastic3DLookAndFeel();
MetalLookAndFeel.setCurrentTheme(new SkyBluer());
com.jgoodies.looks.Options.setPopupDropShadowEnabled(true);
UIManager.setLookAndFeel(lnf);
UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
} else {
try {
UIManager.setLookAndFeel(lookFeel);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/jabref/JabRefMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ private static void start(String[] args) {
PreferencesMigrations.upgradeStoredCustomEntryTypes();
PreferencesMigrations.upgradeKeyBindingsToJavaFX();
PreferencesMigrations.addCrossRefRelatedFieldsForAutoComplete();
PreferencesMigrations.upgradeObsoleteLookAndFeels();

// Update handling of special fields based on preferences
InternalBibtexFields
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,6 @@
import org.jabref.preferences.SearchPreferences;

import com.google.common.eventbus.Subscribe;
import com.jgoodies.looks.HeaderStyle;
import com.jgoodies.looks.Options;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import osx.macadapter.MacAdapter;
Expand Down Expand Up @@ -895,7 +893,6 @@ public boolean quit() {
}

private void initLayout() {
tabbedPane.putClientProperty(Options.NO_CONTENT_BORDER_KEY, Boolean.TRUE);

setProgressBarVisible(false);

Expand Down Expand Up @@ -1307,7 +1304,6 @@ public void addParserResult(ParserResult pr, boolean focusPanel) {
}

private void createToolBar() {
tlb.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH);
tlb.setBorder(null);
tlb.setRollover(true);

Expand Down
14 changes: 3 additions & 11 deletions src/main/java/org/jabref/gui/preftabs/AppearancePrefsTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.GridBagLayout;
import java.util.HashSet;
import java.util.Arrays;
import java.util.Set;
import java.util.stream.Collectors;

import javax.swing.BorderFactory;
import javax.swing.JButton;
Expand Down Expand Up @@ -58,16 +59,7 @@ class AppearancePrefsTab extends JPanel implements PrefsTab {
static class LookAndFeel {

public static Set<String> getAvailableLookAndFeels() {

Set<String> lookAndFeels = new HashSet<>();
lookAndFeels.add("com.jgoodies.looks.plastic.Plastic3DLookAndFeel");
lookAndFeels.add("com.jgoodies.looks.windows.WindowsLookAndFeel");

for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
lookAndFeels.add(info.getClassName());
}

return lookAndFeels;
return Arrays.stream(UIManager.getInstalledLookAndFeels()).map(LookAndFeelInfo::getClassName).collect(Collectors.toSet());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
import org.jabref.model.entry.specialfields.SpecialField;
import org.jabref.model.entry.specialfields.SpecialFieldValue;

import com.jgoodies.looks.HeaderStyle;
import com.jgoodies.looks.Options;

public class SpecialFieldDropDown {

private SpecialFieldDropDown() {
Expand All @@ -40,7 +37,6 @@ public static JButton generateSpecialFieldButtonWithDropDown(SpecialField field,
button.setSize(buttonDim);
button.setMinimumSize(buttonDim);
button.setMaximumSize(buttonDim);
button.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH);
button.addActionListener(new MenuButtonActionListener(field, frame, button, buttonDim));
return button;
}
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/org/jabref/migrations/PreferencesMigrations.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import org.jabref.Globals;
import org.jabref.JabRefMain;
import org.jabref.logic.util.OS;
import org.jabref.model.bibtexkeypattern.GlobalBibtexKeyPattern;
import org.jabref.model.entry.FieldName;
import org.jabref.preferences.JabRefPreferences;
Expand Down Expand Up @@ -281,4 +282,21 @@ private static void migrateTypedKeyPrefs(JabRefPreferences prefs, Preferences ol
prefs.putKeyPattern(keyPattern);
}

public static void upgradeObsoleteLookAndFeels() {
JabRefPreferences prefs = Globals.prefs;
String currentLandF = prefs.get(JabRefPreferences.WIN_LOOK_AND_FEEL);
if ("com.jgoodies.looks.windows.WindowsLookAndFeel".equals(currentLandF) ||
"com.jgoodies.plaf.plastic.Plastic3DLookAndFeel".equals(currentLandF) ) {
if (OS.WINDOWS) {
String windowsLandF = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
prefs.put(JabRefPreferences.WIN_LOOK_AND_FEEL, windowsLandF);
LOGGER.info("Switched from obsolete look and feel " + currentLandF + " to " + windowsLandF);
} else {
String nimbusLandF = "javax.swing.plaf.nimbus.NimbusLookAndFeel";
prefs.put(JabRefPreferences.WIN_LOOK_AND_FEEL, nimbusLandF);
LOGGER.info("Switched from obsolete look and feel " + currentLandF + " to " + nimbusLandF);
}
}
}

}
4 changes: 2 additions & 2 deletions src/main/java/org/jabref/preferences/JabRefPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -466,12 +466,12 @@ private JabRefPreferences() {
defaults.put(WIN_LOOK_AND_FEEL, UIManager.getSystemLookAndFeelClassName());
defaults.put(EMACS_PATH, "emacsclient");
} else if (OS.WINDOWS) {
defaults.put(WIN_LOOK_AND_FEEL, "com.jgoodies.looks.windows.WindowsLookAndFeel");
defaults.put(WIN_LOOK_AND_FEEL, "com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
Copy link
Member

Choose a reason for hiding this comment

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

According to https://bugs.openjdk.java.net/browse/JDK-8136366, this is a non-public L&F. But reading along, it seems, we are "correctly" using it...

defaults.put(EMACS_PATH, "emacsclient.exe");
} else {
// Linux
defaults.put(FONT_FAMILY, "SansSerif");
defaults.put(WIN_LOOK_AND_FEEL, "com.jgoodies.plaf.plastic.Plastic3DLookAndFeel");
defaults.put(WIN_LOOK_AND_FEEL, "javax.swing.plaf.nimbus.NimbusLookAndFeel");
defaults.put(EMACS_PATH, "emacsclient");
}

Expand Down