- java.lang.Object
-
- is.codion.swing.common.ui.dialog.Dialogs
-
public final class Dialogs extends Object
A utility class for displaying Dialogs.
-
-
Method Summary
-
-
-
Method Detail
-
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(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(ProgressWorker.ProgressTask<T,V> task)
Note, also sets the progress bar type to 'determinate'.- Type Parameters:
T
- the worker result typeV
- the worker intermediate result type- Parameters:
task
- the task to run- Returns:
- a new
ProgressWorkerDialogBuilder
instance - See Also:
ProgressWorkerDialogBuilder.indeterminate(boolean)
-
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
-
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
-
selectionProvider
public static <T> SelectionProvider<T> selectionProvider(Supplier<Collection<T>> valueSupplier)
Returns aSelectionProvider
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
SelectionProvider
based on a selection dialog
-
showExceptionDialog
public static void showExceptionDialog(Throwable exception, Window dialogParent)
Displays the given exception in a dialog- Parameters:
exception
- the exceptiondialogParent
- 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
-
-