-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feature: Support Citation Style Language (CSL) Styles in LibreOffice/OpenOffice #1
base: csl-lo-oo-integration
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
It is required that there should be at least one commit to create a PR, that's why we create this file. | ||
All development will be done in `csl-lo-oo-integration-dev`, and we will merge all the intermediate commit to branch `csl-lo-oo-integration` and open PR with it to upstream. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package org.jabref.gui.openoffice; | ||
|
||
import javafx.beans.property.SimpleStringProperty; | ||
import javafx.beans.property.StringProperty; | ||
import org.jabref.logic.citationstyle.CitationStyle; | ||
import org.jabref.logic.openoffice.style.OOBibStyle; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [reviewdog] <com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck> reported by reviewdog 🐶 |
||
|
||
public class StyleSelectCslItemViewModel { | ||
|
||
private final StringProperty title = new SimpleStringProperty(""); | ||
private final StringProperty file = new SimpleStringProperty(""); | ||
private final StringProperty source = new SimpleStringProperty(""); | ||
|
||
private final CitationStyle style; | ||
|
||
public StyleSelectCslItemViewModel(CitationStyle style) { | ||
this.title.setValue(style.getTitle()); | ||
this.file.setValue(style.getFilePath()); | ||
this.source.setValue(style.getSource()); | ||
this.style = style; | ||
} | ||
|
||
public StringProperty titleProperty() { | ||
return title; | ||
} | ||
|
||
public StringProperty fileProperty() { | ||
return file; | ||
} | ||
|
||
public StringProperty sourceProperty() { | ||
return source; | ||
} | ||
|
||
public CitationStyle getStyle() { | ||
return style; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
import javax.inject.Inject; | ||
|
||
import javafx.collections.FXCollections; | ||
import javafx.fxml.FXML; | ||
import javafx.scene.control.Button; | ||
import javafx.scene.control.ButtonType; | ||
|
@@ -19,6 +20,7 @@ | |
import org.jabref.gui.util.BaseDialog; | ||
import org.jabref.gui.util.ValueTableCellFactory; | ||
import org.jabref.gui.util.ViewModelTableRowFactory; | ||
import org.jabref.logic.citationstyle.CitationStyle; | ||
import org.jabref.logic.l10n.Localization; | ||
import org.jabref.logic.layout.TextBasedPreviewLayout; | ||
import org.jabref.logic.openoffice.style.OOBibStyle; | ||
|
@@ -31,6 +33,8 @@ | |
import com.airhacks.afterburner.views.ViewLoader; | ||
import com.tobiasdiez.easybind.EasyBind; | ||
|
||
import java.util.stream.Collectors; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [reviewdog] <com.puppycrawl.tools.checkstyle.checks.imports.ImportOrderCheck> reported by reviewdog 🐶 |
||
|
||
public class StyleSelectDialogView extends BaseDialog<OOBibStyle> { | ||
|
||
private final MenuItem edit = new MenuItem(Localization.lang("Edit")); | ||
|
@@ -43,6 +47,9 @@ public class StyleSelectDialogView extends BaseDialog<OOBibStyle> { | |
@FXML private TableColumn<StyleSelectItemViewModel, String> colFile; | ||
@FXML private TableColumn<StyleSelectItemViewModel, Boolean> colDeleteIcon; | ||
@FXML private Button add; | ||
@FXML private TableView<StyleSelectCslItemViewModel> cslStyles; | ||
@FXML private TableColumn<StyleSelectCslItemViewModel, String> colCslTitle; | ||
@FXML private TableColumn<StyleSelectCslItemViewModel, String> colCslFile; | ||
@FXML private VBox vbox; | ||
|
||
@Inject private PreferencesService preferencesService; | ||
|
@@ -88,6 +95,9 @@ private void initialize() { | |
colFile.setCellValueFactory(cellData -> cellData.getValue().fileProperty()); | ||
colDeleteIcon.setCellValueFactory(cellData -> cellData.getValue().internalStyleProperty()); | ||
|
||
colCslTitle.setCellValueFactory(cellData -> cellData.getValue().titleProperty()); | ||
colCslFile.setCellValueFactory(cellData -> cellData.getValue().fileProperty()); | ||
|
||
new ValueTableCellFactory<StyleSelectItemViewModel, Boolean>() | ||
.withGraphic(internalStyle -> { | ||
if (!internalStyle) { | ||
|
@@ -127,6 +137,21 @@ private void initialize() { | |
previewArticle.setLayout(new TextBasedPreviewLayout(style.getStyle().getReferenceFormat(StandardEntryType.Article))); | ||
previewBook.setLayout(new TextBasedPreviewLayout(style.getStyle().getReferenceFormat(StandardEntryType.Book))); | ||
}); | ||
|
||
cslStyles.setItems( | ||
CitationStyle.discoverCitationStyles() | ||
.stream() | ||
.map(StyleSelectCslItemViewModel::new) | ||
.collect(Collectors.toCollection(FXCollections::observableArrayList)) | ||
); | ||
|
||
new ViewModelTableRowFactory<StyleSelectCslItemViewModel>() | ||
.withOnMouseClickedEvent((item, event) -> { | ||
if (event.getClickCount() == 2) { | ||
viewModel.viewCslStyle(item); | ||
} | ||
}) | ||
.install(cslStyles); | ||
} | ||
|
||
private ContextMenu createContextMenu() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [reviewdog] <com.puppycrawl.tools.checkstyle.checks.imports.ImportOrderCheck> reported by reviewdog 🐶
'org.jabref.logic.citationstyle.CitationStyle' should be separated from previous imports.