-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Added option in preferences to use custom URL base for DOI generation #7480
Merged
Merged
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ad6aa99
Added option in preferences to create custom URL base for DOI generation
BJaroszkowski 734eee9
moved DOI base URI preference to separate preference tab
BJaroszkowski 67ca523
changed preferences tab name to customisation and moved preferences c…
BJaroszkowski 5059f9c
fixes to localisation
BJaroszkowski 1e14204
Merge branch 'master' into fix-for-issue-7337
BJaroszkowski d6cc425
updated test to reflect changes to IdentifierEditorViewModel
BJaroszkowski 350a5b7
merge with master
BJaroszkowski a43eea3
fixes to localization
BJaroszkowski c7df079
style fix
BJaroszkowski d83bf00
implemented suggested fixes
BJaroszkowski 8acf409
updated CHANGELOG.md to reflect the changes in the UI
BJaroszkowski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/main/java/org/jabref/gui/preferences/customization/CustomizationTab.fxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<?import javafx.scene.control.CheckBox?> | ||
<?import javafx.scene.control.TextField?> | ||
<?import javafx.scene.control.Label?> | ||
<?import javafx.scene.layout.VBox?> | ||
<?import javafx.scene.layout.HBox?> | ||
<fx:root spacing="10.0" type="VBox" | ||
xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml" | ||
fx:controller="org.jabref.gui.preferences.customization.CustomizationTab"> | ||
<Label styleClass="titleHeader" text="%Customization"/> | ||
|
||
<Label styleClass="sectionHeader" text="%Custom DOI URI"/> | ||
<HBox alignment="CENTER_LEFT" spacing="10.0"> | ||
<CheckBox fx:id="useCustomDOI" text="%Use custom DOI base URI for article access"/> | ||
<TextField fx:id="useCustomDOIName" HBox.hgrow="ALWAYS"/> | ||
</HBox> | ||
</fx:root> | ||
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. missing newline at the end of the file |
36 changes: 36 additions & 0 deletions
36
src/main/java/org/jabref/gui/preferences/customization/CustomizationTab.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.jabref.gui.preferences.customization; | ||
|
||
import javafx.fxml.FXML; | ||
import javafx.scene.control.CheckBox; | ||
import javafx.scene.control.TextField; | ||
|
||
import org.jabref.gui.preferences.AbstractPreferenceTabView; | ||
import org.jabref.gui.preferences.PreferencesTab; | ||
import org.jabref.logic.l10n.Localization; | ||
|
||
import com.airhacks.afterburner.views.ViewLoader; | ||
|
||
public class CustomizationTab extends AbstractPreferenceTabView<CustomizationTabViewModel> implements PreferencesTab { | ||
|
||
@FXML private CheckBox useCustomDOI; | ||
@FXML private TextField useCustomDOIName; | ||
|
||
public CustomizationTab() { | ||
ViewLoader.view(this) | ||
.root(this) | ||
.load(); | ||
} | ||
|
||
@Override | ||
public String getTabName() { | ||
return Localization.lang("Customization"); | ||
} | ||
|
||
public void initialize() { | ||
this.viewModel = new CustomizationTabViewModel(dialogService, preferencesService); | ||
|
||
useCustomDOI.selectedProperty().bindBidirectional(viewModel.useCustomDOIProperty()); | ||
useCustomDOIName.textProperty().bindBidirectional(viewModel.useCustomDOINameProperty()); | ||
useCustomDOIName.disableProperty().bind(useCustomDOI.selectedProperty().not()); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
src/main/java/org/jabref/gui/preferences/customization/CustomizationTabViewModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package org.jabref.gui.preferences.customization; | ||
|
||
import javafx.beans.property.BooleanProperty; | ||
import javafx.beans.property.SimpleBooleanProperty; | ||
import javafx.beans.property.SimpleStringProperty; | ||
import javafx.beans.property.StringProperty; | ||
|
||
import org.jabref.gui.DialogService; | ||
import org.jabref.gui.preferences.PreferenceTabViewModel; | ||
import org.jabref.logic.preferences.DOIPreferences; | ||
import org.jabref.preferences.PreferencesService; | ||
|
||
public class CustomizationTabViewModel implements PreferenceTabViewModel { | ||
|
||
private final BooleanProperty useCustomDOIProperty = new SimpleBooleanProperty(); | ||
private final StringProperty useCustomDOINameProperty = new SimpleStringProperty(""); | ||
|
||
private final DialogService dialogService; | ||
private final PreferencesService preferencesService; | ||
private final DOIPreferences initialDOIPreferences; | ||
|
||
public CustomizationTabViewModel(DialogService dialogService, PreferencesService preferencesService) { | ||
this.dialogService = dialogService; | ||
this.preferencesService = preferencesService; | ||
this.initialDOIPreferences = preferencesService.getDOIPreferences(); | ||
} | ||
|
||
@Override | ||
public void setValues() { | ||
useCustomDOIProperty.setValue(initialDOIPreferences.isUseCustom()); | ||
useCustomDOINameProperty.setValue(initialDOIPreferences.getDefaultBaseURI()); | ||
} | ||
|
||
@Override | ||
public void storeSettings() { | ||
preferencesService.storeDOIPreferences(new DOIPreferences( | ||
useCustomDOIProperty.getValue(), | ||
useCustomDOINameProperty.getValue().trim())); | ||
} | ||
|
||
public BooleanProperty useCustomDOIProperty() { | ||
return this.useCustomDOIProperty; | ||
} | ||
|
||
public StringProperty useCustomDOINameProperty() { | ||
return this.useCustomDOINameProperty; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/main/java/org/jabref/logic/preferences/DOIPreferences.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.jabref.logic.preferences; | ||
|
||
public class DOIPreferences { | ||
private final boolean useCustom; | ||
private final String defaultBaseURI; | ||
|
||
public DOIPreferences(boolean useCustom, String defaultBaseURI) { | ||
this.useCustom = useCustom; | ||
this.defaultBaseURI = defaultBaseURI; | ||
} | ||
|
||
public boolean isUseCustom() { | ||
return useCustom; | ||
} | ||
|
||
public String getDefaultBaseURI() { | ||
return defaultBaseURI; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
please no single char variable name like x, use a meaninfgul variable and inside the flatmap you should be able to use a static syntax like DOI::getExternalUriWithCustomBase
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.
Correct me if I'm wrong but since flatMap requires Function and we have two input arguments (String baseUri and DOI) is it not impossible to implement the static syntax? IntelliJ seems to agree with that.
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.
Sorry, overlooked that, you are right