Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into eclipsejava11
Browse files Browse the repository at this point in the history
* upstream/master:
  Bump com.github.ben-manes.versions from 0.22.0 to 0.24.0 (#5272)
  Bump src/main/resources/csl-styles from `f5a7311` to `fa125ec`
  Bump richtextfx from 0.10.1 to 0.10.2
  Bump guava from 28.0-jre to 28.1-jre
  Bump org.beryx.jlink from 2.15.0 to 2.15.1
  Bump checkstyle from 8.23 to 8.24
  Bump jakarta.annotation-api from 1.3.4 to 1.3.5
  fixed dependency on gui and added archUnitTest
  capsulated all usages of MaterialDesignIcon in gui/icons and removed IconFactory again
  added all used icons to IconTheme
  workaround for issue #5245, added custom Factory class
  adjusted gitignore to properly match icon classes
  • Loading branch information
Siedlerchr committed Sep 2, 2019
2 parents d1f55e9 + 89ebaf7 commit b57fed0
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -351,4 +351,4 @@ lib/ojdbc.jar
!/buildSrc/src/main/groovy/org/jabref/build

# do not ignore JabRef icons (they are ignored by the macos setting above)
!gui/icon/**/*
!src/main/java/org/jabref/gui/icon
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "src/main/resources/csl-styles"]
path = src/main/resources/csl-styles
url = https://github.com/citation-style-language/styles.git
[submodule "src/main/resources/csl-locales"]
path = src/main/resources/csl-locales
url = https://github.com/citation-style-language/locales.git
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ plugins {
id "com.simonharrer.modernizer" version '1.8.0-1'
id 'me.champeau.gradle.jmh' version '0.4.8'
//id 'net.ltgt.errorprone' version '0.8.1'
id 'com.github.ben-manes.versions' version '0.22.0'
id 'com.github.ben-manes.versions' version '0.24.0'
id 'org.javamodularity.moduleplugin' version '1.5.0'
id 'org.openjfx.javafxplugin' version '0.0.8'
id 'org.beryx.jlink' version '2.15.0'
id 'org.beryx.jlink' version '2.15.1'
}

