Top Description Methods
org.jabref.gui

public Interface DialogService

extends NotificationService
Known Direct Implementers
org.jabref.gui.JabRefDialogService
Imports
java.io.IOException, java.nio.file.Path, java.util.Collection, .List, .Optional, java.util.function.Consumer, javafx.concurrent.Task, javafx.print.PrinterJob, javafx.scene.control.Alert, .ButtonType, .ChoiceDialog, .Dialog, .DialogPane, .TextInputDialog, javafx.util.StringConverter, org.jabref.gui.util.BaseDialog, .BaseWindow, .DirectoryDialogConfiguration, .FileDialogConfiguration, org.jabref.logic.importer.FetcherException, org.jabref.logic.util.NotificationService, org.controlsfx.control.textfield.CustomPasswordField, org.controlsfx.dialog.ProgressDialog

This interface provides methods to create dialogs and show them to the user.

Method Summary

Modifier and TypeMethod and Description
public <V> Optional<ButtonType>
showBackgroundProgressDialogAndWait(String
title of the dialog
title
,
String
message to show below the list of background tasks
content
,
StateManager
The StateManager which contains the background tasks
stateManager
)

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)

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

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

This will create and display new ChoiceDialog of type T with a collection of possible choices

public boolean

Returns:

true if the use clicked "OK" otherwise false
showConfirmationDialogAndWait
(String title, String content)

This will create and display a new confirmation dialog.

public boolean

Returns:

true if the use clicked "OK" otherwise false
showConfirmationDialogAndWait
(String title, String content, String okButtonLabel)

Create and display a new confirmation dialog.

public boolean

Returns:

true if the use clicked "OK" otherwise false
showConfirmationDialogAndWait
(String title, String content, String okButtonLabel, String cancelButtonLabel)

Create and display a new confirmation dialog.

public boolean

Returns:

true if the use clicked "YES" otherwise false
showConfirmationDialogWithOptOutAndWait
(String title, String content, String optOutMessage, Consumer<Boolean> optOutAction)

Create and display a new confirmation dialog.

public boolean

Returns:

true if the use clicked "YES" otherwise false
showConfirmationDialogWithOptOutAndWait
(String title, String content, String okButtonLabel, String cancelButtonLabel, String optOutMessage, Consumer<Boolean> optOutAction)

Create and display a new confirmation dialog.

public Optional<ButtonType>

Returns:

Optional with the pressed Button as ButtonType
showCustomButtonDialogAndWait
(Alert.AlertType type, String title, String content, ButtonType... buttonTypes)

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

public void
showCustomDialog(BaseDialog<?>
dialog to show
dialog
)

Shows a custom dialog without returning any results.

public Optional<ButtonType>

Returns:

Optional with the pressed Button as ButtonType
showCustomDialogAndWait
(String title, DialogPane contentPane, ButtonType... buttonTypes)

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

public <
type of result
R
>
Optional<R>
showCustomDialogAndWait(Dialog<R>
dialog to show
dialog
)

Shows a custom dialog and returns the result.

public void
showCustomWindow(BaseWindow
window to show
window
)

Shows a custom window.

public Optional<Path>

Returns:

the selected directory or an empty Optional if no directory has been selected
showDirectorySelectionDialog
(DirectoryDialogConfiguration directoryDialogConfiguration)

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)

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

public void
showErrorDialogAndWait(String title, String content)

This will create and display a new error dialog.

public void
showErrorDialogAndWait(String
the error message
message
,
Throwable
the exception causing the error
exception
)

Create and display error dialog displaying the given exception.

public void
showErrorDialogAndWait(Exception
the exception causing the error
exception
)

Create and display error dialog displaying the given exception.

public void
public void
showErrorDialogAndWait(String title, String content, Throwable
the exception causing the error
exception
)

Create and display error dialog displaying the given exception.

public void
showErrorDialogAndWait(String
the error message
message
)

Create and display error dialog displaying the given message.

public Optional<Path>

Returns:

the selected file or an empty Optional if no file has been selected
showFileOpenDialog
(FileDialogConfiguration fileDialogConfiguration)

Shows a new file open dialog.

public List<Path>

Returns:

the selected files or an empty List if no file has been selected
showFileOpenDialogAndGetMultipleFiles
(FileDialogConfiguration fileDialogConfiguration)

Shows a new file open dialog.

public Optional<Path>

Returns:

the selected file or an empty Optional if no file has been selected
showFileOpenFromArchiveDialog
(Path archivePath)

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>

Returns:

the selected file or an empty Optional if no file has been selected
showFileSaveDialog
(FileDialogConfiguration fileDialogConfiguration)

Shows a new file save dialog.

public void
showInformationDialogAndWait(String title, String content)

This will create and display a new information dialog.

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

This will create and display new TextInputDialog with a text fields to enter data

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

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

public Optional<String>

Returns:

the entered password if pressed "OK", null otherwise
showPasswordDialogAndWait
(String title, String header, String content)

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

public boolean

Returns:

false if the user opts to cancel printing
showPrintDialog
(PrinterJob
the print job to customize
job
)

Displays a Print Dialog.

