Module qupath.fx

Class Dialogs

java.lang.Object
qupath.fx.dialogs.Dialogs

public class Dialogs extends Object
Collection of static methods to help with showing information to a user, as well as requesting some basic input.

In general, 'showABCMessage' produces a dialog box that requires input from the user. By contrast, 'showABCNotification' shows a notification message that will disappear without user input - but only if ControlsFX is available. If ControlsFX is not available, the notification will be shown as a non-blocking dialog box.

Important! > It is recommended to call #setPrimaryWindow(Window) before using any of these methods, to help ensure that the dialogs are shown in the correct place when an owner is not specified.

  • Constructor Details

    • Dialogs

      public Dialogs()
  • Method Details

    • setPrimaryWindow

      public static void setPrimaryWindow(javafx.stage.Window window)
      Set the primary window, which will be used as the owner of dialogs if no other window takes precedence (e.g. because it is modal or in focus).
      Parameters:
      window -
      See Also:
    • getPrimaryWindow

      public static javafx.stage.Window getPrimaryWindow()
      Get the primary window.
      Returns:
      See Also:
    • getKnownFileExtensions

      public static javafx.collections.ObservableList<String> getKnownFileExtensions()
      Get a modifiable list of known file extensions. This exists to make it possible to override the logic of 'everything after the last dot is the file extension', and support multi-part extensions such as .tar.gz or .ome.tif.
      Returns:
    • showConfirmDialog

      public static boolean showConfirmDialog(String title, String text)
      Show a confirm dialog (OK/Cancel).
      Parameters:
      title -
      text -
      Returns:
    • showMessageDialog

      public static boolean showMessageDialog(String title, javafx.scene.Node node)
      Show a message dialog (OK button only), with the content contained within a Node.
      Parameters:
      title -
      node -
      Returns:
    • showMessageDialog

      public static boolean showMessageDialog(String title, String message)
      Show a standard message dialog.
      Parameters:
      title -
      message -
      Returns:
    • showConfirmDialog

      public static boolean showConfirmDialog(String title, javafx.scene.Node node)
      Show a confirm dialog (OK/Cancel).
      Parameters:
      title -
      node -
      Returns:
    • showYesNoDialog

      public static boolean showYesNoDialog(String title, String text)
      Show a Yes/No dialog.
      Parameters:
      title -
      text -
      Returns:
    • showYesNoCancelDialog

      public static javafx.scene.control.ButtonType showYesNoCancelDialog(String title, String text)
      Show a Yes/No/Cancel dialog.
      Parameters:
      title - dialog box title
      text - prompt message
      Returns:
      a ButtonType of YES, NO or CANCEL
    • showInputDialog

      public static Double showInputDialog(String title, String message, Double initialInput)
      Show an input dialog requesting a numeric value. Only scientific notation and digits with/without a decimal separator (e.g. ".") are permitted.

      The returned value might still not be in a valid state, as limited by FXUtils.restrictTextFieldInputToNumber(javafx.scene.control.TextField, boolean).

      Parameters:
      title -
      message -
      initialInput -
      Returns:
      Number input by the user, or NaN if no valid number was entered, or null if cancel was pressed.
      See Also:
    • showInputDialog

      public static String showInputDialog(String title, String message, String initialInput)
      Show an input dialog requesting a String input.
      Parameters:
      title -
      message -
      initialInput -
      Returns:
    • showChoiceDialog

      public static <T> T showChoiceDialog(String title, String message, T[] choices, T defaultChoice)
      Show a choice dialog with an array of choices (selection from ComboBox or similar).
      Type Parameters:
      T -
      Parameters:
      title - dialog title
      message - dialog prompt
      choices - array of available options
      defaultChoice - initial selected option
      Returns:
      chosen option, or null if the user cancels the dialog
    • showChoiceDialog

      public static <T> T showChoiceDialog(String title, String message, Collection<T> choices, T defaultChoice)
      Show a choice dialog with a collection of choices (selection from ComboBox or similar).
      Type Parameters:
      T -
      Parameters:
      title - dialog title
      message - dialog prompt
      choices - list of available options
      defaultChoice - initial selected option
      Returns:
      chosen option, or null if the user cancels the dialog
    • showErrorMessage

      public static void showErrorMessage(String title, Throwable e)
      Show an error message, displaying the localized message of a Throwable.
      Parameters:
      title -
      e -
    • showErrorNotification

      public static void showErrorNotification(String title, Throwable e)
      Show an error notification, displaying the localized message of a Throwable.
      Parameters:
      title -
      e -
    • showErrorNotification

      public static void showErrorNotification(String title, String message)
      Show an error notification.
      Parameters:
      title -
      message -
    • showWarningNotification

      public static void showWarningNotification(String title, String message)
      Show a warning notification.
      Parameters:
      title -
      message -
    • showInfoNotification

      public static void showInfoNotification(String title, String message)
      Show an info notification.
      Parameters:
      title -
      message -
    • showPlainNotification

      public static void showPlainNotification(String title, String message)
      Show a plain notification.
      Parameters:
      title -
      message -
    • showErrorMessage

      public static void showErrorMessage(String title, String message)
      Show an error message.
      Parameters:
      title -
      message -
    • showErrorMessage

      public static void showErrorMessage(String title, javafx.scene.Node node)
      Show an error message, with the content defined within a Node.
      Parameters:
      title -
      node -
    • showPlainMessage

      public static void showPlainMessage(String title, String message)
      Show a plain message.
      Parameters:
      title -
      message -
    • showTextWindow

      public static void showTextWindow(javafx.stage.Window owner, String title, String contents, javafx.stage.Modality modality, boolean isEditable)
      Show a window containing plain text, with the specified properties.
      Parameters:
      owner -
      title -
      contents -
      modality -
      isEditable -
    • builder

      public static Dialogs.Builder builder()
      Create a new builder to generate a custom dialog.
      Returns:
    • main

      public static void main(String[] args)