-
-
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
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ecebbe0
Add Field Event to Global Check Fields in Entry Types
PressJump b4e3338
Fix CheckStyle errors to meet JabRef's code guidelines
PressJump 1ca84f7
Move multiLineListener into Method & Remove Duplicate Code
PressJump b4c69f2
Merge remote-tracking branch 'maingit/main' into unable-to-remove-mul…
PressJump c577c22
Add Fixed Entry into Changelog for Issue #11897
PressJump 830b2e4
Add Comment for Use Case of New Method
PressJump eb94620
Merge remote-tracking branch 'maingit/main' into unable-to-remove-mul…
PressJump 7048aca
Merge branch 'main' into unable-to-remove-multiline-11897
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 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 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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package org.jabref.gui.preferences.customentrytypes; | ||
|
||
import javafx.application.Platform; | ||
import javafx.beans.property.BooleanProperty; | ||
import javafx.beans.property.ReadOnlyStringWrapper; | ||
import javafx.collections.ObservableList; | ||
import javafx.fxml.FXML; | ||
|
@@ -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 | ||
fieldTypeMultilineColumn.setCellValueFactory(this::createMultilinePropertyListener); | ||
PressJump marked this conversation as resolved.
Show resolved
Hide resolved
|
||
makeRotatedColumnHeader(fieldTypeMultilineColumn, Localization.lang("Multiline")); | ||
|
||
fieldTypeActionColumn.setSortable(false); | ||
|
@@ -206,6 +208,18 @@ private void setupFieldsTable() { | |
EasyBind.subscribe(addNewField.getEditor().textProperty(), text -> addNewField.setValue(FieldsUtil.FIELD_STRING_CONVERTER.fromString(text))); | ||
} | ||
|
||
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 commentThe 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. |
||
typeViewModel.fields().stream() | ||
.filter(field -> field.displayNameProperty().get().equals(item.getValue().displayNameProperty().get())) | ||
.forEach(field -> field.multilineProperty().set(isSelected)); | ||
}); | ||
}); | ||
return property; | ||
} | ||
|
||
private void makeRotatedColumnHeader(TableColumn<?, ?> column, String text) { | ||
Label label = new Label(); | ||
label.setText(text); | ||
|
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.
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
.