Verified Owner
Top Description Fields Constructors Methods
org.jabref.gui

public Class JabRefDialogService

extends Object
implements DialogService
Class Inheritance
All Implemented Interfaces
org.jabref.gui.DialogService
Annotations
@NullMarked
Imports
java.io.File, .IOException, java.nio.file.FileSystem, .FileSystems, .Path, java.util.Collection, .List, .Map, .Optional, java.util.function.Consumer, javafx.application.Platform, javafx.collections.ObservableList, javafx.concurrent.Task, javafx.print.PrinterJob, javafx.scene.Group, .Node, javafx.scene.control.Alert.AlertType, .Button, .ButtonBar, .ButtonType, .CheckBox, .ChoiceDialog, .ComboBox, .Dialog, .DialogPane, .Label, .TextArea, .TextInputDialog, .Tooltip, javafx.scene.layout.HBox, .Region, .VBox, javafx.stage.DirectoryChooser, .FileChooser, .Modality, .Stage, .Window, .WindowEvent, javafx.util.Duration, .StringConverter, org.jabref.gui.icon.IconTheme, org.jabref.gui.theme.ThemeManager, org.jabref.gui.util.BaseDialog, .DirectoryDialogConfiguration, .FileDialogConfiguration, .UiTaskExecutor, .ZipFileChooser, org.jabref.gui.walkthrough.WalkthroughPane, org.jabref.logic.importer.FetcherClientException, .FetcherException, .FetcherServerException, org.jabref.logic.l10n.Localization, org.jabref.model.http.SimpleHttpResponse, com.dlsc.gemsfx.infocenter.Notification, .NotificationGroup, com.tobiasdiez.easybind.EasyBind, org.controlsfx.control.TaskProgressView, org.controlsfx.control.textfield.CustomPasswordField, org.controlsfx.dialog.ExceptionDialog, .ProgressDialog, org.jspecify.annotations.NullMarked, org.slf4j.Logger, .LoggerFactory

This class provides methods to create default JavaFX dialogs which will also work on top of Swing windows. The created dialogs are instances of the FXDialog class. The available dialogs in this class are useful for displaying small information graphic dialogs rather than complex windows. For more complex dialogs it is advised to rather create a new sub class of FXDialog.

Field Summary

Modifier and TypeField and Description
public static final int
private final NotificationGroup<Object, Notifications.DonationNotification>
private final NotificationGroup<Path, Notifications.FileNotification>
private static final Logger
private final Window
private final ObservableList<Notification<?>>
private final NotificationGroup<Task<?>, Notifications.TaskNotification>
private final NotificationGroup<Object, Notifications.UiNotification>
private final NotificationGroup<Object, Notification<Object>>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static void
addWalkthroughPane(Dialog<?> dialog)

A stock JavaFX dialog, unlike a BaseDialog, does not bring the pane a walkthrough draws into, and the "Download from URL" walkthrough steps into the input dialog.

private <T> ChoiceDialog<T>
createChoiceDialog(String title, String content, String okButtonLabel, T defaultChoice, Collection<T> choices)

private FXDialog
createDialog(Alert.AlertType type, String title, String content)

private FXDialog
createDialogWithOptOut(String title, String content, String optOutMessage, Consumer<Boolean> optOutAction)

private <V> ProgressDialog
createProgressDialog(String title, String content, Task<V> task)

private DirectoryChooser
private FileChooser
private String
getContentByCode(int statusCode)

public List<NotificationGroup<?, ? extends Notification<?>>>
public ObservableList<? extends Notification<?>>
public void
notify(String message)

public void
notify(Notification<?> notification)

Implements org.jabref.gui.DialogService.notify.

Notify the user in a non-blocking way (e.g. a toast).

public static String
public Optional<ButtonType>
showBackgroundProgressDialogAndWait(String title, String content, StateManager stateManager)

Implements org.jabref.gui.DialogService.showBackgroundProgressDialogAndWait.

Constructs and shows a dialog showing the progress of running background tasks.

public <T> Optional<T>
showChoiceDialogAndWait(String title, String content, String okButtonLabel, T defaultChoice, Collection<T> choices)

Implements org.jabref.gui.DialogService.showChoiceDialogAndWait.

This will create and display new javafx.scene.control.ChoiceDialog of type T with a default choice and a collection of possible choices

public boolean
showConfirmationDialogAndWait(String title, String content)

Implements org.jabref.gui.DialogService.showConfirmationDialogAndWait.

This will create and display a new confirmation dialog.

public boolean
showConfirmationDialogAndWait(String title, String content, String okButtonLabel)

Implements org.jabref.gui.DialogService.showConfirmationDialogAndWait.

Create and display a new confirmation dialog.

public boolean
showConfirmationDialogAndWait(String title, String content, String okButtonLabel, String cancelButtonLabel)

Implements org.jabref.gui.DialogService.showConfirmationDialogAndWait.

Create and display a new confirmation dialog.

public boolean
showConfirmationDialogWithOptOutAndWait(String title, String content, String optOutMessage, Consumer<Boolean> optOutAction)

Implements org.jabref.gui.DialogService.showConfirmationDialogWithOptOutAndWait.

Create and display a new confirmation dialog.

