-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Allow reordering of custom entry types fields #6152
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
Merged
Merged
Changes from all commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
4a2737f
[WIP] allow Reordering of custom entry types fields
Siedlerchr 18800b9
Merge remote-tracking branch 'upstream/master' into allowReordering
Siedlerchr daeec26
Merge remote-tracking branch 'upstream/master' into allowReordering
Siedlerchr d06d545
change to linkedHashSet
Siedlerchr 5353a85
Further changes
Siedlerchr 2a48588
Merge remote-tracking branch 'upstream/master' into allowReordering
Siedlerchr 13b2923
iteratre prefs with chidlren recursively to show custom entry types
Siedlerchr 1cbed25
try around with some more stuff
Siedlerchr dcbe938
Merge remote-tracking branch 'upstream/master' into allowReordering
Siedlerchr c937601
show prefs path
Siedlerchr f49a839
Fix action helper when no library is open
Siedlerchr 791f458
Merge remote-tracking branch 'upstream/master' into allowReordering
Siedlerchr 0a010bf
fix checkstyle
Siedlerchr 1d7832a
fix checkstyle
Siedlerchr dc51afd
try with Observable
Siedlerchr 28aaa0c
Create a new EntryTypeViewModel with observable types and fields
Siedlerchr 815050f
Merge remote-tracking branch 'upstream/master' into allowReordering
Siedlerchr ca23628
simplify code
Siedlerchr 5eb5bfc
add/remove handling
Siedlerchr 2777455
check style
Siedlerchr c275419
simplify code and use observable list where possible
Siedlerchr eaf7099
fix checkstyle
Siedlerchr c04b2fc
fix unit tests due to LinkedHashSet
Siedlerchr 15ba840
add extractor
Siedlerchr 614470e
change to observablelist
Siedlerchr e16cbda
fix issue that items get cleared
Siedlerchr 7ddb6fa
Merge remote-tracking branch 'upstream/master' into allowReordering
Siedlerchr 42606fe
Merge remote-tracking branch 'upstream/master' into allowReordering
Siedlerchr 70853bd
Add option to remove custom entr types
Siedlerchr e38742b
fix checkstyle
Siedlerchr 230d8dd
Fix bug with empty ghost fields on empty field collection when parsing
Siedlerchr 831eb50
checkstyle
Siedlerchr 73bd208
add reset and fix tests
Siedlerchr ada2a87
fix fcking checkstyle again
Siedlerchr e2e6fbd
fix tests
Siedlerchr c093a05
reenable filter
Siedlerchr ffa35d4
fix comma error
Siedlerchr 46f0192
add l10n
Siedlerchr 66995a3
l10n
Siedlerchr fbc3d4d
Merge remote-tracking branch 'upstream/master' into allowReordering
Siedlerchr 716a78d
Merge remote-tracking branch 'upstream/master' into allowReordering
Siedlerchr e5dd9c6
revert booktitle order
Siedlerchr fe01050
Merge remote-tracking branch 'upstream/master' into allowReordering
Siedlerchr 5a6fc22
try to add test for use case
Siedlerchr 6846297
pass entry types manager as parameter
Siedlerchr df03c38
Merge remote-tracking branch 'upstream/master' into allowReordering
Siedlerchr 298a832
Fix issue with wrong order after using BibEntryType Builder
Siedlerchr 16b5366
checkstyle
Siedlerchr 0e8803a
implement reset
Siedlerchr 07d5983
make dialogmessage more specific
Siedlerchr d1f4d99
checkstyle
Siedlerchr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
src/main/java/org/jabref/gui/customentrytypes/CustomEntryTypeViewModel.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| package org.jabref.gui.customentrytypes; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Objects; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| import javafx.beans.property.ObjectProperty; | ||
| import javafx.beans.property.SimpleObjectProperty; | ||
| import javafx.collections.FXCollections; | ||
| import javafx.collections.ObservableList; | ||
|
|
||
| import org.jabref.model.entry.BibEntryType; | ||
|
|
||
| public class CustomEntryTypeViewModel { | ||
|
|
||
| private final ObjectProperty<BibEntryType> entryType = new SimpleObjectProperty<>(); | ||
| private final ObservableList<FieldViewModel> fields; | ||
|
|
||
| public CustomEntryTypeViewModel(BibEntryType entryType) { | ||
| this.entryType.set(entryType); | ||
|
|
||
| List<FieldViewModel> allFieldsForType = entryType.getAllBibFields().stream().map(bibField -> new FieldViewModel(bibField.getField(), entryType.isRequired(bibField.getField()), bibField.getPriority())).collect(Collectors.toList()); | ||
| fields = FXCollections.observableArrayList((allFieldsForType)); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return Objects.hash(entryType, fields); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object obj) { | ||
| if (this == obj) { | ||
| return true; | ||
| } | ||
| if (!(obj instanceof CustomEntryTypeViewModel)) { | ||
| return false; | ||
| } | ||
| CustomEntryTypeViewModel other = (CustomEntryTypeViewModel) obj; | ||
| return Objects.equals(entryType, other.entryType) && Objects.equals(fields, other.fields); | ||
| } | ||
|
|
||
| public void addField(FieldViewModel field) { | ||
| this.fields.add(field); | ||
| } | ||
|
|
||
| public ObservableList<FieldViewModel> fields() { | ||
| return this.fields; | ||
| } | ||
|
|
||
| public ObjectProperty<BibEntryType> entryType() { | ||
| return this.entryType; | ||
| } | ||
|
|
||
| public void removeField(FieldViewModel focusedItem) { | ||
| this.fields.remove(focusedItem); | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "CustomEntryTypeViewModel [entryType=" + entryType + ", fields=" + fields + "]"; | ||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.