-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Fix Issue Unable to remove multiline property from field #12040
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides the code duplication issue, I would recommend to dive into TestFX - see annotation @GUITest
to simulate clicks of users and the expected changes.
src/main/java/org/jabref/gui/preferences/customentrytypes/CustomEntryTypesTab.java
Outdated
Show resolved
Hide resolved
Thanks for the fix! See the comment from @koppor and add a changelog entry |
src/main/java/org/jabref/gui/preferences/customentrytypes/CustomEntryTypesTab.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix! Tested it out and looks good.
src/main/java/org/jabref/gui/preferences/customentrytypes/CustomEntryTypesTab.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not work at all.
-
Reset preferences
-
Check entry types "Book" and "InProceedings". "Author"
- I set "Author" muliline for InProcedings.
-
I click "Save"
-
I open "Book"
Author is multiline 😭😭😭
Thus, I really ask you to think about the code and the comment at #11897 (comment).
Hey @koppor, thank you for your review and I am sorry that this issue has dragged out this long. I would like to make sure I am on the same page before I update this pull request. My original thought while working on this issue was that multi-line fields were global between entry types per comment #11897 (comment) saying
If I understand correctly from your comment and provided images, the expected behavior is for multiline fields to act like required fields and be entry type independent than global? So any change made in "In Proceedings" would not affect "Book". Which makes sense why my work on this pull request needs change. I actually thought this was the case originally per my comment #11897 (comment) detailing the changes that would be required. This is also why I backtracked on comment #11897 (comment) as the concern I had is that FieldPreferences and CLIPreferences would require significant modification on how Fields are Stored as they are currently stored as a string list but would need to be saved as a key-value pair as "FieldName", "Value". Thank you for your helpful review and support. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your comment. The JavaDoc / code comments should include this knowledge at "common" places. I gave you hints.
@@ -176,7 +177,8 @@ private void setupFieldsTable() { | |||
makeRotatedColumnHeader(fieldTypeColumn, Localization.lang("Required")); | |||
|
|||
fieldTypeMultilineColumn.setCellFactory(CheckBoxTableCell.forTableColumn(fieldTypeMultilineColumn)); | |||
fieldTypeMultilineColumn.setCellValueFactory(item -> item.getValue().multilineProperty()); | |||
// The listener createMultilinePropertyListener updates all fields with the same name in all entry types otherwise multiline property is not updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this as JavaDoc to the method createMultilinePropertyListener
.
private BooleanProperty createMultilinePropertyListener(TableColumn.CellDataFeatures<FieldViewModel, Boolean> item) { | ||
BooleanProperty property = item.getValue().multilineProperty(); | ||
property.addListener((obs, wasSelected, isSelected) -> { | ||
viewModel.entryTypes().forEach(typeViewModel -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add doc that all types need to be changed as the standard fields are global for each entry type.
Closing this issue due to inactivity 💤 |
This pull request aims to fix the issue where the user is unable to remove a multi-line property from fields. This is done through the addition of a checkbox listener that also checks the multiline boxes in other entry types as they are by design global Ref: #11897 (comment). This not only gives visual feedback of the change to the user but also fixes the issue without refactoring CustomEntryTypesTabViewModel logic as the original issue stemmed from the for-loop inside storeSettings overriding boolean changes which was also originally mentioned in the issue.
#11897 (comment)
Setting the value of the field in all entry types utilizes this to fix the issue.
Closes #11897
Mandatory checks
CHANGELOG.md
described in a way that is understandable for the average user (if applicable)