public <V> void
showProgressDialog(String
title of the dialog
title
,
String
message to show above the progress bar
content
,
Task<V>
The Task which executes the work and for which to show the dialog
task
)

Constructs and shows a cancelable ProgressDialog.

public <V> void
showProgressDialogAndWait(String
title of the dialog
title
,
String
message to show above the progress bar
content
,
Task<V>
The Task which executes the work and for which to show the dialog
task
)

Constructs and shows a cancelable ProgressDialog.

public void
showWarningDialogAndWait(String title, String content)

This will create and display a new information dialog.

Inherited from org.jabref.logic.util.NotificationService:
notify

Method Detail

showBackgroundProgressDialogAndWaitback to summary
public <V> Optional<ButtonType> showBackgroundProgressDialogAndWait(String title, String content, StateManager stateManager)

Constructs and shows a dialog showing the progress of running background tasks. Clicking cancel will cancel the underlying service and close the dialog. The dialog will exit as soon as none of the background tasks are running

Parameters
title:String

title of the dialog

content:String

message to show below the list of background tasks

stateManager:StateManager

The StateManager which contains the background tasks

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

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

Implementation Note

The implementation should accept null for defaultChoice, but callers should use showChoiceDialogAndWait(String, String, String, Collection).

showChoiceDialogAndWaitback to summary
public default <T> Optional<T> showChoiceDialogAndWait(String title, String content, String okButtonLabel, Collection<T> choices)

This will create and display new ChoiceDialog of type T with a collection of possible choices

showConfirmationDialogAndWaitback to summary
public boolean showConfirmationDialogAndWait(String title, String content)

This will create and display a new confirmation dialog. It will include a blue question icon on the left and a OK and Cancel button. To create a confirmation dialog with custom buttons see also showCustomButtonDialogAndWait(Alert.AlertType, String, String, ButtonType...)

Returns:boolean

true if the use clicked "OK" otherwise false

showConfirmationDialogAndWaitback to summary
public boolean showConfirmationDialogAndWait(String title, String content, String okButtonLabel)

Create and display a new confirmation dialog. It will include a blue question icon on the left and a OK (with given label) and Cancel button. To create a confirmation dialog with custom buttons see also showCustomButtonDialogAndWait(Alert.AlertType, String, String, ButtonType...).

Returns:boolean

true if the use clicked "OK" otherwise false

showConfirmationDialogAndWaitback to summary
public boolean showConfirmationDialogAndWait(String title, String content, String okButtonLabel, String cancelButtonLabel)

Create and display a new confirmation dialog. It will include a blue question icon on the left and a OK (with given label) and Cancel (also with given label) button. To create a confirmation dialog with custom buttons see also showCustomButtonDialogAndWait(Alert.AlertType, String, String, ButtonType...).

Returns:boolean

true if the use clicked "OK" otherwise false

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

Create and display a new confirmation dialog. It will include a blue question icon on the left and a YES (with given label) and Cancel (also with given label) button. To create a confirmation dialog with custom buttons see also showCustomButtonDialogAndWait(Alert.AlertType, String, String, ButtonType...). Moreover, the dialog contains a opt-out checkbox with the given text to support "Do not ask again"-behaviour.

Returns:boolean

true if the use clicked "YES" otherwise false

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

Create and display a new confirmation dialog. It will include a blue question icon on the left and a YES (with given label) and Cancel (also with given label) button. To create a confirmation dialog with custom buttons see also showCustomButtonDialogAndWait(Alert.AlertType, String, String, ButtonType...). Moreover, the dialog contains a opt-out checkbox with the given text to support "Do not ask again"-behaviour.

Returns:boolean

true if the use clicked "YES" otherwise false

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

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

Returns:Optional<ButtonType>

Optional with the pressed Button as ButtonType

showCustomDialogback to summary
public void showCustomDialog(BaseDialog<?> dialog)

Shows a custom dialog without returning any results.

Parameters
dialog:BaseDialog<?>

dialog to show

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

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

Returns:Optional<ButtonType>

Optional with the pressed Button as ButtonType

showCustomDialogAndWaitback to summary
public <R> Optional<R> showCustomDialogAndWait(Dialog<R> dialog)

Shows a custom dialog and returns the result.

Parameters
<R>
type of result
dialog:Dialog<R>

dialog to show

showCustomWindowback to summary
public void showCustomWindow(BaseWindow window)

Shows a custom window.

Parameters
window:BaseWindow

window to show

showDirectorySelectionDialogback to summary
public Optional<Path> showDirectorySelectionDialog(DirectoryDialogConfiguration directoryDialogConfiguration)

Shows a new directory selection dialog. The method doesn't return until the displayed open dialog is dismissed. The return value specifies the file chosen by the user or an empty Optional if no selection has been made.

Returns:Optional<Path>

the selected directory or an empty Optional if no directory has been selected

