Skip to content

Commit

Permalink
Merge pull request #3 from JabRef/master
Browse files Browse the repository at this point in the history
update
  • Loading branch information
WangAooa committed May 31, 2020
2 parents d47c90d + bbe3056 commit 2a90c01
Show file tree
Hide file tree
Showing 52 changed files with 2,212 additions and 1,401 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Run checkstyle
run: ./gradlew checkstyleMain checkstyleTest checkstyleJmh
- name: Run markdown-lint
uses: koppor/markdown-lint@master
uses: avto-dev/markdown-lint@v1
with:
args: CHANGELOG.md README.md docs/
config: '.markdownlint.yml'
Expand Down
2 changes: 2 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,5 @@ Gennadiy Stakhovskiy <GennadiyStakhovskiy@gmail.com>
Mootez Saad <34676841+MootezSaaD@users.noreply.github.com>
Mootez Saad <34676841+MootezSaaD@users.noreply.github.com> <mootez.saad@medtech.tn>
Chen Yuheng <pass@chenyuheng.cn>
Dominik Voigt <43381984+DominikVoigt@users.noreply.github.com>
Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com> <cc.snethlage@gmail.com>
4 changes: 4 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Andreas Buhr
Andreas Rudert
Andrew Collins
Andrew Levit
André Schlichting
Andrés Sánchez
Anh Nghia Tran
Anita Armbruster
Expand All @@ -40,6 +41,7 @@ August Janse
Ayachi Nene
Bartosz J. Kaczkowski
Bartłomiej Dach
Baruch Oltman
Behrouz Javanmardi
Benedikt Tutzer
Benjamin Köhler
Expand Down Expand Up @@ -96,6 +98,7 @@ Dimitra Karadima
Domenico Cufalo
Dominik Schrempf
Dominik Traczyk
Dominik Voigt
Dominik Waßenhoven
Douglas Nassif Roma Junior
Eduard Braun
Expand Down Expand Up @@ -260,6 +263,7 @@ Nick S. Weatherley
Nico Schlömer
Nicolas Pavillon
Nikita Borovikov
Niklas Schmitt
nikmilpv
NikodemKch
Niv Ierushalmi
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We improved the error message for invalid jstyles. [#6303](https://github.com/JabRef/jabref/issues/6303)
- We changed the section name of 'Advanced' to 'Network' in the preferences and removed some obsolete options.[#6489](https://github.com/JabRef/jabref/pull/6489)
- We improved the context menu of the column "Linked identifiers" of the main table, by truncating their texts, if they are too long. [#6499](https://github.com/JabRef/jabref/issues/6499)
- We merged the main table tabs in the preferences dialog. [#6518](https://github.com/JabRef/jabref/pull/6518)

### Fixed

- We fixed to only search file links in the BIB file location directory when preferences has corresponding checkbox checked. [#5891](https://github.com/JabRef/jabref/issues/5891)
- We fixed wrong button order (Apply and Cancel) in ManageProtectedTermsDialog.
- We fixed an issue with incompatible characters at BibTeX key [#6257](https://github.com/JabRef/jabref/issues/6257)
- We fixed an issue where dash (`-`) was reported as illegal BibTeX key [#6295](https://github.com/JabRef/jabref/issues/6295)
Expand Down Expand Up @@ -75,6 +77,9 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We fixed an issue where brackets in regular expressions were not working. [6469](https://github.com/JabRef/jabref/pull/6469)
- We fixed an issue where LaTeX citations for specific commands (\autocites) of biblatex-mla were not recognized. [#6476](https://github.com/JabRef/jabref/issues/6476)
- We fixed an issue where drag and drop was not working on empty database. [#6487](https://github.com/JabRef/jabref/issues/6487)
- We fixed an issue where the name fields were not updated after the preferences changed. [#6515](https://github.com/JabRef/jabref/issues/6515)
- We fixed an issue where "null" appeared in generated BibTeX keys. [#6459](https://github.com/JabRef/jabref/issues/6459)
- We fixed an issue where the authors' names were incorrectly displayed in the authors' column when they were bracketed. [#6465](https://github.com/JabRef/jabref/issues/6465) [#6459](https://github.com/JabRef/jabref/issues/6459)

### Removed

Expand Down
18 changes: 6 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
JabRef is an open-source, cross-platform citation and reference management tool.

Stay on top of your literature: JabRef helps you to collect and organize sources, find the paper you need and discover the latest research.
![main table](https://www.jabref.org/img/jabref-5-0-maintable.png)
![main table](http://www.jabref.org/img/jabref-mainscreen.png)

## Features

JabRef is a cross-platform application that works on Windows, Linux and Mac OS X. It is available free of charge and is actively developed.
JabRef supports you in every step of your research work.
JabRef is available free of charge and is actively developed.
It supports you in every step of your research work.

### Collect

Expand All @@ -33,7 +33,7 @@ JabRef supports you in every step of your research work.

### Cite

- Native [BibTeX] and [Biblatex] support
- Native BibTeX and Biblatex support
- Cite-as-you-write functionality for external applications such as Emacs, Kile, LyX, Texmaker, TeXstudio, Vim and WinEdt.
- Format references in one of the many thousand built-in citation styles or create your style
- Support for Word and LibreOffice/OpenOffice for inserting and formatting citations
Expand All @@ -47,11 +47,9 @@ JabRef supports you in every step of your research work.
## Installation

Fresh development builds are available at [builds.jabref.org](https://builds.jabref.org/master/).
The [latest stable release is available at FossHub](https://www.fosshub.com/JabRef.html).
The [latest stable release is available at FossHub](https://downloads.jabref.org/).

- Windows: JabRef offers an installer, which also adds a shortcut to JabRef to your start menu. Please also see our [Windows FAQ](https://docs.jabref.org/faq/faqwindows)
- Linux: Please see our [Installation Guide](https://docs.jabref.org/general/installation).
- Mac OS X: Please see our [Mac OS X FAQ](https://docs.jabref.org/faq/faqosx).
Please see our [Installation Guide](https://docs.jabref.org/installation).

## Bug Reports, Suggestions, Other Feedback

Expand Down Expand Up @@ -98,8 +96,4 @@ For IntelliJ IDEA, just import the project via a Gradle Import by pointing at th

`gradlew test` executes all tests. We use [Github Actions](https://github.com/JabRef/jabref/actions) for executing the tests after each commit. For developing, it is sufficient to locally only run the associated test for the classes you changed. Github will report any other failure.

[BibTeX]: https://www.ctan.org/pkg/bibtex
[Biblatex]: https://www.ctan.org/pkg/biblatex
[install4j]: https://www.ej-technologies.com/products/install4j/overview.html
[JabRef]: https://www.jabref.org
[JavaFX]: https://en.wikipedia.org/wiki/JavaFX
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ dependencies {
implementation group: 'org.apache.tika', name: 'tika-core', version: '1.24.1'

// required for reading write-protected PDFs - see https://github.com/JabRef/jabref/pull/942#issuecomment-209252635
implementation 'org.bouncycastle:bcprov-jdk15on:1.65'
implementation 'org.bouncycastle:bcprov-jdk15on:1.65.01'

implementation 'commons-cli:commons-cli:1.4'

Expand Down Expand Up @@ -192,9 +192,9 @@ dependencies {
exclude module: "log4j-core"
}

implementation 'com.vladsch.flexmark:flexmark:0.61.32'
implementation 'com.vladsch.flexmark:flexmark-ext-gfm-strikethrough:0.61.32'
implementation 'com.vladsch.flexmark:flexmark-ext-gfm-tasklist:0.61.32'
implementation 'com.vladsch.flexmark:flexmark:0.62.0'
implementation 'com.vladsch.flexmark:flexmark-ext-gfm-strikethrough:0.62.0'
implementation 'com.vladsch.flexmark:flexmark-ext-gfm-tasklist:0.62.0'

testImplementation 'io.github.classgraph:classgraph:4.8.78'
testImplementation 'org.junit.jupiter:junit-jupiter:5.6.2'
Expand Down
26 changes: 11 additions & 15 deletions docs/teaching.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# JabRef as Basis for Teaching Material

JabRef can be used as a training object for software engineering.
With JabRef students can level-up their coding and GitHub skills.
When taking part in JabRef development, one will learn modern Java coding practices, how code reviews work and how to properly address reviewing feedback.

As an instructor, please follow this checklist:
JabRef tries to achieve high code quality. This ultimately leads to improved software engineering knowledge of contributors. After contributing for JabRef, both coding and general software engienering skills will have increased. Our [development strategy](development-strategy.md) provides more details.

We recommend to start early and constantly, since students wirking earlier and more often, produce projects that are more correct, completed earlier at the same overall invested time <sup id="a1">[1](#Ayaankazerouni)</sup>.

## Notes for instructors

1. Be aware that JabRef is run by volunteers. This implies that the development team cannot ensure to provide feedback on code within hours.
2. Be aware that from the first pull request to the final acceptance the typical time needed is two weeks.
Expand All @@ -17,7 +22,7 @@ For a near-to-perfect preparation and effect of the course, we ask you to get in

It is also possible to just direct students to our [Contribution Guide](https://github.com/JabRef/jabref/blob/master/CONTRIBUTING.md#contributing-guide). The learning effect may be lower as the time of the students has to be spent to a) learn about JabRef and b) select an appropriate issue.

Since a huge fraction of software costs is spend on [software maintenance](https://en.wikipedia.org/wiki/Software_maintenance), adding new features also educates in that aspect: perfective maintenance<sup id="a1">[1](#LientzSwanson)</sup> is trained. When fixing bugs, corrective maintenance<sup>[1](#LientzSwanson)</sup> is trained.
Since a huge fraction of software costs is spend on [software maintenance](https://en.wikipedia.org/wiki/Software_maintenance), adding new features also educates in that aspect: perfective maintenance<sup id="a1"><a href="#LientzSwanson">1</a></sup> is trained. When fixing bugs, corrective maintenance<sup>[2](#LientzSwanson)</sup> is trained.

## Process for contributions

Expand All @@ -41,7 +46,7 @@ GitHub describes that in their page [Unterstanding the GitHub flow](https://guid

## Process for Java newcomers

Newcomers are invited to follow the process described above.
Newcomers contributing in the context of a university teaching experience are invited to follow the process described above.
In case the capacity of the instructing university allows, we propose a three-step approach.
First, the contributors prepare their contribution as usual.
Then, they submit the pull request *to a separate repository*.
Expand Down Expand Up @@ -120,18 +125,9 @@ Course [Open Source Software](https://github.com/igorsteinmacher/DSL-UTFPR)
- Summary: Students are requested to contribute to an Open Source project to learn about the maintenance and evolution of software projects. This project is the predecessor of NAU's CS499.
- Course offered from 2013 to 2016 with different names

## Interesting Read for Students and Advisors

- [Developing Procrastination Feedback for Student Software Developers](https://medium.com/@ayaankazerouni/developing-procrastination-feedback-for-student-software-developers-1652de60db7f) by [@ayaankazerouni](https://github.com/ayaankazerouni?tab=overview&from=2015-12-01&to=2015-12-31)

> When students worked earlier and more often, they produced projects that:
>
> - were more correct,
> - were completed earlier,
> - took no more or less time to complete
## References

<a id="LientzSwanson" href="#a1">1</a>: Lientz B., Swanson E., 1980: Software Maintenance Management. Addison Wesley, Reading, MA.
<a id="Ayaankazerouni" href="#a1">1</a>: [@ayaankazerouni](https://github.com/ayaankazerouni): [Developing Procrastination Feedback for Student Software Developers](https://medium.com/@ayaankazerouni/developing-procrastination-feedback-for-student-software-developers-1652de60db7f)
<a id="LientzSwanson" href="#a2">2</a>: Lientz B., Swanson E., 1980: Software Maintenance Management. Addison Wesley, Reading, MA.

<!-- markdownlint-disable-file MD033 -->
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/BasePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public BasePanel(JabRefFrame frame, BasePanelPreferences preferences, BibDatabas
bibDatabaseContext.getMetaData().registerListener(this);

this.sidePaneManager = frame.getSidePaneManager();
this.tableModel = new MainTableDataModel(getBibDatabaseContext());
this.tableModel = new MainTableDataModel(getBibDatabaseContext(), Globals.prefs, Globals.stateManager);

citationStyleCache = new CitationStyleCache(bibDatabaseContext);
annotationCache = new FileAnnotationCache(bibDatabaseContext, Globals.prefs.getFilePreferences());
Expand Down
46 changes: 25 additions & 21 deletions src/main/java/org/jabref/gui/maintable/BibEntryTableViewModel.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package org.jabref.gui.maintable;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;

import javafx.beans.Observable;
import javafx.beans.binding.Bindings;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.value.ObservableValue;
Expand All @@ -32,14 +34,14 @@
public class BibEntryTableViewModel {
private final BibEntry entry;
private final BibDatabase database;
private final MainTableNameFormatter nameFormatter;
private final ObservableValue<MainTableNameFormatter> nameFormatter;
private final Map<OrFields, ObservableValue<String>> fieldValues = new HashMap<>();
private final Map<SpecialField, OptionalBinding<SpecialFieldValueViewModel>> specialFieldValues = new HashMap<>();
private final EasyBinding<List<LinkedFile>> linkedFiles;
private final EasyBinding<Map<Field, String>> linkedIdentifiers;
private final ObservableValue<List<AbstractGroup>> matchedGroups;

public BibEntryTableViewModel(BibEntry entry, BibDatabaseContext database, MainTableNameFormatter nameFormatter) {
public BibEntryTableViewModel(BibEntry entry, BibDatabaseContext database, ObservableValue<MainTableNameFormatter> nameFormatter) {
this.entry = entry;
this.database = database.getDatabase();
this.nameFormatter = nameFormatter;
Expand Down Expand Up @@ -115,28 +117,30 @@ public ObservableValue<String> getFields(OrFields fields) {
ObservableValue<String> value = fieldValues.get(fields);
if (value != null) {
return value;
} else {
value = Bindings.createStringBinding(() -> {
boolean isName = false;
}

Optional<String> content = Optional.empty();
for (Field field : fields) {
content = entry.getResolvedFieldOrAliasLatexFree(field, database);
if (content.isPresent()) {
isName = field.getProperties().contains(FieldProperty.PERSON_NAMES);
break;
}
}
ArrayList<Observable> observables = new ArrayList<>(List.of(entry.getObservables()));
observables.add(nameFormatter);

value = Bindings.createStringBinding(() -> {
for (Field field : fields) {
if (field.getProperties().contains(FieldProperty.PERSON_NAMES)) {
Optional<String> name = entry.getResolvedFieldOrAlias(field, database);

String result = content.orElse(null);
if (isName) {
return nameFormatter.formatName(result);
if (name.isPresent()) {
return nameFormatter.getValue().formatNameLatexFree(name.get());
}
} else {
return result;
Optional<String> content = entry.getResolvedFieldOrAliasLatexFree(field, database);

if (content.isPresent()) {
return content.get();
}
}
}, entry.getObservables());
fieldValues.put(fields, value);
return value;
}
}
return "";
}, observables.toArray(Observable[]::new));
fieldValues.put(fields, value);
return value;
}
}
24 changes: 17 additions & 7 deletions src/main/java/org/jabref/gui/maintable/MainTableDataModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@

import javafx.beans.binding.Bindings;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.ObservableList;
import javafx.collections.transformation.FilteredList;
import javafx.collections.transformation.SortedList;

import org.jabref.Globals;
import org.jabref.gui.StateManager;
import org.jabref.gui.groups.GroupViewMode;
import org.jabref.gui.util.BindingsHelper;
import org.jabref.logic.search.SearchQuery;
Expand All @@ -19,31 +21,35 @@
import org.jabref.model.groups.GroupTreeNode;
import org.jabref.model.search.matchers.MatcherSet;
import org.jabref.model.search.matchers.MatcherSets;
import org.jabref.preferences.PreferencesService;

import com.tobiasdiez.easybind.EasyBind;

public class MainTableDataModel {
private final FilteredList<BibEntryTableViewModel> entriesFiltered;
private final SortedList<BibEntryTableViewModel> entriesSorted;
private final GroupViewMode groupViewMode;
private final ObjectProperty<MainTableNameFormatter> nameFormatter;
private final PreferencesService preferencesService;

public MainTableDataModel(BibDatabaseContext context) {
ObservableList<BibEntry> allEntries = BindingsHelper.forUI(context.getDatabase().getEntries());
public MainTableDataModel(BibDatabaseContext context, PreferencesService preferencesService, StateManager stateManager) {
this.nameFormatter = new SimpleObjectProperty<>(new MainTableNameFormatter(preferencesService));
this.preferencesService = preferencesService;

MainTableNameFormatter nameFormatter = new MainTableNameFormatter(Globals.prefs);
ObservableList<BibEntry> allEntries = BindingsHelper.forUI(context.getDatabase().getEntries());
ObservableList<BibEntryTableViewModel> entriesViewModel = EasyBind.mapBacked(allEntries, entry -> new BibEntryTableViewModel(entry, context, nameFormatter));

entriesFiltered = new FilteredList<>(entriesViewModel);
entriesFiltered.predicateProperty().bind(
EasyBind.combine(Globals.stateManager.activeGroupProperty(), Globals.stateManager.activeSearchQueryProperty(), (groups, query) -> entry -> isMatched(groups, query, entry))
EasyBind.combine(stateManager.activeGroupProperty(), stateManager.activeSearchQueryProperty(), (groups, query) -> entry -> isMatched(groups, query, entry))
);

IntegerProperty resultSize = new SimpleIntegerProperty();
resultSize.bind(Bindings.size(entriesFiltered));
Globals.stateManager.setActiveSearchResultSize(context, resultSize);
stateManager.setActiveSearchResultSize(context, resultSize);
// We need to wrap the list since otherwise sorting in the table does not work
entriesSorted = new SortedList<>(entriesFiltered);
groupViewMode = Globals.prefs.getGroupViewMode();
groupViewMode = preferencesService.getGroupViewMode();
}

private boolean isMatched(ObservableList<GroupTreeNode> groups, Optional<SearchQuery> query, BibEntryTableViewModel entry) {
Expand Down Expand Up @@ -78,4 +84,8 @@ private Optional<MatcherSet> createGroupMatcher(List<GroupTreeNode> selectedGrou
public SortedList<BibEntryTableViewModel> getEntriesFilteredAndSorted() {
return entriesSorted;
}

public void refresh() {
this.nameFormatter.setValue(new MainTableNameFormatter(preferencesService));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.jabref.gui.maintable;

public class MainTableNameFormatPreferences {

public enum DisplayStyle {
NATBIB, AS_IS, FIRSTNAME_LASTNAME, LASTNAME_FIRSTNAME
}

public enum AbbreviationStyle {
NONE, LASTNAME_ONLY, FULL
}

private final DisplayStyle displayStyle;
private final AbbreviationStyle abbreviationStyle;

public MainTableNameFormatPreferences(DisplayStyle displayStyle,
AbbreviationStyle abbreviationStyle) {

this.displayStyle = displayStyle;
this.abbreviationStyle = abbreviationStyle;
}

public DisplayStyle getDisplayStyle() {
return displayStyle;
}

public AbbreviationStyle getAbbreviationStyle() {
return abbreviationStyle;
}
}
Loading

0 comments on commit 2a90c01

Please sign in to comment.