Skip to content

Commit 209f8e0

Browse files
authored
Add getDefault() and setAll() methods to SpecialFieldsPreferences
- Added private default constructor with default specialFieldsEnabled = true - Added static getDefault() method to create default preferences - Added setAll() method to reset preferences from another instance Fixes #14409
1 parent 50dcac9 commit 209f8e0

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

jabgui/src/main/java/org/jabref/gui/specialfields/SpecialFieldsPreferences.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,21 @@ public SpecialFieldsPreferences(boolean specialFieldsEnabled) {
1313
this.specialFieldsEnabled = new SimpleBooleanProperty(specialFieldsEnabled);
1414
}
1515

16+
/// Creates object with default values
17+
private SpecialFieldsPreferences() {
18+
this(
19+
true // Default special fields enabled
20+
);
21+
}
22+
23+
public static SpecialFieldsPreferences getDefault() {
24+
return new SpecialFieldsPreferences();
25+
}
26+
27+
public void setAll(SpecialFieldsPreferences preferences) {
28+
this.specialFieldsEnabled.set(preferences.isSpecialFieldsEnabled());
29+
}
30+
1631
public boolean isSpecialFieldsEnabled() {
1732
return specialFieldsEnabled.getValue();
1833
}

0 commit comments

Comments
 (0)