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

Update to jfx 19 #9155

Merged
merged 3 commits into from
Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ dependencyLocking {
}

javafx {
version = "18.0.2"
version = "19"
modules = [ 'javafx.controls', 'javafx.fxml', 'javafx.web', 'javafx.swing' ]
}

Expand Down Expand Up @@ -167,7 +167,7 @@ dependencies {
implementation 'org.kordamp.ikonli:ikonli-materialdesign2-pack:12.3.1'
implementation 'com.github.sialcasa.mvvmFX:mvvmfx-validation:f195849ca9' //jitpack
implementation 'de.saxsys:mvvmfx:1.8.0'
implementation 'com.tobiasdiez:easybind:2.2'
implementation 'com.tobiasdiez:easybind:2.2.1-SNAPSHOT'
implementation 'org.fxmisc.flowless:flowless:0.6.10'
implementation 'org.fxmisc.richtext:richtextfx:0.10.9'
implementation group: 'org.glassfish.hk2.external', name: 'jakarta.inject', version: '2.6.1'
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/StateManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class StateManager {
private final ObjectProperty<LastAutomaticFieldEditorEdit> lastAutomaticFieldEditorEdit = new SimpleObjectProperty<>();

public StateManager() {
activeGroups.bind(Bindings.valueAt(selectedGroups, activeDatabase.orElse(null)));
activeGroups.bind(Bindings.valueAt(selectedGroups, activeDatabase.orElseOpt(null)));
}

public ObservableList<SidePaneType> getVisibleSidePaneComponents() {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/jabref/gui/actions/ActionHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ public static BooleanExpression isAnyFieldSetForSelectedEntry(List<Field> fields
.mapObservable(entry -> Bindings.createBooleanBinding(() -> {
return entry.getFields().stream().anyMatch(fields::contains);
}, entry.getFieldsObservable()))
.orElse(false);
.orElseOpt(false);
return BooleanExpression.booleanExpression(fieldsAreSet);
}

public static BooleanExpression isFilePresentForSelectedEntry(StateManager stateManager, PreferencesService preferencesService) {
ObservableList<BibEntry> selectedEntries = stateManager.getSelectedEntries();
Binding<Boolean> fileIsPresent = EasyBind.valueAt(selectedEntries, 0).map(entry -> {
Binding<Boolean> fileIsPresent = EasyBind.valueAt(selectedEntries, 0).mapOpt(entry -> {
List<LinkedFile> files = entry.getFiles();

if ((entry.getFiles().size() > 0) && stateManager.getActiveDatabase().isPresent()) {
Expand All @@ -80,7 +80,7 @@ public static BooleanExpression isFilePresentForSelectedEntry(StateManager state
} else {
return false;
}
}).orElse(false);
}).orElseOpt(false);

return BooleanExpression.booleanExpression(fileIsPresent);
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/jabref/gui/groups/GroupTreeView.java
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ private void initialize() {
// Add context menu (only for non-null items)
row.contextMenuProperty().bind(
EasyBind.wrapNullable(row.itemProperty())
.map(this::createContextMenuForGroup)
.orElse((ContextMenu) null));
.mapOpt(this::createContextMenuForGroup)
.orElseOpt((ContextMenu) null));
row.addEventFilter(MouseEvent.MOUSE_PRESSED, event -> {
if (event.getButton() == MouseButton.SECONDARY) {
// Prevent right-click to select group
Expand Down Expand Up @@ -357,7 +357,7 @@ private void updateSelection(List<TreeItem<GroupNodeViewModel>> newSelectedGroup
if ((newSelectedGroups == null) || newSelectedGroups.isEmpty()) {
viewModel.selectedGroupsProperty().clear();
} else {
List<GroupNodeViewModel> list = newSelectedGroups.stream().filter(model -> model != null && !(model.getValue().getGroupNode().getGroup() instanceof AllEntriesGroup)).map(TreeItem::getValue).collect(Collectors.toList());
List<GroupNodeViewModel> list = newSelectedGroups.stream().filter(model -> (model != null) && !(model.getValue().getGroupNode().getGroup() instanceof AllEntriesGroup)).map(TreeItem::getValue).collect(Collectors.toList());
viewModel.selectedGroupsProperty().setAll(list);
}
}
Expand Down Expand Up @@ -500,7 +500,7 @@ public void expandGroup(TreeItem<GroupNodeViewModel> treeItem) {
return;
}

if (System.currentTimeMillis() - this.dragStarted > DRAG_TIME_BEFORE_EXPANDING_MS) {
if ((System.currentTimeMillis() - this.dragStarted) > DRAG_TIME_BEFORE_EXPANDING_MS) {
// expand or collapse the tree item and reset the time
this.dragStarted = System.currentTimeMillis();
this.draggedItem.setExpanded(!this.draggedItem.isExpanded());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public BibEntryTableViewModel(BibEntry entry, BibDatabaseContext bibDatabaseCont
this.entry = entry;
this.fieldValueFormatter = fieldValueFormatter;

this.linkedFiles = getField(StandardField.FILE).map(FileFieldParser::parse).orElse(Collections.emptyList());
this.linkedFiles = getField(StandardField.FILE).mapOpt(FileFieldParser::parse).orElseOpt(Collections.emptyList());
this.linkedIdentifiers = createLinkedIdentifiersBinding(entry);
this.matchedGroups = createMatchedGroupsBinding(bibDatabaseContext, entry);
this.bibDatabaseContext = bibDatabaseContext;
Expand Down Expand Up @@ -107,7 +107,7 @@ public ObservableValue<Optional<SpecialFieldValueViewModel>> getSpecialField(Spe
if (value != null) {
return value;
} else {
value = getField(field).flatMap(fieldValue -> field.parseValue(fieldValue).map(SpecialFieldValueViewModel::new));
value = getField(field).flatMapOpt(fieldValue -> field.parseValue(fieldValue).map(SpecialFieldValueViewModel::new));
specialFieldValues.put(field, value);
return value;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jabref/gui/util/OptionalObjectProperty.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public static <T> OptionalObjectProperty<T> empty() {
* Returns a new ObservableValue that holds the value held by this
* ObservableValue, or {@code other} when this ObservableValue is empty.
*/
public ObjectBinding<T> orElse(T other) {
return new PreboundBinding<T>(this) {
public ObjectBinding<T> orElseOpt(T other) {
return new PreboundBinding<>(this) {
@Override
protected T computeValue() {
return OptionalObjectProperty.this.getValue().orElse(other);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jabref/model/entry/BibEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ private Optional<String> genericGetResolvedFieldOrAlias(Field field, BibDatabase
}
}

return (database == null || result.isEmpty()) ?
return ((database == null) || result.isEmpty()) ?
result :
Optional.of(database.resolveForStrings(result.get()));
}
Expand Down Expand Up @@ -970,7 +970,7 @@ public Optional<Month> getMonth() {

public OptionalBinding<String> getFieldBinding(Field field) {
if ((field == InternalField.TYPE_HEADER) || (field == InternalField.OBSOLETE_TYPE_HEADER)) {
return EasyBind.wrapNullable(type).map(EntryType::getDisplayName);
return EasyBind.wrapNullable(type).mapOpt(EntryType::getDisplayName);
}
return EasyBind.valueAt(fields, field);
}
Expand Down