fix: make fields sorted by lexicographical order#7711
Conversation
|
Normally, this would be a suitable way. However, this is a special case as you can reorder the fields in the custom entry types dialog. Refs #6152 |
|
Thanks for guidance, I found they both use |
Siedlerchr
left a comment
There was a problem hiding this comment.
Yep, that's now better.
Just two minor improvements
| - We fixed an issue where the XMP Importer would incorrectly return an empty default entry when importing pdfs [#6577](https://github.com/JabRef/jabref/issues/6577) | ||
| - We fixed an issue where opening the menu 'Library properties' marked the library as modified [#6451](https://github.com/JabRef/jabref/issues/6451) | ||
| - We fixed an issue when importing resulted in an exception [#7343](https://github.com/JabRef/jabref/issues/7343) | ||
| - We fixed an issue Some fields are in random order [#7710](https://github.com/JabRef/jabref/issues/7710) |
There was a problem hiding this comment.
| - We fixed an issue Some fields are in random order [#7710](https://github.com/JabRef/jabref/issues/7710) | |
| - We fixed an issue where the field in the Field formatter dropdown selection were sorted in random order [#7710](https://github.com/JabRef/jabref/issues/7710) |
|
|
||
| public FieldFormatterCleanupsPanelViewModel() { | ||
| availableFieldsProperty.sort((field1, field2) -> { | ||
| if (field1.getDisplayName().equals(field2.getDisplayName())) { |
There was a problem hiding this comment.
The compareTo already performs equal checks...
So you should be able to directly use sort(field1, field2) -> field1.getDisplayName().compareTo(field2.getDisplayName))
There was a problem hiding this comment.
Comparator.comparing should work as well.
There was a problem hiding this comment.
What you said really makes sense and I have modified them.
k3KAW8Pnf7mkmdSMPHz27
left a comment
There was a problem hiding this comment.
Looks good to me! One needed change and one nitpick.
(nitpick = I will approve even if you don't fix it, it is a suggestion and address it if you like it)
| import org.jabref.model.entry.field.Field; | ||
| import org.jabref.model.entry.field.FieldFactory; | ||
|
|
||
| import java.util.Comparator; |
There was a problem hiding this comment.
Please fix the reviewdog complaint
Siedlerchr
left a comment
There was a problem hiding this comment.
Yeah, that is even a better solution!
* upstream/main: (71 commits) [Bot] Update CSL styles (#7735) Fix for issue 6966: open all files of multiple entries (#7709) Add simple unit tests (#7696) Add simple unit tests (#7543) Update check-outdated-dependencies.yml Added preset for new entry keybindings and reintroduced defaults (#7705) Select the entry which has smaller dictonary order when merge (#7708) Update CHANGELOG.md fix: make more fields, fomatters, ids and languages sorted by alphabetical order (#7717) Bump libreoffice from 7.1.2 to 7.1.3 (#7721) Bump unoloader from 7.1.2 to 7.1.3 (#7724) Bump org.beryx.jlink from 2.23.7 to 2.23.8 (#7723) Bump org.openjfx.javafxplugin from 0.0.9 to 0.0.10 (#7725) fix: make fields sorted by lexicographical order (#7711) Fix tests Refactoring existing unit tests (#7687) Refactoring and addition of unit tests (#7581) Refactor simple Unit Tests (#7571) Add simple unit tests (#7544) add and extend unit tests (#7685) ...
Fixes #7710
We fix that some fields are in random order (issue #7710). We use
Treemapwhich is ordered to replaceLinkedHashMapand added a comparison function to the treemap to ensure that fields are ordered by lexicographical order.CHANGELOG.mddescribed in a way that is understandable for the average user (if applicable)