Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- We fixed an issue where we display warning message for moving attached open files. [#10121](https://github.com/JabRef/jabref/issues/10121)
- We fixed an issue where it was not possible to select selecting content of other user's comments.[#11106](https://github.com/JabRef/jabref/issues/11106)
- We fixed an issue where web search preferences "Custom API key" table modifications not discarded. [#11925](https://github.com/JabRef/jabref/issues/11925)
- We fixed an issue where multiline property from field was unable to be removed after adding it. [#11897](https://github.com/JabRef/jabref/issues/11897)
- We fixed an issue when opening attached files in [extra file columns](https://docs.jabref.org/finding-sorting-and-cleaning-entries/filelinks#adding-additional-columns-to-entry-table-for-file-types). [#12005](https://github.com/JabRef/jabref/issues/12005)
- We fixed an issue where trying to open a library from a failed mounted directory on Mac would cause an error. [#10548](https://github.com/JabRef/jabref/issues/10548)
- We fixed an issue where identifier paste couldn't work with Unicode REPLACEMENT CHARACTER. [#11986](https://github.com/JabRef/jabref/issues/11986)
Expand Down
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;
Expand Down Expand Up @@ -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
Copy link
Member

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.

fieldTypeMultilineColumn.setCellValueFactory(this::createMultilinePropertyListener);
PressJump marked this conversation as resolved.
Show resolved Hide resolved
makeRotatedColumnHeader(fieldTypeMultilineColumn, Localization.lang("Multiline"));

fieldTypeActionColumn.setSortable(false);
Expand Down Expand Up @@ -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 -> {
Copy link
Member

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.

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);
Expand Down
Loading