public final class Dialogs extends Object
JOptionPane but with added functionality.| Modifier and Type | Class and Description |
|---|---|
static class |
Dialogs.DialogAction
Used to specify the properties of a button in a dialog.
|
static class |
Dialogs.DialogIcon
Specifies the icon to display on the left hand side of a dialog.
|
static class |
Dialogs.DialogOptions
A class that speicifies all the options for displaying a dialog.
|
static class |
Dialogs.Result
The result of showing an "apply to all" dialog.
|
static class |
Dialogs.SaveChanges
The options that the user can click on in the dialog shown by
showSaveChangesDialog(String, java.awt.Component). |
| Modifier and Type | Field and Description |
|---|---|
static Dialogs.DialogAction |
CANCEL
An action with "Cancel" as its label.
|
static Dialogs.DialogAction |
CONTINUE
An action with "Continue" as its label.
|
static Dialogs.DialogAction[] |
CONTINUE_CANCEL
Use this to specify that a dialog should have "Continue" and "Cancel" buttons.
|
static String |
DEFAULT_FOCUSED_TEXT_COMPONENT_KEY
By calling
putClientProperty() on a JTextField with this as the key and Boolean.TRUE as the value,
calling code may nominate that field to be the "first" text component, which will be initially selected when the dialog is displayed. |
static String |
DONT_INITIALLY_FOCUS_KEY
By calling
putClientProperty() on a JTextField with this as the key and Boolean.TRUE as the value,
calling code may ensure that this text field never gets initially focussed (showOptionsDialog()
and showTextFieldDialog() automatically focus the topmost, non-flagged textfield in the dialog). |
static Dialogs.DialogAction |
NO
An action with "No" as its label.
|
static Dialogs.DialogAction |
OK
An action with "OK" as its label.
|
static Dialogs.DialogAction[] |
OK_CANCEL
Use this to specify that a dialog should have "OK" and "Cancel" buttons.
|
static Dialogs.DialogAction[] |
OK_ONLY
Use this to specify that a dialog should have just an "OK" button.
|
static Dialogs.DialogAction |
YES
An action with "Yes" as its label.
|
static Dialogs.DialogAction[] |
YES_NO
Use this to specify that a dialog should have "Yes" and "No" buttons.
|
static Dialogs.DialogAction[] |
YES_NO_CANCEL
Use this to specify that a dialog should have "Yes", "No" and "Cancel" buttons.
|
| Modifier and Type | Method and Description |
|---|---|
static JComponent |
createTextComponentForDialog(String message,
boolean isHtml,
Dialogs.DialogOptions dialogOptions)
Create a component to display a String message in a dialog.
|
static Dialog |
getCurrentModalDialog()
Returns the currently active modal dialog shown by
Dialogs. |
static JTextComponent |
getFirstTextComponent(Container container)
Gets the first text component in this container.
|
static void |
resetAllDialogPreferences()
Reset all the 'Don't ask again' and 'Remember my preference' so that the
dialogs will be shown again.
|
static void |
resetDialogPreference(String preferenceKey)
If the user has previously chosen 'dont ask again' or 'remember my preference' for the given preference key, then
reset it.
|
static void |
setCurrentModalDialog(Dialog modalDialog)
This method can be called just before displaying a modal dialog to let Geneious know that it should avoid popping
up other windows such as progress frames while it is visible.
|
static void |
setDefaultDialogOwner(Window defaultOwner)
FOR INTERNAL USE ONLY, PLUGINS SHOULD NOT CALL THIS METHOD.
|
static Dialogs.Result |
showApplyToAllDialog(Dialogs.DialogOptions options,
String message)
Show a dialog with an "Apply to all" checkbox, which, if checked, signifies that the result from showing this dialog
should be used in all cases
|
static String |
showComboBoxDialog(String message,
String[] values,
String defaultValue,
String title,
Component owner)
Show an OK/Cancel dialog to the user with a non-editable combo-box in it.
|
static boolean |
showContinueCancelDialog(String message,
String title,
Component owner,
Dialogs.DialogIcon dialogIcon)
Show a dialog to the user with "Continue" and "Cancel" buttons.
|
static Object |
showDialog(Dialogs.DialogOptions options,
Component component)
Show a dialog with a custom Component to the user with the specified dialog options.
|
static Object |
showDialog(Dialogs.DialogOptions options,
Component component,
JComponent specialControl)
Show a dialog with a custom component to the user with the specified dialog options.
|
static Object |
showDialog(Dialogs.DialogOptions options,
String message)
Show a dialog with a String message to the user with the specified dialog options.
|
static Object |
showDialog(Dialogs.DialogOptions options,
String message,
JComponent specialControl)
Show a dialog with a String message to the user with the specified dialog options.
|
static Object |
showDialogWithDontShowAgain(Dialogs.DialogOptions options,
Component message,
String preferenceKey,
String checkBoxLabel)
Display a dialog to the user with something like a 'Don't show again' check box.
|
static Object |
showDialogWithDontShowAgain(Dialogs.DialogOptions options,
String message,
String preferenceKey,
String checkBoxLabel)
Display a dialog to the user with something like a 'Don't show again' check box.
|
static Object |
showDialogWithRememberMyPreference(Dialogs.DialogOptions options,
String message,
String preferenceKey,
String checkBoxLabel)
Show a dialog to the user with a 'Remember my preference' check box.
|
static boolean |
showInputDialog(String message,
String title,
Component owner,
JComponent... inputComponents)
Show an OK/Cancel dialog to the user with custom input components.
|
static void |
showMessageDialog(String message)
Show a dialog to the user with a string message and just an "OK" button.
|
static void |
showMessageDialog(String message,
String title)
Show a dialog to the user with a string message and just an "OK" button.
|
static void |
showMessageDialog(String message,
String title,
Component owner,
Dialogs.DialogIcon dialogIcon)
Show a dialog to the user with a string message and just an "OK" button.
|
static Object |
showMoreOptionsDialog(Dialogs.DialogOptions options,
Component basicComponent,
Component advancedComponent)
Show a dialog to the user with two custom components.
|
static Object |
showMoreOptionsDialog(Dialogs.DialogOptions options,
String basicMessage,
String advancedMessage)
Show a dialog to the user with two string messages.
|
static boolean |
showOkCancelDialog(Component component,
String title,
Component owner)
Show a dialog to the user with "OK" and "Cancel" buttons.
|
static boolean |
showOkCancelDialog(Component component,
String title,
Component owner,
Dialogs.DialogIcon dialogIcon)
Show a dialog to the user with "OK" and "Cancel" buttons.
|
static boolean |
showOkCancelDialog(String message,
String title,
Component owner)
Show a dialog to the user with "OK" and "Cancel" buttons.
|
static boolean |
showOkCancelDialog(String message,
String title,
Component owner,
Dialogs.DialogIcon dialogIcon)
Show a dialog to the user with "OK" and "Cancel" buttons.
|
static void |
showOkDialogWithDontShowAgain(Component owner,
String preferenceKey,
String message,
String title)
Display a dialog to the user with only an OK button and a "Don't show this again" check box.
|
static boolean |
showOptionsDialog(Options options,
String dialogTitle,
boolean restoreAndSavePreferences)
Display an options dialog based on an
Options object. |
static boolean |
showOptionsDialog(Options options,
String dialogTitle,
boolean restoreAndSavePreferences,
JComponent owner)
Display an options dialog based on an
Options object. |
static Dialogs.SaveChanges |
showSaveChangesDialog(String note,
Component owner)
Show a save changes dialog that has options equivalent to the values in
Dialogs.SaveChanges. |
static String |
showTextFieldDialog(String message,
String defaultValue,
String title,
Component owner)
Show an OK/Cancel dialog to the user with a text field in it.
|
static boolean |
showYesNoDialog(Component component,
String title,
Component owner,
Dialogs.DialogIcon dialogIcon)
Show a dialog to the user with "Yes" and "No" buttons.
|
static boolean |
showYesNoDialog(String message,
String title,
Component owner,
Dialogs.DialogIcon dialogIcon)
Show a dialog to the user with "Yes" and "No" buttons.
|
static boolean |
showYesNoDialogWithRememberMyPreference(Component owner,
String preferenceKey,
String message,
String title)
Show a dialog to the user with Yes and No buttons and a "Remember my preference" check box.
|
public static final String DEFAULT_FOCUSED_TEXT_COMPONENT_KEY
putClientProperty() on a JTextField with this as the key and Boolean.TRUE as the value,
calling code may nominate that field to be the "first" text component, which will be initially selected when the dialog is displayed.DONT_INITIALLY_FOCUS_KEY,
Constant Field Valuespublic static final String DONT_INITIALLY_FOCUS_KEY
putClientProperty() on a JTextField with this as the key and Boolean.TRUE as the value,
calling code may ensure that this text field never gets initially focussed (showOptionsDialog()
and showTextFieldDialog() automatically focus the topmost, non-flagged textfield in the dialog).public static final Dialogs.DialogAction OK
public static final Dialogs.DialogAction CANCEL
public static final Dialogs.DialogAction YES
public static final Dialogs.DialogAction NO
public static final Dialogs.DialogAction CONTINUE
public static final Dialogs.DialogAction[] OK_ONLY
public static final Dialogs.DialogAction[] OK_CANCEL
public static final Dialogs.DialogAction[] YES_NO
public static final Dialogs.DialogAction[] YES_NO_CANCEL
public static final Dialogs.DialogAction[] CONTINUE_CANCEL
public static boolean showYesNoDialogWithRememberMyPreference(Component owner, String preferenceKey, String message, String title)
resetDialogPreference(String) to have this prompt the user again on next call.
If the dialog is displayed, this method will block until the user has clicked Yes or No.owner - Any component within the Window which will be the owner of this dialog. If null, the currently
focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.preferenceKey - the key used to store the default value if the user checks "Remember my preference"message - message to display in the dialogtitle - title of the dialogpublic static void showOkDialogWithDontShowAgain(Component owner, String preferenceKey, String message, String title)
owner - Any component within the Window which will be the owner of this dialog. If null, the currently
focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.preferenceKey - the key used to remember whether the user chose "Don't show this again"message - Message to display in the dialogtitle - title of the dialogpublic static Object showDialogWithDontShowAgain(Dialogs.DialogOptions options, String message, String preferenceKey, String checkBoxLabel)
Dialogs.DialogOptions.isModal() is true,
This method will block until the user has clicked Ok.options - DialogOptions specifying the properties of the dialogmessage - Message to display in the dialogpreferenceKey - the key used to remember whether the user chose 'Don't show again'checkBoxLabel - The text to use on the 'Don't show again' check box.String or Dialogs.DialogAction)
or null if "don't show again" was previously selected.public static Object showDialogWithDontShowAgain(Dialogs.DialogOptions options, Component message, String preferenceKey, String checkBoxLabel)
Dialogs.DialogOptions.isModal() is true,
This method will block until the user has clicked Ok.options - DialogOptions specifying the properties of the dialogmessage - Message to display in the dialogpreferenceKey - the key used to remember whether the user chose 'Don't show again'checkBoxLabel - The text to use on the 'Don't show again' check box.String or Dialogs.DialogAction)
or null if "don't show again" was previously selected.public static Object showDialogWithRememberMyPreference(Dialogs.DialogOptions options, String message, String preferenceKey, String checkBoxLabel)
resetDialogPreference(String) to have this prompt the user again on next call.
If the dialog is displayed and Dialogs.DialogOptions.isModal() is true,
This method will block until the user has clicked Ok.options - DialogOptions specifying the properties of the dialogmessage - Message to display in the dialogpreferenceKey - the key used to remember whether the user chose 'Don't show again'checkBoxLabel - The text to use on the 'Don't show again' check box.String or Dialogs.DialogAction).public static boolean showOptionsDialog(Options options, String dialogTitle, boolean restoreAndSavePreferences)
Options object.
This method will block until the user has clicked Ok or Cancel.options - the options to be displayeddialogTitle - the title of the dialog (used as a pereference key as well)restoreAndSavePreferences - if true, then we restore Options preferences from persistent storage before the
dialog is displayed and save
them again when they user clicks OK. Otherwise the current option values are used and the results aren't saved to
persistent storage.public static boolean showOptionsDialog(Options options, String dialogTitle, boolean restoreAndSavePreferences, JComponent owner)
Options object.
This method will block until the user has clicked Ok or Cancel.options - the options to be displayeddialogTitle - the title of the dialog (used as a pereference key as well)restoreAndSavePreferences - if true, then we restore Options preferences from persistent storage before the
dialog is displayed and save
them again when they user clicks OK. Otherwise the current option values are used and the results aren't saved to
persistent storage.owner - Any component within the Window which will be the owner of this dialog. If null, the currently focused
document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.
If the Options.getDialogOptions() method of the options passed returns a non-null value, the method will
ignore the owner pass in here in favor of the one from the options.public static Dialogs.Result showApplyToAllDialog(Dialogs.DialogOptions options, String message)
options - the options to be displayedmessage - Message to display in the dialogpublic static void resetDialogPreference(String preferenceKey)
preferenceKey - the preference key to resetshowDialogWithDontShowAgain( com.biomatters.geneious.publicapi.components.Dialogs.DialogOptions , String, String, String),
showDialogWithRememberMyPreference( com.biomatters.geneious.publicapi.components.Dialogs.DialogOptions , String, String, String),
showYesNoDialogWithRememberMyPreference(java.awt.Component, String, String, String),
showOkDialogWithDontShowAgain(java.awt.Component, String, String, String)public static void resetAllDialogPreferences()
resetDialogPreference(String)public static Object showDialog(Dialogs.DialogOptions options, String message)
options - DialogOptions specifying the properties of the dialogmessage - Message to display in the dialogString or Dialogs.DialogAction).public static Object showDialog(Dialogs.DialogOptions options, Component component)
options - DialogOptions specifying the properties of the dialogcomponent - Component to display in the dialogString or Dialogs.DialogAction).public static Object showDialog(Dialogs.DialogOptions options, String message, JComponent specialControl)
options - DialogOptions specifying the properties of the dialogmessage - Message to display in the dialogspecialControl - a component that will be placed in the bottom left. Eg More Options or Dont ask again.String or Dialogs.DialogAction).public static Object showDialog(Dialogs.DialogOptions options, Component component, JComponent specialControl)
options - DialogOptions specifying the properties of the dialogcomponent - Component to display in the dialogspecialControl - a component that will be placed in the bottom left. Eg More Options or Dont ask again.String or Dialogs.DialogAction).public static Dialog getCurrentModalDialog()
Dialogs.public static void setCurrentModalDialog(Dialog modalDialog)
modalDialog - a modal dialog which is about to be displayedIllegalArgumentException - if modalDialog returns false from Dialog.isModal()NullPointerException - if modalDialog is nullpublic static JTextComponent getFirstTextComponent(Container container)
container - the container to look for the component inpublic static Object showMoreOptionsDialog(Dialogs.DialogOptions options, String basicMessage, String advancedMessage)
DialogOptions.options - DialogOptions specifying the properties of the dialogbasicMessage - Message initially visible to the user.advancedMessage - Message that is displayed when the user clicks 'More Options'. A null value will simply not show a "More Options" button.String or Dialogs.DialogAction).public static Object showMoreOptionsDialog(Dialogs.DialogOptions options, Component basicComponent, Component advancedComponent)
DialogOptions.options - DialogOptions specifying the properties of the dialogbasicComponent - Component initially visible to the user.advancedComponent - Component that is displayed when the user clicks 'More Options'String or Dialogs.DialogAction).public static boolean showContinueCancelDialog(String message, String title, Component owner, Dialogs.DialogIcon dialogIcon)
message - Message to display in the dialogtitle - Title of the dialogowner - Any component within the Window which will be the owner of this dialog. If null, the currently
focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.dialogIcon - DialogIcon of the icon to display on the left of the dialog. Must not be null.public static boolean showOkCancelDialog(String message, String title, Component owner)
message - Message to display in the dialogtitle - Title of the dialogowner - Any component within the Window which will be the owner of this dialog. If null, the currently
focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.public static boolean showOkCancelDialog(Component component, String title, Component owner)
component - Component to display in the dialogtitle - Title of the dialogowner - Any component within the Window which will be the owner of this dialog. If null, the currently
focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.public static boolean showOkCancelDialog(String message, String title, Component owner, Dialogs.DialogIcon dialogIcon)
message - Message to display in the dialogtitle - Title of the dialogowner - Any component within the Window which will be the owner of this dialog. If null, the currently
focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.dialogIcon - DialogIcon of the icon to display on the left of the dialog. Must not be null.public static boolean showOkCancelDialog(Component component, String title, Component owner, Dialogs.DialogIcon dialogIcon)
component - Component to display in the dialogtitle - Title of the dialogowner - Any component within the Window which will be the owner of this dialog. If null, the currently
focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.dialogIcon - DialogIcon of the icon to display on the left of the dialog. Must not be null.public static boolean showYesNoDialog(String message, String title, Component owner, Dialogs.DialogIcon dialogIcon)
message - Message to display in the dialogtitle - Title of the dialogowner - Any component within the Window which will be the owner of this dialog. If null, the currently
focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.dialogIcon - DialogIcon of the icon to display on the left of the dialog. Must not be null.public static boolean showYesNoDialog(Component component, String title, Component owner, Dialogs.DialogIcon dialogIcon)
component - Component to display in the dialogtitle - Title of the dialogowner - Any component within the Window which will be the owner of this dialog. If null, the currently
focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.dialogIcon - DialogIcon of the icon to display on the left of the dialog. Must not be null.public static void setDefaultDialogOwner(Window defaultOwner)
null is passed in as an owner).defaultOwner - the default onwer for dialogs created by this classpublic static Dialogs.SaveChanges showSaveChangesDialog(String note, Component owner)
Dialogs.SaveChanges. The message is something
like:
note - An additional note for the user that appears under "Do you want to save changes?" or null for none. E.g. "Changes must be saved before you can switch to another sequence."owner - Any component within the Window which will be the owner of this dialog. If null, the currently
focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.Dialogs.SaveChanges, never null.public static void showMessageDialog(String message, String title, Component owner, Dialogs.DialogIcon dialogIcon)
message - Message to display in the dialog.title - Title of the dialog.owner - Any component within the Window which will be the owner of this dialog. If null, the currently
focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.dialogIcon - DialogIcon of the icon to display on the left of the dialog. Must not be null.public static void showMessageDialog(String message, String title)
getClientProperty(ALLOW_AS_PARENT) != null)
This method will block until the user has clicked Ok.message - Message to display in the dialog.title - Title of the dialog.public static void showMessageDialog(String message)
getClientProperty(ALLOW_AS_PARENT) != null). It has no title.
This method will block until the user has clicked Ok.message - Message to display in the dialog.public static JComponent createTextComponentForDialog(String message, boolean isHtml, Dialogs.DialogOptions dialogOptions)
message - the message string to be put into the componentisHtml - true if the message string is HTML formatteddialogOptions - DialogOptions for the dialog that the text will be inpublic static String showTextFieldDialog(String message, String defaultValue, String title, Component owner)
message - Message to display in the dialog above the text fielddefaultValue - Initial value in the text field (or null for empty)title - Title of the dialogowner - Any component within the Window which will be the owner of this dialog. If null, the currently
focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.public static String showComboBoxDialog(String message, String[] values, String defaultValue, String title, Component owner)
message - Message to display in the dialog above the combo-boxvalues - An array of the values in the combo-box.defaultValue - Initial value to be selected in the combo-box (must be one of the values)title - Title of the dialogowner - Any component within the Window which will be the owner of this dialog. If null, the currently
focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.public static boolean showInputDialog(String message, String title, Component owner, JComponent... inputComponents)
message - Message to display in the dialog above the componentsinputComponents - Custom components for the user to enter inputtitle - Title of the dialogowner - Any component within the Window which will be the owner of this dialog. If null, the currently
focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.