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 context menu on second screen #11324

Merged
merged 3 commits into from
May 23, 2024
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- We fixed an issue where imports to a custom group would only work for the first entry [#11085](https://github.com/JabRef/jabref/issues/11085), [#11269](https://github.com/JabRef/jabref/issues/11269)
- We fixed an issue where a new entry was not added to the selected group [#8933](https://github.com/JabRef/jabref/issues/8933)
- We fixed an issue where the horizontal position of the Entry Preview inside the entry editor was not remembered across restarts [#11281](https://github.com/JabRef/jabref/issues/11281)
- We fixed an issue where the entry editor context menu was not shown correctly when JabRef is opened on a second, extended screen [#11323](https://github.com/JabRef/jabref/issues/11323), [#11174](https://github.com/JabRef/jabref/issues/11174)

### Removed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ public void initContextMenu(final Supplier<List<MenuItem>> items) {
setOnContextMenuRequested(event -> {
contextMenu.getItems().setAll(EditorContextAction.getDefaultContextMenuItems(this, Globals.getKeyPrefs()));
contextMenu.getItems().addAll(0, items.get());

TextInputControlBehavior.showContextMenu(this, contextMenu, event);
contextMenu.show(this, event.getScreenX(), event.getScreenY());
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ public void initContextMenu(final Supplier<List<MenuItem>> items) {
setOnContextMenuRequested(event -> {
contextMenu.getItems().setAll(EditorContextAction.getDefaultContextMenuItems(this, Globals.getKeyPrefs()));
contextMenu.getItems().addAll(0, items.get());

TextInputControlBehavior.showContextMenu(this, contextMenu, event);
contextMenu.show(this, event.getScreenX(), event.getScreenY());
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public OptionEditor(OptionEditorViewModel<T> viewModel) {
comboBox.getEditor().setOnContextMenuRequested(event -> {
ContextMenu contextMenu = new ContextMenu();
contextMenu.getItems().setAll(EditorContextAction.getDefaultContextMenuItems(comboBox.getEditor(), Globals.getKeyPrefs()));
TextInputControlBehavior.showContextMenu(comboBox.getEditor(), contextMenu, event);
contextMenu.show(comboBox, event.getScreenX(), event.getScreenY());
});
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import javafx.util.StringConverter;

import org.jabref.gui.Globals;
import org.jabref.gui.fieldeditors.TextInputControlBehavior;
import org.jabref.gui.fieldeditors.contextmenu.EditorContextAction;
import org.jabref.gui.util.BindingsHelper;
import org.jabref.model.entry.Date;
Expand All @@ -28,18 +27,18 @@
/**
* A date picker with configurable datetime format where both date and time can be changed via the text field and the
* date can additionally be changed via the JavaFX default date picker. Also supports incomplete dates.
*
* <p>
* First recall how the date picker normally works: - The user selects a date in the popup, which sets {@link
* #valueProperty()} to the selected date. - The converter ({@link #converterProperty()}) is used to transform the date
* to a string representation and display it in the text field.
*
* <p>
* The idea is now to intercept the process and add an additional step: - The user selects a date in the popup, which
* sets {@link #valueProperty()} to the selected date. - The date is converted to a {@link TemporalAccessor} (i.e,
* enriched by a time component) using {@link #addCurrentTime(LocalDate)} - The string converter ({@link
* #stringConverterProperty()}) is used to transform the temporal accessor to a string representation and display it in
* the text field.
*
* Inspiration taken from https://github.com/edvin/tornadofx-controls/blob/master/src/main/java/tornadofx/control/DateTimePicker.java
* <p>
* Inspiration taken from <a href="https://github.com/edvin/tornadofx-controls/blob/master/src/main/java/tornadofx/control/DateTimePicker.java">Controlsfx DateTimePicker</a>
*/
public class TemporalAccessorPicker extends DatePicker {
private final ObjectProperty<TemporalAccessor> temporalAccessorValue = new SimpleObjectProperty<>(null);
Expand All @@ -58,7 +57,7 @@ public TemporalAccessorPicker() {
getEditor().setOnContextMenuRequested(event -> {
ContextMenu contextMenu = new ContextMenu();
contextMenu.getItems().setAll(EditorContextAction.getDefaultContextMenuItems(getEditor(), Globals.getKeyPrefs()));
TextInputControlBehavior.showContextMenu(getEditor(), contextMenu, event);
contextMenu.show(this, event.getScreenX(), event.getScreenY());
});
}

Expand Down
Loading