showEditableChoiceDialogAndWaitback to summary
public <T> Optional<T> showEditableChoiceDialogAndWait(String title, String content, String okButtonLabel, T defaultChoice, Collection<T> choices, StringConverter<T> converter)
showEditableChoiceDialogAndWaitback to summary
public default <T> Optional<T> showEditableChoiceDialogAndWait(String title, String content, String okButtonLabel, Collection<T> choices, StringConverter<T> converter)
showErrorDialogAndWaitback to summary
public void showErrorDialogAndWait(String title, String content)

This will create and display a new error dialog. It will include a red error icon on the left and a single OK Button. To create a error dialog with custom buttons see also showCustomButtonDialogAndWait(Alert.AlertType, String, String, ButtonType...)

showErrorDialogAndWaitback to summary
public void showErrorDialogAndWait(String message, Throwable exception)

Create and display error dialog displaying the given exception.

Parameters
message:String

the error message

exception:Throwable

the exception causing the error

showErrorDialogAndWaitback to summary
public void showErrorDialogAndWait(Exception exception)

Create and display error dialog displaying the given exception.

Parameters
exception:Exception

the exception causing the error

showErrorDialogAndWaitback to summary
public void showErrorDialogAndWait(FetcherException fetcherException)
showErrorDialogAndWaitback to summary
public void showErrorDialogAndWait(String title, String content, Throwable exception)

Create and display error dialog displaying the given exception.

Parameters
exception:Throwable

the exception causing the error

showErrorDialogAndWaitback to summary
public void showErrorDialogAndWait(String message)

Create and display error dialog displaying the given message.

Parameters
message:String

the error message

showFileOpenDialogback to summary
public Optional<Path> showFileOpenDialog(FileDialogConfiguration fileDialogConfiguration)

Shows a new file open dialog. The method doesn't return until the displayed open dialog is dismissed. The return value specifies the file chosen by the user or an empty Optional if no selection has been made. After a file was selected, the given file dialog configuration is updated with the selected extension type (if any).

Returns:Optional<Path>

the selected file or an empty Optional if no file has been selected

showFileOpenDialogAndGetMultipleFilesback to summary
public List<Path> showFileOpenDialogAndGetMultipleFiles(FileDialogConfiguration fileDialogConfiguration)

Shows a new file open dialog. The method doesn't return until the displayed open dialog is dismissed. The return value specifies the files chosen by the user or an empty List if no selection has been made.

Returns:List<Path>

the selected files or an empty List if no file has been selected

showFileOpenFromArchiveDialogback to summary
public Optional<Path> showFileOpenFromArchiveDialog(Path archivePath) throws IOException

Shows a new dialog that list all files contained in the given archive and which lets the user select one of these files. The method doesn't return until the displayed open dialog is dismissed. The return value specifies the file chosen by the user or an empty Optional if no selection has been made.

Returns:Optional<Path>

the selected file or an empty Optional if no file has been selected

showFileSaveDialogback to summary
public Optional<Path> showFileSaveDialog(FileDialogConfiguration fileDialogConfiguration)

Shows a new file save dialog. The method doesn't return until the displayed file save dialog is dismissed. The return value specifies the file chosen by the user or an empty Optional if no selection has been made. After a file was selected, the given file dialog configuration is updated with the selected extension type (if any).

Returns:Optional<Path>

the selected file or an empty Optional if no file has been selected

showInformationDialogAndWaitback to summary
public void showInformationDialogAndWait(String title, String content)

This will create and display a new information dialog. It will include a blue information icon on the left and a single OK Button. To create an information dialog with custom buttons see also showCustomButtonDialogAndWait(Alert.AlertType, String, String, ButtonType...)

showInputDialogAndWaitback to summary
public Optional<String> showInputDialogAndWait(String title, String content)

This will create and display new TextInputDialog with a text fields to enter data

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

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

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

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

Returns:Optional<String>

the entered password if pressed "OK", null otherwise

showPrintDialogback to summary
public boolean showPrintDialog(PrinterJob job)

Displays a Print Dialog. Allow the user to update job state such as printer and settings. These changes will be available in the appropriate properties after the print dialog has returned. The print dialog is also used to confirm the user wants to proceed with printing.

Parameters
job:PrinterJob

the print job to customize

Returns:boolean

false if the user opts to cancel printing

showProgressDialogback to summary
public <V> void showProgressDialog(String title, String content, Task<V> task)

Constructs and shows a cancelable ProgressDialog. Clicking cancel will cancel the underlying service and close the dialog

Parameters
title:String

title of the dialog

content:String

message to show above the progress bar

task:Task<V>

The Task which executes the work and for which to show the dialog

showProgressDialogAndWaitback to summary
public <V> void showProgressDialogAndWait(String title, String content, Task<V> task)

Constructs and shows a cancelable ProgressDialog. Clicking cancel will cancel the underlying service and close the dialog, otherwise will wait for the task to finish.

Parameters
title:String

title of the dialog

content:String

message to show above the progress bar

task:Task<V>

The Task which executes the work and for which to show the dialog

showWarningDialogAndWaitback to summary
public void showWarningDialogAndWait(String title, String content)

This will create and display a new information dialog. It will include a yellow warning icon on the left and a single OK Button. To create a warning dialog with custom buttons see also showCustomButtonDialogAndWait(Alert.AlertType, String, String, ButtonType...)