Added Backingstore, setAll and getAll methods, modified Helper Method…#14941
Added Backingstore, setAll and getAll methods, modified Helper Method…#14941aaryyya wants to merge 3 commits intoJabRef:mainfrom
Conversation
…s and default constructor was added
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
|
Your code currently does not meet JabRef's code guidelines. IntelliJ auto format covers some cases. There seem to be issues with your code style and autoformat configuration. Please reformat your code (Ctrl+Alt+L) and commit, then push. |
is your friend |
|
@aaryyya DO NOT OPEN A NEW PULL REQUEST AFTER EACH CHAGNE - please push your updated! PUSH TO THE EXISTING BRANCH? OK? Not sure if you understand. |
|
This starts to be chaos. Review comments from could be #14765 (comment) |
| NameDisplayPreferences.AbbreviationStyle abbreviationStyle = NameDisplayPreferences.AbbreviationStyle.NONE; // default | ||
| if (getBoolean(ABBR_AUTHOR_NAMES)) { | ||
| abbreviationStyle = NameDisplayPreferences.AbbreviationStyle.FULL; | ||
| } else if (getBoolean(NAMES_LAST_ONLY)) { | ||
| abbreviationStyle = NameDisplayPreferences.AbbreviationStyle.LASTNAME_ONLY; | ||
| } | ||
| return abbreviationStyle; | ||
| return NameDisplayPreferences.getDefault().getAbbreviationStyle(); |
There was a problem hiding this comment.
So you basically ignore what is stored in the preferences and just always use the defaults?
| NameDisplayPreferences.DisplayStyle displayStyle = NameDisplayPreferences.DisplayStyle.LASTNAME_FIRSTNAME; // default | ||
| if (getBoolean(NAMES_NATBIB)) { | ||
| displayStyle = NameDisplayPreferences.DisplayStyle.NATBIB; | ||
| } else if (getBoolean(NAMES_AS_IS)) { | ||
| displayStyle = NameDisplayPreferences.DisplayStyle.AS_IS; | ||
| } else if (getBoolean(NAMES_FIRST_LAST)) { | ||
| displayStyle = NameDisplayPreferences.DisplayStyle.FIRSTNAME_LASTNAME; | ||
| } | ||
| return displayStyle; | ||
| return NameDisplayPreferences.getDefault().getDisplayStyle(); |
| defaults.put(ABBR_AUTHOR_NAMES, Boolean.TRUE); // "Abbreviate names" | ||
| defaults.put(NAMES_LAST_ONLY, Boolean.TRUE); // "Show last names only" | ||
| // endregion | ||
| // |

User description
…s and default constructor was added
Closes #14412
Steps to test
Mandatory checks
CHANGELOG.mdin a way that is understandable for the average user (if change is visible to the user)PR Type
Enhancement
Description
Added default constructor and factory method to
NameDisplayPreferencesImplemented
setAll()method for copying preferences between instancesRefactored preference initialization to use backing store pattern
Removed hardcoded preference defaults from
JabRefGuiPreferencesIntegrated
NameDisplayPreferencesinto preference reset and import workflowsDiagram Walkthrough
File Walkthrough
NameDisplayPreferences.java
Add default constructor and preference copy methodsjabgui/src/main/java/org/jabref/gui/maintable/NameDisplayPreferences.java
DisplayStyle.NATBIBandAbbreviationStyle.LASTNAME_ONLYdefaultsgetDefault()factory method for creating defaultinstances
setAll()method to copy display and abbreviation styles fromanother instance
JabRefGuiPreferences.java
Refactor name display preferences with backing store patternjabgui/src/main/java/org/jabref/gui/preferences/JabRefGuiPreferences.java
(
NAMES_AS_IS,NAMES_FIRST_LAST,NAMES_NATBIB,ABBR_AUTHOR_NAMES,NAMES_LAST_ONLY)getNameDisplayPreferences()to usegetNameDisplayPreferencesFromBackingStore()with default instancegetNameAbbreviationStyle()andgetNameDisplayStyle()todelegate to default preferences
getNameDisplayPreferencesFromBackingStore()method to loadpreferences from backing store
NameDisplayPreferencesintoclear()andimportPreferences()workflows