Skip to content

Commit a70b45d

Browse files
authored
Fix #4033: order of fields in customized entry types is saved correctly (#4127)
* Rename dialog class * Fix #4033: order of fields in customized entry types is saved correctly
1 parent 8ee3f6d commit a70b45d

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
4646
- We fixed an issue where the custom file column were sorted incorrectly. https://github.com/JabRef/jabref/issues/3119
4747
- We fixed an issues where the entry losses focus when a field is edited and at the same time used for sorting. https://github.com/JabRef/jabref/issues/3373
4848
- We fixed an issue where the menu on Mac OS was not displayed in the usual Mac-specific way. https://github.com/JabRef/jabref/issues/3146
49+
- We fixed an issue where the order of fields in customized entry types was not saved correctly. [#4033](http://github.com/JabRef/jabref/issues/4033)
4950
- We fixed an issue where the groups tree of the last database was still shown even after the database was already closed.
5051
- We fixed an issue where the "Open file dialog" may disappear behind other windows. https://github.com/JabRef/jabref/issues/3410
5152
- We fixed an issue where the default icon of a group was not colored correctly.

src/main/java/org/jabref/gui/actions/CustomizeEntryAction.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import javax.swing.JDialog;
44

55
import org.jabref.gui.JabRefFrame;
6-
import org.jabref.gui.customentrytypes.EntryCustomizationDialog;
6+
import org.jabref.gui.customentrytypes.EntryTypeCustomizationDialog;
77

88
public class CustomizeEntryAction extends SimpleCommand {
99

@@ -12,10 +12,10 @@ public class CustomizeEntryAction extends SimpleCommand {
1212
public CustomizeEntryAction(JabRefFrame frame) {
1313
this.frame = frame;
1414
}
15-
15+
1616
@Override
1717
public void execute() {
18-
JDialog dialog = new EntryCustomizationDialog(frame);
18+
JDialog dialog = new EntryTypeCustomizationDialog(frame);
1919
dialog.setVisible(true);
2020
}
2121
}

src/main/java/org/jabref/gui/customentrytypes/EntryCustomizationDialog.java renamed to src/main/java/org/jabref/gui/customentrytypes/EntryTypeCustomizationDialog.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import java.awt.event.ActionEvent;
99
import java.awt.event.ActionListener;
1010
import java.util.ArrayList;
11+
import java.util.Arrays;
1112
import java.util.Collections;
1213
import java.util.HashMap;
1314
import java.util.HashSet;
@@ -49,7 +50,7 @@
4950

5051
import com.jgoodies.forms.builder.ButtonBarBuilder;
5152

52-
public class EntryCustomizationDialog extends JabRefDialog implements ListSelectionListener {
53+
public class EntryTypeCustomizationDialog extends JabRefDialog implements ListSelectionListener {
5354

5455
protected GridBagLayout gbl = new GridBagLayout();
5556
protected GridBagConstraints con = new GridBagConstraints();
@@ -71,10 +72,10 @@ public class EntryCustomizationDialog extends JabRefDialog implements ListSelect
7172
private BibDatabaseMode bibDatabaseMode;
7273

7374
/**
74-
* Creates a new instance of EntryCustomizationDialog
75+
* Creates a new instance of EntryTypeCustomizationDialog
7576
*/
76-
public EntryCustomizationDialog(JabRefFrame frame) {
77-
super((JFrame) null, Localization.lang("Customize entry types"), false, EntryCustomizationDialog.class);
77+
public EntryTypeCustomizationDialog(JabRefFrame frame) {
78+
super((JFrame) null, Localization.lang("Customize entry types"), false, EntryTypeCustomizationDialog.class);
7879

7980
this.frame = frame;
8081
initGui();
@@ -276,11 +277,13 @@ private void applyChanges() {
276277
if (biblatexMode) {
277278
Set<String> oldPrimaryOptionalFieldsLists = oldType.get().getPrimaryOptionalFields();
278279
Set<String> oldSecondaryOptionalFieldsList = oldType.get().getSecondaryOptionalFields();
279-
if (oldRequiredFieldsList.equals(requiredFieldsList) && oldPrimaryOptionalFieldsLists.equals(optionalFieldsList) &&
280-
oldSecondaryOptionalFieldsList.equals(secondaryOptionalFieldsLists)) {
280+
if (Arrays.equals(oldRequiredFieldsList.toArray(), requiredFieldsList.toArray())
281+
&& Arrays.equals(oldPrimaryOptionalFieldsLists.toArray(), optionalFieldsList.toArray())
282+
&& Arrays.equals(oldSecondaryOptionalFieldsList.toArray(), secondaryOptionalFieldsLists.toArray())) {
281283
changesMade = false;
282284
}
283-
} else if (oldRequiredFieldsList.equals(requiredFieldsList) && oldOptionalFieldsList.equals(optionalFieldsList)) {
285+
} else if (Arrays.equals(oldRequiredFieldsList.toArray(), requiredFieldsList.toArray())
286+
&& Arrays.equals(oldOptionalFieldsList.toArray(), optionalFieldsList.toArray())) {
284287
changesMade = false;
285288
}
286289
}

src/main/java/org/jabref/gui/customentrytypes/EntryTypeList.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
/**
2424
* This class extends FieldSetComponent to provide some required functionality for the
25-
* list of entry types in EntryCustomizationDialog.
25+
* list of entry types in EntryTypeCustomizationDialog.
2626
*/
2727
public class EntryTypeList extends FieldSetComponent implements ListSelectionListener {
2828

0 commit comments

Comments
 (0)