public boolean
showConfirmationDialogWithOptOutAndWait(String title, String content, String okButtonLabel, String cancelButtonLabel, String optOutMessage, Consumer<Boolean> optOutAction)

Implements org.jabref.gui.DialogService.showConfirmationDialogWithOptOutAndWait.

Create and display a new confirmation dialog.

public Optional<ButtonType>
showCustomButtonDialogAndWait(Alert.AlertType type, String title, String content, ButtonType... buttonTypes)

Implements org.jabref.gui.DialogService.showCustomButtonDialogAndWait.

This will create and display a new dialog of the specified Alert.AlertType but with user defined buttons as optional ButtonTypes.

public Optional<ButtonType>
showCustomButtonDialogWithTooltipsAndWait(Alert.AlertType type, String title, String content, Map<ButtonType, String> tooltips, ButtonType... buttonTypes)

Implements org.jabref.gui.DialogService.showCustomButtonDialogWithTooltipsAndWait.

This will create and display a new dialog showing a custom DialogPane using custom ButtonTypes, and attaches optional javafx.scene.control.Tooltips to the buttons.

public void
showCustomDialog(BaseDialog<?> dialogView)

Implements org.jabref.gui.DialogService.showCustomDialog.

Shows a custom dialog without returning any results.

public Optional<ButtonType>
showCustomDialogAndWait(String title, DialogPane contentPane, ButtonType... buttonTypes)

Implements org.jabref.gui.DialogService.showCustomDialogAndWait.

This will create and display a new dialog showing a custom DialogPane and using custom ButtonTypes.

public <R> Optional<R>
showCustomDialogAndWait(Dialog<R> dialog)

Implements org.jabref.gui.DialogService.showCustomDialogAndWait.

Shows a custom dialog and returns the result.

public void
showCustomDialogModal(BaseDialog<?> dialog)

Implements org.jabref.gui.DialogService.showCustomDialogModal.

Shows a custom dialog as a window: does not block the main window.

public Optional<Path>
showDirectorySelectionDialog(DirectoryDialogConfiguration directoryDialogConfiguration)

Implements org.jabref.gui.DialogService.showDirectorySelectionDialog.

Shows a new directory selection dialog.

public <T> Optional<T>
showEditableChoiceDialogAndWait(String title, String content, String okButtonLabel, T defaultChoice, Collection<T> choices, StringConverter<T> converter)

Implements org.jabref.gui.DialogService.showEditableChoiceDialogAndWait.

public void
showErrorDialogAndWait(String title, String content)

Implements org.jabref.gui.DialogService.showErrorDialogAndWait.

This will create and display a new error dialog.

public void
showErrorDialogAndWait(String message, Throwable exception)

Implements org.jabref.gui.DialogService.showErrorDialogAndWait.

Create and display error dialog displaying the given exception.

public void
showErrorDialogAndWait(Exception exception)

Implements org.jabref.gui.DialogService.showErrorDialogAndWait.

Create and display error dialog displaying the given exception.

public void
public void
showErrorDialogAndWait(String title, String content, Throwable exception)

Implements org.jabref.gui.DialogService.showErrorDialogAndWait.

Create and display error dialog displaying the given exception.

public void
showErrorDialogAndWait(String message)

Implements org.jabref.gui.DialogService.showErrorDialogAndWait.

Create and display error dialog displaying the given message.

public Optional<Path>
showFileOpenDialog(FileDialogConfiguration fileDialogConfiguration)

Implements org.jabref.gui.DialogService.showFileOpenDialog.

Shows a new file open dialog.

public Optional<Path>
showFileOpenDialog(FileDialogConfiguration fileDialogConfiguration, Window owner)

Implements org.jabref.gui.DialogService.showFileOpenDialog.

Shows a new file open dialog.

public List<Path>
public Optional<Path>
showFileOpenFromArchiveDialog(Path archivePath)

Implements org.jabref.gui.DialogService.showFileOpenFromArchiveDialog.

Shows a new dialog that list all files contained in the given archive and which lets the user select one of these files.

public Optional<Path>
showFileSaveDialog(FileDialogConfiguration fileDialogConfiguration)

Implements org.jabref.gui.DialogService.showFileSaveDialog.

Shows a new file save dialog.

public void
showInformationDialogAndWait(String title, String content)

Implements org.jabref.gui.DialogService.showInformationDialogAndWait.

This will create and display a new information dialog.

public Optional<String>
showInputDialogAndWait(String title, String content)

Implements org.jabref.gui.DialogService.showInputDialogAndWait.

This will create and display new javafx.scene.control.TextInputDialog with a text fields to enter data

public Optional<String>
showInputDialogWithDefaultAndWait(String title, String content, String defaultValue)

Implements org.jabref.gui.DialogService.showInputDialogWithDefaultAndWait.

This will create and display new javafx.scene.control.TextInputDialog with a text field with a default value to enter data

public Optional<String>
showPasswordDialogAndWait(String title, String header, String content)

Implements org.jabref.gui.DialogService.showPasswordDialogAndWait.

This will create and display new org.controlsfx.control.textfield.CustomPasswordField that doesn't show the text, and two buttons one cancel and one ok.

public boolean
public <V> void
public <V> void
public void
showWarningDialogAndWait(String title, String content)

Implements org.jabref.gui.DialogService.showWarningDialogAndWait.

This will create and display a new information dialog.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait