-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Add per library journal abbreviation type (LTWA) on save #15517
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
Changes from all commits
9243759
dd2296e
1133b54
d3cb9a5
1163656
753c5a3
8096dc9
a4338cf
a410c82
835af3f
031b19d
fc92e0a
0a9da28
924366c
48e3451
a34f44b
480352e
6e12af6
3410f26
3c02bcb
2906fae
8ab621f
f202e99
3a1ffc4
a88b646
8e7fbda
c3b61d0
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 |
|---|---|---|
|
|
@@ -7,14 +7,17 @@ | |
|
|
||
| import javafx.beans.property.BooleanProperty; | ||
| import javafx.beans.property.ListProperty; | ||
| import javafx.beans.property.ObjectProperty; | ||
| import javafx.beans.property.SimpleBooleanProperty; | ||
| import javafx.beans.property.SimpleListProperty; | ||
| import javafx.beans.property.SimpleObjectProperty; | ||
| import javafx.collections.FXCollections; | ||
|
|
||
| import org.jabref.gui.commonfxcontrols.SortCriterionViewModel; | ||
| import org.jabref.gui.libraryproperties.PropertiesTabViewModel; | ||
| import org.jabref.logic.cleanup.FieldFormatterCleanup; | ||
| import org.jabref.logic.cleanup.FieldFormatterCleanupActions; | ||
| import org.jabref.logic.journals.AbbreviationType; | ||
| import org.jabref.model.database.BibDatabaseContext; | ||
| import org.jabref.model.entry.field.Field; | ||
| import org.jabref.model.entry.field.FieldFactory; | ||
|
|
@@ -47,6 +50,9 @@ public class SavingPropertiesViewModel implements PropertiesTabViewModel { | |
| private final BooleanProperty cleanupsDisableProperty = new SimpleBooleanProperty(); | ||
| private final ListProperty<FieldFormatterCleanup> cleanupsProperty = new SimpleListProperty<>(FXCollections.emptyObservableList()); | ||
|
|
||
| // Journal abbreviation on save | ||
| private final ObjectProperty<AbbreviationType> journalAbbreviationOnSaveProperty = new SimpleObjectProperty<>(); | ||
|
|
||
| private final BibDatabaseContext databaseContext; | ||
| private final MetaData initialMetaData; | ||
| private final SaveOrder saveOrder; | ||
|
|
@@ -98,6 +104,8 @@ public void setValues() { | |
| cleanupsDisableProperty.setValue(!defaultSaveActions.isEnabled()); | ||
| cleanupsProperty.setValue(FXCollections.observableArrayList(defaultSaveActions.getConfiguredActions())); | ||
| }); | ||
|
|
||
| journalAbbreviationOnSaveProperty.setValue(initialMetaData.getLibraryAbbreviationType().orElse(null)); | ||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -137,6 +145,13 @@ public void storeSettings() { | |
| } | ||
| } | ||
|
|
||
| AbbreviationType abbreviationType = journalAbbreviationOnSaveProperty.getValue(); | ||
| if (abbreviationType != null) { | ||
| newMetaData.setLibraryAbbreviationType(abbreviationType); | ||
| } else { | ||
| newMetaData.clearLibraryAbbreviationType(); | ||
|
Member
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. Does it need clearing if it's already
Member
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. I thought about this. If for a newly loaded library with abbreviation type None, one opens the library properties and doesn't touch the drop down (stays "None), this code triggers the library to be marked dirty due to
Collaborator
Author
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. Yes it needs the clear |
||
| } | ||
|
|
||
| databaseContext.setMetaData(newMetaData); | ||
| } | ||
|
|
||
|
|
@@ -179,4 +194,8 @@ public BooleanProperty cleanupsDisableProperty() { | |
| public ListProperty<FieldFormatterCleanup> cleanupsProperty() { | ||
| return cleanupsProperty; | ||
| } | ||
|
|
||
| public ObjectProperty<AbbreviationType> journalAbbreviationOnSaveProperty() { | ||
| return journalAbbreviationOnSaveProperty; | ||
| } | ||
| } | ||
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.
I hope these options sound correct.