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

Fix 11102 by allowing users to add local bst files to preview layout list #11234

Merged
merged 31 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
070e687
Update PreviewTab.fxml
sahilsekr42 Apr 21, 2024
dbfc138
Update PreviewTab.java
sahilsekr42 Apr 21, 2024
293b777
Update PreviewTabViewModel.java
sahilsekr42 Apr 21, 2024
a46bee8
fix undeclared variable
sahilsekr42 Apr 21, 2024
0126f39
Update CHANGELOG.md for committed changes for issue 11102
sahilsekr42 Apr 21, 2024
5a5be03
Update CHANGELOG.md for fixing markdown spacing error
sahilsekr42 Apr 21, 2024
589eb1c
build.gradle openrewrite
sahilsekr42 Apr 21, 2024
cdabc1f
fix gradle errors
sahilsekr42 Apr 21, 2024
a54ecc2
Update PreviewTabViewModel.java for bstlayout getsource() case handling
sahilsekr42 Apr 22, 2024
d782e04
fix import errors
sahilsekr42 Apr 22, 2024
212f7ef
better architecture
Siedlerchr Apr 22, 2024
2a4db3b
test ieeetran with test entry
Siedlerchr Apr 22, 2024
1412d89
fix
Siedlerchr Apr 22, 2024
41d357d
Fix path to IEEEtran.bst
koppor Apr 25, 2024
730fbc7
Streamline conversion to BstEntry
koppor Apr 25, 2024
7a131e7
refactor file chooser
Siedlerchr Apr 25, 2024
8b04f6f
checkstyle
Siedlerchr Apr 25, 2024
04969c3
Somre more traces
koppor Apr 25, 2024
e82de74
Merge branch 'fix-11102' of https://github.com/sahilsekr42/jabref int…
koppor Apr 25, 2024
995856d
Add ''
koppor Apr 25, 2024
d1499b0
Merge branch 'main' into fix-11102
koppor May 19, 2024
efb9e19
checkstyle
Siedlerchr May 19, 2024
773faa4
checkstyle
Siedlerchr May 19, 2024
b1ece3b
Merge remote-tracking branch 'upstream/main' into fix-11102
Siedlerchr May 20, 2024
1a0a23a
move button up
Siedlerchr May 20, 2024
83b4cbb
Fix storing of style in Preferences
Siedlerchr May 20, 2024
380aa6b
wording of changelog
Siedlerchr May 20, 2024
a3aaf3f
cehckstyle
Siedlerchr May 20, 2024
574c87d
checkstyle
Siedlerchr May 20, 2024
57aa305
fix line break
Siedlerchr May 20, 2024
225dab0
damn style
Siedlerchr May 20, 2024
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- We added tooltip on main table cells that shows cell content or cell content and entry preview if set in preferences. [10925](https://github.com/JabRef/jabref/issues/10925)
- We added the ability to add a keyword/crossref when typing the separator character (e.g., comma) in the keywords/crossref fields. [#11178](https://github.com/JabRef/jabref/issues/11178)
- We added an exporter and improved the importer for Endnote XML format. [#11137](https://github.com/JabRef/jabref/issues/11137)
- We added a button in gui to give users an easy option to select and add local bst files to available styles in preview layout list. [#11102](https://github.com/JabRef/jabref/issues/11102)

### Changed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<CheckBox fx:id="showAsTabCheckBox" text="%Show preview as a tab in entry editor"/>
<CheckBox fx:id="showPreviewTooltipCheckBox" text="Show preview in entry table tooltip"/>
<HBox spacing="4.0">
<Button fx:id="bstFileButton" text="Select BST File" onAction="#selectBstFile" />
<VBox spacing="4.0" HBox.hgrow="ALWAYS">
<Label text="%Available" styleClass="sectionHeader"/>
<CustomTextField fx:id="searchBox" promptText="%Filter" VBox.vgrow="NEVER" prefHeight="20.0"/>
Expand Down
19 changes: 19 additions & 0 deletions src/main/java/org/jabref/gui/preferences/preview/PreviewTab.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package org.jabref.gui.preferences.preview;

import java.io.File;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;

import javafx.application.Platform;
import javafx.beans.property.ListProperty;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
Expand All @@ -18,6 +21,7 @@
import javafx.scene.input.KeyEvent;
import javafx.scene.input.MouseEvent;
import javafx.scene.input.TransferMode;
import javafx.stage.FileChooser;

import org.jabref.gui.Globals;
Siedlerchr marked this conversation as resolved.
Show resolved Hide resolved
import org.jabref.gui.StateManager;
Expand All @@ -32,6 +36,7 @@
import org.jabref.gui.util.BindingsHelper;
import org.jabref.gui.util.IconValidationDecorator;
import org.jabref.gui.util.ViewModelListCellFactory;
import org.jabref.logic.bst.BstPreviewLayout;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.preview.PreviewLayout;
import org.jabref.logic.util.TestEntry;
Expand Down Expand Up @@ -104,6 +109,20 @@ public String getTabName() {
return Localization.lang("Entry preview");
}

@FXML
private void selectBstFile(ActionEvent event) {
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Select BST File");
fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("BST Files", "*.bst"));

File selectedFile = fileChooser.showOpenDialog(null);
Siedlerchr marked this conversation as resolved.
Show resolved Hide resolved
if (selectedFile != null) {
String filePath = selectedFile.getAbsolutePath();
BstPreviewLayout bstPreviewLayout = new BstPreviewLayout(Path.of(filePath));
viewModel.availableListProperty().add(bstPreviewLayout);
}
}

public void initialize() {
this.viewModel = new PreviewTabViewModel(dialogService, preferencesService.getPreviewPreferences(), taskExecutor, stateManager);
lastKeyPressTime = System.currentTimeMillis();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,10 @@ public void setPreviewLayout(PreviewLayout selectedLayout) {
sourceTextProperty.setValue(layout.getText().replace("__NEWLINE__", "\n"));
Siedlerchr marked this conversation as resolved.
Show resolved Hide resolved
selectedIsEditableProperty.setValue(true);
} else {
sourceTextProperty.setValue(((CitationStylePreviewLayout) selectedLayout).getSource());
selectedIsEditableProperty.setValue(false);
if (selectedLayout instanceof CitationStylePreviewLayout) {
sourceTextProperty.setValue(((CitationStylePreviewLayout) selectedLayout).getSource());
selectedIsEditableProperty.setValue(false);
}
}
Siedlerchr marked this conversation as resolved.
Show resolved Hide resolved
}

Expand Down
Loading