java.lang.Object
is.codion.swing.common.ui.dialog.Dialogs

public final class Dialogs extends Object
A utility class for displaying Dialogs.
  • Method Details

    • componentDialog

      public static ComponentDialogBuilder componentDialog(JComponent component)
      Parameters:
      component - the component to display
      Returns:
      a new ComponentDialogBuilder instance.
    • progressDialog

      public static ProgressDialog.Builder progressDialog()
      Returns:
      a new ProgressDialog.Builder instance.
    • progressWorkerDialog

      public static ProgressWorkerDialogBuilder<?,?> progressWorkerDialog(Control.Command task)
      Parameters:
      task - the task to run
      Returns:
      a new ProgressWorkerDialogBuilder instance
    • progressWorkerDialog

      public static <T> ProgressWorkerDialogBuilder<T,?> progressWorkerDialog(is.codion.swing.common.model.worker.ProgressWorker.Task<T> task)
      Type Parameters:
      T - the worker result type
      Parameters:
      task - the task to run
      Returns:
      a new ProgressWorkerDialogBuilder instance
    • progressWorkerDialog

      public static <T, V> ProgressWorkerDialogBuilder<T,V> progressWorkerDialog(is.codion.swing.common.model.worker.ProgressWorker.ProgressTask<T,V> task)
      Note, also sets the progress bar type to 'determinate'.
      Type Parameters:
      T - the worker result type
      V - the worker intermediate result type
      Parameters:
      task - the task to run
      Returns:
      a new ProgressWorkerDialogBuilder instance
      See Also:
    • loginDialog

      public static LoginDialogBuilder loginDialog()
      Returns:
      a new login dialog builder
    • exceptionDialog

      public static ExceptionDialogBuilder exceptionDialog()
      Returns:
      a new exception dialog builder
    • fileSelectionDialog

      public static FileSelectionDialogBuilder fileSelectionDialog()
      Returns:
      a new FileSelectionDialogBuilder
    • selectionDialog

      public static <T> SelectionDialogBuilder<T> selectionDialog(Collection<T> values)
      Type Parameters:
      T - the value type
      Parameters:
      values - the values to select from
      Returns:
      a new selection dialog builder
      Throws:
      IllegalArgumentException - in case values is empty
    • okCancelDialog

      public static OkCancelDialogBuilder okCancelDialog(JComponent component)
      Parameters:
      component - the component to display
      Returns:
      a new OkCancelDialogBuilder
    • actionDialog

      public static <B extends ActionDialogBuilder<B>> ActionDialogBuilder<B> actionDialog(JComponent component)
      Type Parameters:
      B - the builder type
      Parameters:
      component - the component to display
      Returns:
      a new ActionDialogBuilder
    • calendarDialog

      public static CalendarDialogBuilder calendarDialog()
      Returns:
      a new CalendarDialogBuilder
    • lookAndFeelSelectionDialog

      public static LookAndFeelSelectionDialogBuilder lookAndFeelSelectionDialog()
      Returns:
      a builder for a dialog for selecting a look and feel
    • fontSizeSelectionDialog

      public static FontSizeSelectionDialogBuilder fontSizeSelectionDialog(String userPreferencePropertyName)
      Parameters:
      userPreferencePropertyName - the name of the property to use when saving the selected font size as a user preference
      Returns:
      a builder for a dialog for selecting the font size
    • inputDialog

      public static <T> InputDialogBuilder<T> inputDialog(ComponentValue<T,?> componentValue)
      Type Parameters:
      T - the value type
      Parameters:
      componentValue - the value which component to display
      Returns:
      a builder for a input dialog
    • selector

      public static <T> SelectionDialogBuilder.Selector<T> selector(Supplier<Collection<T>> valueSupplier)
      Returns a SelectionDialogBuilder.Selector implmentation based on a selection dialog.
      Type Parameters:
      T - the type of values being looked up
      Parameters:
      valueSupplier - supplies the values for the selection dialog
      Returns:
      a new SelectionDialogBuilder.Selector based on a selection dialog
    • displayExceptionDialog

      public static void displayExceptionDialog(Throwable exception, Window dialogParent)
      Displays the given exception in a dialog
      Parameters:
      exception - the exception
      dialogParent - the dialog parent window
    • createBrowseAction

      public static Action createBrowseAction(JTextField filenameField)
      Creates an Action instance, with a triple-dot name ('...') for selecting a file path to display in the given text field
      Parameters:
      filenameField - the text field for displaying the file path
      Returns:
      the Action