Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into exportPdf
Browse files Browse the repository at this point in the history
* upstream/master:
  Update gradle to 4.2.1 (#3322)
  Avoid recreation of the EntryEditor (#3187)
  Fix #3133 telemetry by locking azure to 1.0.9
  German translation for missing properties (#3312)
  Improvement for Java FX font rendering on Linux (#3305)
  Add also conversion for em dash
  Add \textendash to the html conversion table
  Update latex2tunicode from 0.2.1 -> 0.2.2
  Added note about updating controlsfx
  Fix exception/freezing on EntryChangedEvent in Entry Editor (#3299)
  Update libs (#3300)
  update guava from 23.0 -> 23.2
  update mvvmfx-validation from 1.6.0 -> 1.7.0
  Resolves #3255 file open dialog should have "supported formates" filetype
  Fix #3235: remote metadata is updated instead of delete + insert (#3282)
  Change OO paths to Libre Office in preferences (#3287)
  Fix #2471: remove line breaks from abstracts in ADS fetcher (#3285)
  Resolves #3280 Empty String instead of N/A (#3288)
  • Loading branch information
Siedlerchr committed Oct 19, 2017
2 parents edec73d + 460b7e8 commit 95474ea
Show file tree
Hide file tree
Showing 36 changed files with 335 additions and 273 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,20 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We added bracketed expresion support for file search patterns, import file name patterns and file directory patters, in addition to bibtexkey patterns.
- We added support for '[entrytype]' bracketed expression.
- Updated French translation
- We improved the handling of abstracts in the "Astrophysics Data System" fetcher. [#2471](https://github.com/JabRef/jabref/issues/2471)
- We added support for pasting entries in different formats [#3143](https://github.com/JabRef/jabref/issues/3143)
- Crossreferenced entries are now used when a BibTex key is generated for an entry with empty fields. [#2811](https://github.com/JabRef/jabref/issues/2811)
- We now set the WM_CLASS of the UI to org-jabref-JabRefMain to allow certain Un*x window managers to properly identify its windows
- We changed the default paths for the OpenOffice/LibreOffice binaries to the default path for LibreOffice
- We no longer create a new entry editor when selecting a new entry to increase performance. [#3187](https://github.com/JabRef/jabref/pull/3187)

### Fixed
- We fixed the translation of \textendash in the entry preview [#3307](https://github.com/JabRef/jabref/issues/3307)
- We fixed an issue where JabRef would not terminated after asking to collect anonymous statistics [#2955 comment](https://github.com/JabRef/jabref/issues/2955#issuecomment-334591123)
- We fixed an issue where JabRef would not shut down when started with the '-n' (No GUI) option.
- We fixed an issue where JabRef would not shut down when started with the '-n' (No GUI) option. [#3247](https://github.com/JabRef/jabref/issues/3247)
- We improved the way metadata is updated in remote databases. [#3235](https://github.com/JabRef/jabref/issues/3235)
- We improved font rendering of the Entry Editor for Linux based systems [#3295](https://github.com/JabRef/jabref/issues/3295)
- We fixed an issue where JabRef would freeze when trying to replace the original entry after a merge with new information from identifiers like DOI/ISBN etc. [3294](https://github.com/JabRef/jabref/issues/3294)

### Removed

Expand Down
16 changes: 9 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,26 @@ dependencies {
compile 'org.antlr:antlr4-runtime:4.7'

// VersionEye states that 6.0.5 is the most recent version, but http://dev.mysql.com/downloads/connector/j/ shows that as "Development Release"
compile 'mysql:mysql-connector-java:5.1.43'
compile 'mysql:mysql-connector-java:5.1.44'

compile 'com.impossibl.pgjdbc-ng:pgjdbc-ng:0.7.1'

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

compile 'com.google.guava:guava:23.0'
compile 'com.google.guava:guava:23.2-jre'

// JavaFX stuff
compile 'com.airhacks:afterburner.fx:1.7.0'
compile 'de.codecentric.centerdevice:javafxsvg:1.2.1'
compile 'de.jensd:fontawesomefx-materialdesignfont:1.7.22-4'
compile 'de.saxsys:mvvmfx-validation:1.6.0'
compile 'org.controlsfx:controlsfx:8.40.14'
compile 'de.saxsys:mvvmfx-validation:1.7.0'
compile 'org.fxmisc.easybind:easybind:1.0.3'
compile 'org.fxmisc.flowless:flowless:0.5.2'
compile 'org.fxmisc.richtext:richtextfx:0.7-M5'

// Cannot be updated to 9.*.* until Jabref works with Java 9
compile 'org.controlsfx:controlsfx:8.40.14'

compile 'org.jsoup:jsoup:1.10.3'
compile 'com.mashape.unirest:unirest-java:1.4.9'

Expand All @@ -122,10 +124,10 @@ dependencies {
compile 'org.citationstyles:locales:1.0.1-SNAPSHOT'
compile 'de.undercouch:citeproc-java:1.0.1'

compile 'com.github.tomtung:latex2unicode_2.12:0.2.1'
compile 'com.github.tomtung:latex2unicode_2.12:0.2.2'

compile group: 'com.microsoft.azure', name: 'applicationinsights-core', version: '1.0.+'
compile group: 'com.microsoft.azure', name: 'applicationinsights-logging-log4j2', version: '1.0.+'
compile group: 'com.microsoft.azure', name: 'applicationinsights-core', version: '1.0.9'
compile group: 'com.microsoft.azure', name: 'applicationinsights-logging-log4j2', version: '1.0.9'

testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:2.10.0'
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.2.1-bin.zip
7 changes: 7 additions & 0 deletions src/main/java/org/jabref/JabRefGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,13 @@ private void setLookAndFeel() {
LOGGER.warn("Unable to find requested look and feel", e);
}
}

// On Linux, Java FX fonts look blurry per default. This can be improved by using a non-default rendering
// setting. See https://github.com/woky/javafx-hates-linux
if (Globals.prefs.getBoolean(JabRefPreferences.FX_FONT_RENDERING_TWEAK)) {
System.setProperty("prism.text", "t2k");
System.setProperty("prism.lcdtext", "true");
}
} catch (Exception e) {
LOGGER.warn("Look and feel could not be set", e);
}
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/org/jabref/gui/BasePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -1486,11 +1486,14 @@ public void showEntry(final BibEntry bibEntry) {
* @return A suitable entry editor.
*/
public EntryEditor getEntryEditor(BibEntry entry) {
String lastTabName = "";
if (currentEditor != null) {
lastTabName = currentEditor.getVisibleTabName();
currentEditor.setEntry(entry);
return currentEditor;
} else {
EntryEditor editor = new EntryEditor(this);
editor.setEntry(entry);
return editor;
}
return new EntryEditor(frame, BasePanel.this, entry, lastTabName);
}

public EntryEditor getCurrentEditor() {
Expand Down
123 changes: 68 additions & 55 deletions src/main/java/org/jabref/gui/entryeditor/EntryEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ public class EntryEditor extends JPanel implements EntryContainer {
/**
* A reference to the entry this object works on.
*/
private final BibEntry entry;
private BibEntry entry;
/**
* The currently displayed type
*/
private final String displayedBibEntryType;
private String displayedBibEntryType;

/**
* The action concerned with closing the window.
Expand Down Expand Up @@ -157,71 +157,57 @@ public class EntryEditor extends JPanel implements EntryContainer {
* Indicates that we are about to go to the next or previous entry
*/
private final BooleanProperty movingToDifferentEntry = new SimpleBooleanProperty();
private final EntryType entryType;
private EntryType entryType;
private SourceTab sourceTab;
private final BorderLayout layout;
private TypeLabel typeLabel;

public EntryEditor(JabRefFrame frame, BasePanel panel, BibEntry entry, String lastTabName) {
this.frame = frame;
public EntryEditor(BasePanel panel) {
this.frame = panel.frame();
this.panel = panel;
this.entry = Objects.requireNonNull(entry);
entry.registerListener(this);
entryType = EntryTypes.getTypeOrDefault(entry.getType(),
this.frame.getCurrentBasePanel().getBibDatabaseContext().getMode());

displayedBibEntryType = entry.getType();

writeXmp = new WriteXMPEntryEditorAction(panel, this);

BorderLayout borderLayout = new BorderLayout();
setLayout(borderLayout);
setupToolBar();
layout = new BorderLayout();
setLayout(layout);

container = OS.LINUX ? new CustomJFXPanel() : new JFXPanel();
// Create type-label
typeLabel = new TypeLabel("");
setupToolBar();
DefaultTaskExecutor.runInJavaFXThread(() ->
container.setScene(new Scene(tabbed))
);
add(container, BorderLayout.CENTER);

container.addKeyListener(new KeyAdapter() {
DefaultTaskExecutor.runInJavaFXThread(() -> {
EasyBind.subscribe(tabbed.getSelectionModel().selectedItemProperty(), tab -> {
EntryEditorTab activeTab = (EntryEditorTab) tab;
if (activeTab != null) {
activeTab.notifyAboutFocus();
}
});
});

@Override
public void keyPressed(java.awt.event.KeyEvent e) {
setupKeyBindings();
}

public void setEntry(BibEntry entry) {
this.entry = Objects.requireNonNull(entry);
entry.registerListener(this);
entryType = EntryTypes.getTypeOrDefault(entry.getType(),
this.frame.getCurrentBasePanel().getBibDatabaseContext().getMode());

displayedBibEntryType = entry.getType();

//We need to consume this event here to prevent the propgation of keybinding events back to the JFrame
Optional<KeyBinding> keyBinding = Globals.getKeyPrefs().mapToKeyBinding(e);
if (keyBinding.isPresent()) {
switch (keyBinding.get()) {
case CUT:
case COPY:
case PASTE:
case CLOSE_ENTRY_EDITOR:
case DELETE_ENTRY:
case SELECT_ALL:
case ENTRY_EDITOR_NEXT_PANEL:
case ENTRY_EDITOR_NEXT_PANEL_2:
case ENTRY_EDITOR_PREVIOUS_PANEL:
case ENTRY_EDITOR_PREVIOUS_PANEL_2:
e.consume();
break;
default:
//do nothing
}
}
}
});
DefaultTaskExecutor.runInJavaFXThread(() -> {
addTabs(lastTabName);
addTabs(this.getVisibleTabName());

tabbed.setStyle("-fx-font-size: " + Globals.prefs.getFontSizeFX() + "pt;");

container.setScene(new Scene(tabbed));
});
add(container, BorderLayout.CENTER);

EasyBind.subscribe(tabbed.getSelectionModel().selectedItemProperty(), tab -> {
EntryEditorTab activeTab = (EntryEditorTab) tab;
if (activeTab != null) {
activeTab.notifyAboutFocus();
}
});

setupKeyBindings();
TypedBibEntry typedEntry = new TypedBibEntry(entry, panel.getBibDatabaseContext().getMode());
typeLabel.setText(typedEntry.getTypeForDisplay());
}

@Subscribe
Expand All @@ -234,7 +220,7 @@ public synchronized void listen(FieldAddedOrRemovedEvent event) {

@Subscribe
public synchronized void listen(EntryChangedEvent event) {
sourceTab.updateSourcePane();
DefaultTaskExecutor.runInJavaFXThread(() -> sourceTab.updateSourcePane());
}

private void rebuildOtherFieldsTab() {
Expand Down Expand Up @@ -288,6 +274,34 @@ private void selectLastUsedTab(String lastTabName) {
* Set-up key bindings specific for the entry editor.
*/
private void setupKeyBindings() {
container.addKeyListener(new KeyAdapter() {

@Override
public void keyPressed(java.awt.event.KeyEvent e) {

//We need to consume this event here to prevent the propgation of keybinding events back to the JFrame
Optional<KeyBinding> keyBinding = Globals.getKeyPrefs().mapToKeyBinding(e);
if (keyBinding.isPresent()) {
switch (keyBinding.get()) {
case CUT:
case COPY:
case PASTE:
case CLOSE_ENTRY_EDITOR:
case DELETE_ENTRY:
case SELECT_ALL:
case ENTRY_EDITOR_NEXT_PANEL:
case ENTRY_EDITOR_NEXT_PANEL_2:
case ENTRY_EDITOR_PREVIOUS_PANEL:
case ENTRY_EDITOR_PREVIOUS_PANEL_2:
e.consume();
break;
default:
//do nothing
}
}
}
});

tabbed.addEventFilter(KeyEvent.KEY_PRESSED, event -> {
Optional<KeyBinding> keyBinding = Globals.getKeyPrefs().mapToKeyBinding(event);
if (keyBinding.isPresent()) {
Expand Down Expand Up @@ -387,6 +401,7 @@ public BibDatabase getDatabase() {
}

private void setupToolBar() {

JPanel leftPan = new JPanel();
leftPan.setLayout(new BorderLayout());
JToolBar toolBar = new OSXCompatibleToolbar(SwingConstants.VERTICAL);
Expand Down Expand Up @@ -426,9 +441,7 @@ private void setupToolBar() {
closeBut.setMargin(new Insets(8, 0, 8, 0));
leftPan.add(closeBut, BorderLayout.NORTH);

// Create type-label
TypedBibEntry typedEntry = new TypedBibEntry(entry, panel.getBibDatabaseContext().getMode());
leftPan.add(new TypeLabel(typedEntry.getTypeForDisplay()), BorderLayout.CENTER);
leftPan.add(typeLabel, BorderLayout.CENTER);
TypeButton typeButton = new TypeButton();

toolBar.add(typeButton);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,16 @@ public FileAnnotationViewModel(FileAnnotation annotation) {

private void setupContentProperties(FileAnnotation annotation) {
if (annotation.hasLinkedAnnotation()) {
this.content.set(toNAifEmpty(annotation.getLinkedFileAnnotation().getContent()));
this.content.set(annotation.getLinkedFileAnnotation().getContent());
String annotationContent = annotation.getContent();
String illegibleTextMessage = Localization.lang("The marked area does not contain any legible text!");
this.marking.set(annotationContent.isEmpty() ? illegibleTextMessage : annotationContent);
} else {
this.content.set(toNAifEmpty(annotation.getContent()));
this.marking.set("N/A");
this.content.set(annotation.getContent());
this.marking.set("");
}
}

private static String toNAifEmpty(String content) {
if (content.isEmpty()) {
return "N/A";
}
return content;
}

public String getAuthor() {
return author.get();
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/jabref/gui/importer/ImportFileFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ public static FileChooser.ExtensionFilter convert(Importer format) {
public static FileChooser.ExtensionFilter convert(String description, Collection<Importer> formats) {
List<FileExtensions> extensions = formats.stream().map(Importer::getExtensions).collect(Collectors.toList());
List<String> flatExtensions = extensions.stream().flatMap(extList -> Arrays.stream(extList.getExtensions()))
.map(ending -> "*." + ending)
.collect(Collectors.toList());

return new FileChooser.ExtensionFilter(description, flatExtensions.toArray(new String[flatExtensions.size()]));
}

Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/jabref/gui/importer/ImportFormats.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public void actionPerformed(ActionEvent e) {
DialogService ds = new FXDialogService();

FileChooser fs = ds.getConfiguredFileChooser(fileDialogConfiguration);
fs.getExtensionFilters().add(0, allImports);
fs.setSelectedExtensionFilter(allImports);
File f = DefaultTaskExecutor
.runInJavaFXThread(() -> fs.showOpenDialog(null));
Expand Down
Loading

0 comments on commit 95474ea

Please sign in to comment.