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

Convert entry preview panel to JavaFX #3574

Merged
merged 6 commits into from
Dec 28, 2017
Merged
Changes from 1 commit
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
Prev Previous commit
Fix tests
  • Loading branch information
tobiasdiez committed Dec 28, 2017
commit 44fe17ff9af13895cf713384a393616ff24eba8d
11 changes: 7 additions & 4 deletions src/main/java/org/jabref/logic/citationstyle/CSLAdapter.java
Original file line number Diff line number Diff line change
@@ -5,11 +5,10 @@
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.Optional;

import org.jabref.logic.formatter.bibtexfields.RemoveNewlinesFormatter;
import org.jabref.logic.layout.format.HTMLChars;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.util.OptionalUtil;

import de.undercouch.citeproc.CSL;
import de.undercouch.citeproc.ItemDataProvider;
@@ -90,8 +89,10 @@ private static CSLItemData bibEntryToCSLItemData(BibEntry bibEntry) {

// Not every field is already generated into latex free fields
HTMLChars latexToHtmlConverter = new HTMLChars();
RemoveNewlinesFormatter removeNewlinesFormatter = new RemoveNewlinesFormatter();
for (String key : bibEntry.getFieldMap().keySet()) {
bibEntry.getField(key)
.map(removeNewlinesFormatter::format)
.map(latexToHtmlConverter::format)
.ifPresent(value -> bibTeXEntry.addField(new Key(key), new DigitStringValue(value)));
}
@@ -106,14 +107,16 @@ public void setData(List<BibEntry> data) {
@Override
public CSLItemData retrieveItem(String id) {
return data.stream()
.filter(entry -> entry.getCiteKeyOptional().equals(Optional.of(id)))
.filter(entry -> entry.getCiteKeyOptional().orElse("").equals(id))
.map(JabRefItemDataProvider::bibEntryToCSLItemData)
.findFirst().orElse(null);
}

@Override
public String[] getIds() {
return data.stream().flatMap(entry -> OptionalUtil.toStream(entry.getCiteKeyOptional())).toArray(String[]::new);
return data.stream()
.map(entry -> entry.getCiteKeyOptional().orElse(""))
.toArray(String[]::new);
}
}
}
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ protected static String generateCitation(BibEntry entry, String style) {
* @implNote the citation is generated using JavaScript which may take some time, better call it from outside the main Thread
*/
protected static String generateCitation(BibEntry entry, String style, CitationStyleOutputFormat outputFormat) {
return generateCitations(Collections.singletonList(entry), style, outputFormat).get(0);
return generateCitations(Collections.singletonList(entry), style, outputFormat).stream().findFirst().orElse("");
}

/**
1 change: 0 additions & 1 deletion src/main/resources/l10n/JabRef_da.properties
Original file line number Diff line number Diff line change
@@ -818,7 +818,6 @@ Opening=Åbner
Opening\ preferences...=Åbner indstillinger...

Operation\ canceled.=Operationen afbrudt.
Operation\ not\ supported=Operation ikke understøttet

Optional\ fields=Valgfri felter

1 change: 0 additions & 1 deletion src/main/resources/l10n/JabRef_de.properties
Original file line number Diff line number Diff line change
@@ -851,7 +851,6 @@ Opening=Öffne
Opening\ preferences...=Öffne Voreinstellungen...

Operation\ canceled.=Vorgang abgebrochen.
Operation\ not\ supported=Vorgang nicht unterstützt

Optional\ fields=Optionale Felder

1 change: 0 additions & 1 deletion src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
@@ -850,7 +850,6 @@ Opening=Opening
Opening\ preferences...=Opening preferences...

Operation\ canceled.=Operation canceled.
Operation\ not\ supported=Operation not supported

Optional\ fields=Optional fields

1 change: 0 additions & 1 deletion src/main/resources/l10n/JabRef_es.properties
Original file line number Diff line number Diff line change
@@ -842,7 +842,6 @@ Opening=Abriendo
Opening\ preferences...=Preferencias de apertura

Operation\ canceled.=Operación cancelada.
Operation\ not\ supported=Operación no soportada

Optional\ fields=Campos opcionales

1 change: 0 additions & 1 deletion src/main/resources/l10n/JabRef_fr.properties
Original file line number Diff line number Diff line change
@@ -851,7 +851,6 @@ Opening=Ouverture en cours
Opening\ preferences...=Ouverture des préférences en cours...

Operation\ canceled.=Opération annulée.
Operation\ not\ supported=Opération non supportée

Optional\ fields=Champs optionnels

1 change: 0 additions & 1 deletion src/main/resources/l10n/JabRef_in.properties
Original file line number Diff line number Diff line change
@@ -851,7 +851,6 @@ Opening=Membuka
Opening\ preferences...=Membuka preferensi...

Operation\ canceled.=Operasi dibatalkan.
Operation\ not\ supported=Operasi tidak didukung

Optional\ fields=Bidang tambahan

1 change: 0 additions & 1 deletion src/main/resources/l10n/JabRef_it.properties
Original file line number Diff line number Diff line change
@@ -846,7 +846,6 @@ Opening=Apertura in corso
Opening\ preferences...=Apertura delle preferenze in corso...

Operation\ canceled.=Operazione annullata.
Operation\ not\ supported=Operazione non supportata

Optional\ fields=Campi opzionali

1 change: 0 additions & 1 deletion src/main/resources/l10n/JabRef_ja.properties
Original file line number Diff line number Diff line change
@@ -851,7 +851,6 @@ Opening=開いています
Opening\ preferences...=設定を開いています...

Operation\ canceled.=操作は取り消されました.
Operation\ not\ supported=操作がサポートされていません

Optional\ fields=非必須フィールド

1 change: 0 additions & 1 deletion src/main/resources/l10n/JabRef_no.properties
Original file line number Diff line number Diff line change
@@ -817,7 +817,6 @@ Opening=Åpner
Opening\ preferences...=Åpner innstillinger...

Operation\ canceled.=Operasjonen avbrutt.
Operation\ not\ supported=Operasjonen er ikke støttet

Optional\ fields=Valgfrie felter

1 change: 0 additions & 1 deletion src/main/resources/l10n/JabRef_pt_BR.properties
Original file line number Diff line number Diff line change
@@ -826,7 +826,6 @@ Opening=Abrindo
Opening\ preferences...=Abrindo preferências

Operation\ canceled.=Operação cancelada.
Operation\ not\ supported=Operação não suportada

Optional\ fields=Campos opcionais

1 change: 0 additions & 1 deletion src/main/resources/l10n/JabRef_ru.properties
Original file line number Diff line number Diff line change
@@ -832,7 +832,6 @@ Opening=Выполняется открытие
Opening\ preferences...=Выполняется загрузка пользовательских настроек...

Operation\ canceled.=Операция отменена.
Operation\ not\ supported=Операция не поддерживается

Optional\ fields=Дополнительные поля

1 change: 0 additions & 1 deletion src/main/resources/l10n/JabRef_sv.properties
Original file line number Diff line number Diff line change
@@ -798,7 +798,6 @@ Opening=Öppnar
Opening\ preferences...=Öppnar inställningar...

Operation\ canceled.=Operationen avbruten.
Operation\ not\ supported=Operationen stöds ej

Optional\ fields=Valfria fält

1 change: 0 additions & 1 deletion src/main/resources/l10n/JabRef_tr.properties
Original file line number Diff line number Diff line change
@@ -850,7 +850,6 @@ Opening=Açılıyor
Opening\ preferences...=Tercihler açılıyor...

Operation\ canceled.=İşlem iptal edildi.
Operation\ not\ supported=İşlem desteklenmiyor

Optional\ fields=Tercihe bağlı alanlar

1 change: 0 additions & 1 deletion src/main/resources/l10n/JabRef_vi.properties
Original file line number Diff line number Diff line change
@@ -831,7 +831,6 @@ Opening=Đang mỏ
Opening\ preferences...=Đang mở các tùy thích...

Operation\ canceled.=Lệnh bị hủy.
Operation\ not\ supported=Lệnh không được hỗ trợ

Optional\ fields=Các dữ liệu tùy chọn

1 change: 0 additions & 1 deletion src/main/resources/l10n/JabRef_zh.properties
Original file line number Diff line number Diff line change
@@ -842,7 +842,6 @@ Opening=正在打开
Opening\ preferences...=正在打开首选项...

Operation\ canceled.=操作被取消
Operation\ not\ supported=不支持的操作

Optional\ fields=可选域