// use the gradle build scan feature: https://scans.gradle.com/get-started
Expand Down Expand Up @@ -150,12 +150,12 @@ dependencies {

compile 'org.postgresql:postgresql:42.2.6'

compile ('com.google.guava:guava:28.0-jre') {
compile ('com.google.guava:guava:28.1-jre') {
// TODO: Remove this as soon as https://github.com/google/guava/issues/2960 is fixed
exclude module: "jsr305"
}

compile group: 'jakarta.annotation', name: 'jakarta.annotation-api', version: '1.3.4'
compile group: 'jakarta.annotation', name: 'jakarta.annotation-api', version: '1.3.5'

// JavaFX stuff
compile 'de.jensd:fontawesomefx-commons:11.0'
Expand All @@ -164,7 +164,7 @@ dependencies {
compile 'de.saxsys:mvvmfx:1.8.0'
compile 'org.fxmisc.easybind:easybind:1.0.3'
compile 'org.fxmisc.flowless:flowless:0.6.1'
compile 'org.fxmisc.richtext:richtextfx:0.10.1'
compile 'org.fxmisc.richtext:richtextfx:0.10.2'
compile group: 'org.glassfish.hk2.external', name: 'jakarta.inject', version: '2.6.1'
compile 'com.jfoenix:jfoenix:9.0.9'
compile 'org.controlsfx:controlsfx:11.0.0'
Expand Down Expand Up @@ -224,7 +224,7 @@ dependencies {
testCompile "org.testfx:testfx-core:4.0.15-alpha"
testCompile "org.testfx:testfx-junit5:4.0.15-alpha"

checkstyle 'com.puppycrawl.tools:checkstyle:8.23'
checkstyle 'com.puppycrawl.tools:checkstyle:8.24'
xjc 'com.sun.xml.bind:jaxb-xjc:2.2.4-1'
jython 'org.python:jython-standalone:2.7.1'
}
Expand Down
21 changes: 9 additions & 12 deletions src/main/java/org/jabref/gui/copyfiles/CopyFilesDialogView.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,19 @@
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.paint.Color;
import javafx.scene.text.Text;

import org.jabref.gui.icon.IconTheme;
import org.jabref.gui.icon.JabRefIcon;
import org.jabref.gui.util.BaseDialog;
import org.jabref.gui.util.ValueTableCellFactory;
import org.jabref.logic.l10n.Localization;

import com.airhacks.afterburner.views.ViewLoader;
import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon;
import de.jensd.fx.glyphs.materialdesignicons.utils.MaterialDesignIconFactory;

public class CopyFilesDialogView extends BaseDialog<Void> {

@FXML private TableView<CopyFilesResultItemViewModel> tvResult;
@FXML private TableColumn<CopyFilesResultItemViewModel, MaterialDesignIcon> colStatus;
@FXML private TableColumn<CopyFilesResultItemViewModel, JabRefIcon> colStatus;
@FXML private TableColumn<CopyFilesResultItemViewModel, String> colMessage;
@FXML private TableColumn<CopyFilesResultItemViewModel, String> colFile;
private final CopyFilesDialogViewModel viewModel;
Expand Down Expand Up @@ -46,16 +45,14 @@ private void setupTable() {
colStatus.setCellValueFactory(cellData -> cellData.getValue().getIcon());

colFile.setCellFactory(new ValueTableCellFactory<CopyFilesResultItemViewModel, String>().withText(item -> item).withTooltip(item -> item));
colStatus.setCellFactory(new ValueTableCellFactory<CopyFilesResultItemViewModel, MaterialDesignIcon>().withGraphic(item -> {

Text icon = MaterialDesignIconFactory.get().createIcon(item);
if (item == MaterialDesignIcon.CHECK) {
icon.setFill(Color.GREEN);
colStatus.setCellFactory(new ValueTableCellFactory<CopyFilesResultItemViewModel, JabRefIcon>().withGraphic(item -> {
if (item == IconTheme.JabRefIcons.CHECK) {
item = item.withColor(Color.GREEN);
}
if (item == MaterialDesignIcon.ALERT) {
icon.setFill(Color.RED);
if (item == IconTheme.JabRefIcons.WARNING) {
item = item.withColor(Color.RED);
}
return icon;
return item.getGraphicNode();
}));

tvResult.setItems(viewModel.copyFilesResultListProperty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,20 @@
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;

import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon;
import org.jabref.gui.icon.IconTheme;
import org.jabref.gui.icon.JabRefIcon;

public class CopyFilesResultItemViewModel {

private final StringProperty file = new SimpleStringProperty("");
private final ObjectProperty<MaterialDesignIcon> icon = new SimpleObjectProperty<>(MaterialDesignIcon.ALERT);
private final ObjectProperty<JabRefIcon> icon = new SimpleObjectProperty<>(IconTheme.JabRefIcons.WARNING);
private final StringProperty message = new SimpleStringProperty("");

public CopyFilesResultItemViewModel(Path file, boolean success, String message) {
this.file.setValue(file.toString());
this.message.setValue(message);
if (success) {
this.icon.setValue(MaterialDesignIcon.CHECK);
this.icon.setValue(IconTheme.JabRefIcons.CHECK);
}
}

Expand All @@ -31,7 +32,7 @@ public StringProperty getMessage() {
return message;
}

public ObjectProperty<MaterialDesignIcon> getIcon() {
public ObjectProperty<JabRefIcon> getIcon() {
return icon;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.jabref.gui.DragAndDropDataFormats;
import org.jabref.gui.autocompleter.AutoCompleteSuggestionProvider;
import org.jabref.gui.copyfiles.CopySingleFileAction;
import org.jabref.gui.icon.IconTheme;
import org.jabref.gui.keyboard.KeyBinding;
import org.jabref.gui.util.TaskExecutor;
import org.jabref.gui.util.ViewModelListCellFactory;
Expand All @@ -42,8 +43,6 @@
import org.jabref.preferences.JabRefPreferences;

import com.airhacks.afterburner.views.ViewLoader;
import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon;
import de.jensd.fx.glyphs.materialdesignicons.utils.MaterialDesignIconFactory;

public class LinkedFilesEditor extends HBox implements FieldEditorFX {

Expand Down Expand Up @@ -142,13 +141,13 @@ private static Node createFileDisplay(LinkedFileViewModel linkedFile) {
info.setStyle("-fx-padding: 0.5em 0 0.5em 0;"); // To align with buttons below which also have 0.5em padding
info.getChildren().setAll(icon, link, desc, progressIndicator);

Button acceptAutoLinkedFile = MaterialDesignIconFactory.get().createIconButton(MaterialDesignIcon.BRIEFCASE_CHECK);
Button acceptAutoLinkedFile = IconTheme.JabRefIcons.AUTO_LINKED_FILE.asButton();
acceptAutoLinkedFile.setTooltip(new Tooltip(Localization.lang("This file was found automatically. Do you want to link it to this entry?")));
acceptAutoLinkedFile.visibleProperty().bind(linkedFile.isAutomaticallyFoundProperty());
acceptAutoLinkedFile.setOnAction(event -> linkedFile.acceptAsLinked());
acceptAutoLinkedFile.getStyleClass().setAll("icon-button");

Button writeXMPMetadata = MaterialDesignIconFactory.get().createIconButton(MaterialDesignIcon.IMPORT);
Button writeXMPMetadata = IconTheme.JabRefIcons.IMPORT.asButton();
writeXMPMetadata.setTooltip(new Tooltip(Localization.lang("Write BibTeXEntry as XMP-metadata to PDF.")));
writeXMPMetadata.visibleProperty().bind(linkedFile.canWriteXMPMetadataProperty());
writeXMPMetadata.setOnAction(event -> linkedFile.writeXMPMetadata());
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import org.jabref.model.strings.StringUtil;

import com.google.common.base.Enums;
import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon;
import org.fxmisc.easybind.EasyBind;

public class GroupNodeViewModel {
Expand Down Expand Up @@ -200,7 +199,7 @@ private JabRefIcon createDefaultIcon() {
}

private Optional<JabRefIcon> parseIcon(String iconCode) {
return Enums.getIfPresent(MaterialDesignIcon.class, iconCode.toUpperCase(Locale.ENGLISH))
return Enums.getIfPresent(IconTheme.JabRefIcons.class, iconCode.toUpperCase(Locale.ENGLISH))
.toJavaUtil()
.map(icon -> new InternalMaterialDesignIcon(getColor(), icon));
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/jabref/gui/icon/IconTheme.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import javafx.scene.image.Image;
import javafx.scene.paint.Color;

import org.jabref.logic.groups.DefaultGroupsFactory;
import org.jabref.preferences.JabRefPreferences;

import de.jensd.fx.glyphs.GlyphIcons;
Expand Down Expand Up @@ -209,6 +208,7 @@ public enum JabRefIcons implements JabRefIcon {
EXPORT_TO_CLIPBOARD(MaterialDesignIcon.CLIPBOARD_ARROW_LEFT) /*css: clipboard-arrow-left */,
ATTACH_FILE(MaterialDesignIcon.PAPERCLIP) /*css: paperclip*/,
AUTO_FILE_LINK(MaterialDesignIcon.FILE_FIND) /*css: file-find */,
AUTO_LINKED_FILE(MaterialDesignIcon.BRIEFCASE_CHECK) /*css: briefcase-check */,
QUALITY_ASSURED(MaterialDesignIcon.CERTIFICATE), /*css: certificate */
QUALITY(MaterialDesignIcon.CERTIFICATE), /*css: certificate */
OPEN(MaterialDesignIcon.FOLDER_OUTLINE) /*css: folder */,
Expand Down Expand Up @@ -251,6 +251,7 @@ public enum JabRefIcons implements JabRefIcon {
FIND_DUPLICATES(MaterialDesignIcon.CODE_EQUAL), /*css: code-equal */
CONNECT_DB(MaterialDesignIcon.CLOUD_UPLOAD), /*cloud-upload*/
SUCCESS(MaterialDesignIcon.CHECK_CIRCLE),
CHECK(MaterialDesignIcon.CHECK) /*css: check */,
WARNING(MaterialDesignIcon.ALERT),
ERROR(MaterialDesignIcon.ALERT_CIRCLE),
CASE_SENSITIVE(MaterialDesignIcon.ALPHABETICAL), /* css: mdi-alphabetical */
Expand All @@ -263,7 +264,7 @@ public enum JabRefIcons implements JabRefIcon {
DATE_PICKER(MaterialDesignIcon.CALENDAR), /* css: calendar */
DEFAULT_GROUP_ICON_COLORED(MaterialDesignIcon.PLAY),
DEFAULT_GROUP_ICON(MaterialDesignIcon.LABEL_OUTLINE),
ALL_ENTRIES_GROUP_ICON(DefaultGroupsFactory.ALL_ENTRIES_GROUP_DEFAULT_ICON),
ALL_ENTRIES_GROUP_ICON(MaterialDesignIcon.DATABASE),
IMPORT(MaterialDesignIcon.CALL_RECEIVED),
EXPORT(MaterialDesignIcon.CALL_MADE),
PREVIOUS_LEFT(MaterialDesignIcon.CHEVRON_LEFT),
Expand Down
20 changes: 8 additions & 12 deletions src/main/java/org/jabref/gui/util/ViewModelListCellFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,12 @@
import javafx.scene.control.Tooltip;
import javafx.scene.input.DragEvent;
import javafx.scene.input.MouseEvent;
import javafx.scene.paint.Paint;
import javafx.scene.text.Text;
import javafx.scene.paint.Color;
import javafx.util.Callback;

import org.jabref.gui.icon.JabRefIcon;
import org.jabref.model.strings.StringUtil;

import de.jensd.fx.glyphs.GlyphIcons;
import de.jensd.fx.glyphs.materialdesignicons.utils.MaterialDesignIconFactory;

/**
* Constructs a {@link ListCell} based on the view model of the row and a bunch of specified converter methods.
*
Expand Down Expand Up @@ -53,22 +50,21 @@ public ViewModelListCellFactory<T> withGraphic(Callback<T, Node> toGraphic) {
return this;
}

public ViewModelListCellFactory<T> withIcon(Callback<T, GlyphIcons> toIcon) {
public ViewModelListCellFactory<T> withIcon(Callback<T, JabRefIcon> toIcon) {
this.toGraphic = viewModel -> {
GlyphIcons icon = toIcon.call(viewModel);
JabRefIcon icon = toIcon.call(viewModel);
if (icon != null) {
return MaterialDesignIconFactory.get().createIcon(icon);
return icon.getGraphicNode();
}
return null;
};
return this;
}

public ViewModelListCellFactory<T> withIcon(Callback<T, GlyphIcons> toIcon, Callback<T, Paint> toColor) {
public ViewModelListCellFactory<T> withIcon(Callback<T, JabRefIcon> toIcon, Callback<T, Color> toColor) {
this.toGraphic = viewModel -> {
Text graphic = MaterialDesignIconFactory.get().createIcon(toIcon.call(viewModel));
graphic.setFill(toColor.call(viewModel));
return graphic;

return toIcon.call(viewModel).withColor(toColor.call(viewModel)).getGraphicNode();
};
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@
import org.jabref.logic.l10n.Localization;
import org.jabref.model.groups.AllEntriesGroup;

import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon;

public class DefaultGroupsFactory {

public static MaterialDesignIcon ALL_ENTRIES_GROUP_DEFAULT_ICON = MaterialDesignIcon.DATABASE;
private static String ALL_ENTRIES_GROUP_DEFAULT_ICON = "ALL_ENTRIES_GROUP_ICON";

private DefaultGroupsFactory() {
}

public static AllEntriesGroup getAllEntriesGroup() {
AllEntriesGroup group = new AllEntriesGroup(Localization.lang("All entries"));
group.setIconName(ALL_ENTRIES_GROUP_DEFAULT_ICON.name());
group.setIconName(ALL_ENTRIES_GROUP_DEFAULT_ICON);
return group;
}
}
1 change: 0 additions & 1 deletion src/main/resources/csl-styles
Submodule csl-styles deleted from 6ed87f
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ public static void doNotUseJGoodies(JavaClasses classes) {
public static void doNotUseGlazedLists(JavaClasses classes) {
noClasses().should().accessClassesThat().resideInAPackage("ca.odell.glazedlists..").check(classes);
}


@ArchTest
public static void doNotUseGlyphsDirectly(JavaClasses classes) {
noClasses().that().resideOutsideOfPackage("org.jabref.gui.icon").should().accessClassesThat().resideInAnyPackage("de.jensd.fx.glyphs", "de.jensd.fx.glyphs.materialdesignicons").check(classes);
}

//"Currently disabled as there is no alternative for the rest of classes who need awt"
@ArchIgnore
@ArchTest
Expand Down

0 comments on commit b57fed0

Please sign in to comment.