Class Dialogs.DialogOptions
- java.lang.Object
-
- com.biomatters.geneious.publicapi.components.Dialogs.DialogOptions
-
- Enclosing class:
- Dialogs
public static class Dialogs.DialogOptions extends java.lang.Object
A class that specifies all the options for displaying a dialog.
-
-
Constructor Summary
Constructors Constructor Description DialogOptions(Dialogs.DialogAction[] buttons, java.lang.String title)
DialogOptions(Dialogs.DialogAction[] buttons, java.lang.String title, java.awt.Component owner)
DialogOptions(Dialogs.DialogAction[] buttons, java.lang.String title, java.awt.Component owner, Dialogs.DialogIcon dialogIcon)
DialogOptions(Dialogs.DialogOptions source)
contstructs a new DialogOptions based on the given source.
WARNING: this is a shallow copy, rather than a deep copyDialogOptions(Dialogs.DialogOptions source, Dialogs.DialogAction okAction, Dialogs.DialogAction cancelAction)
contstructs a new DialogOptions based on the given source.
WARNING: this is a shallow copy, rather than a deep copyDialogOptions(java.lang.String[] buttons, java.lang.String title)
DialogOptions(java.lang.String[] buttons, java.lang.String title, java.awt.Component owner)
DialogOptions(java.lang.String[] buttons, java.lang.String title, java.awt.Component owner, Dialogs.DialogIcon dialogIcon)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDialogClosedListener(Dialogs.DialogClosedListener listener)
Add a listener to be notified when a dialog constructed with these options is closed.java.lang.Object
getCancelButton()
Get the button which is treated as a cancel button.javax.swing.Icon
getCustomIcon()
Get the custom icon to use or null if none setjava.lang.Object
getDefaultButton()
Get the button which is the dialogs default button.java.awt.Dimension
getMaxDimensions()
Get the maximum dimensions that the dialog will pack to.java.lang.String
getTitle()
Get the desired title for the dialogboolean
isModal()
Get whether the dialog should be modal.void
setAdvancedOptionsInitiallyVisible(boolean advancedOptionsInitiallyVisible)
Set whether the advanced options panel or message is visible initially if a 'More Options Dialog' is shown with these options.void
setAllowAsOwnerOfOtherDialogs(boolean allowAsOwnerOfOtherDialogs)
Normally a dialog will not be used as the owner of other dialogs (unless explicitly specified as the owner).void
setCancelButton(Dialogs.DialogAction cancelButton)
Set the button which is treated as a cancel button.void
setCancelButton(java.lang.String cancelButton)
Set the button which is treated as a cancel button.void
setCloseAction(Dialogs.DialogAction closeAction)
Sets the action associated with clicking the windows's close button (the X in the top-right hand corner of the window in Windows).void
setCustomIcon(javax.swing.Icon customIcon)
Set a custom icon to use instead of the standard JOptionPane ones.void
setDefaultButton(Dialogs.DialogAction defaultButton)
Set the button which is the dialogs default button.void
setDefaultButton(java.lang.String defaultButton)
Set the button which is the dialogs default button.void
setMaxHeight(int maxHeight)
Set the maximum height that the dialog will pack itself to.void
setMaxWidth(int maxWidth)
Set the maximum width that the dialog will pack itself to.void
setModal(boolean modal)
Set whether the dialog should be modal.void
setMoreOptionsButtonText(java.lang.String moreOptionsText, java.lang.String lessOptionsText)
If any of theshowMoreOptionsDialog
methods are used to show a dialog with these options then the specified text will be used on the More/Fewer Options button.void
setTopLevelDialogWithTaskBarIcon(boolean topLevelDialogWithTaskBarIcon)
Sets this dialog as a top level window in the Geneious Prime application, with its own task bar icon on Windows.
-
-
-
Constructor Detail
-
DialogOptions
public DialogOptions(Dialogs.DialogOptions source)
contstructs a new DialogOptions based on the given source.
WARNING: this is a shallow copy, rather than a deep copy- Parameters:
source
- the DialogOptions to copy
-
DialogOptions
public DialogOptions(Dialogs.DialogOptions source, Dialogs.DialogAction okAction, Dialogs.DialogAction cancelAction)
contstructs a new DialogOptions based on the given source.
WARNING: this is a shallow copy, rather than a deep copy- Parameters:
source
- the DialogOptions to copyokAction
- will be performed after the defaultAction is activatedcancelAction
- will be performed after the cancel action is activated
-
DialogOptions
public DialogOptions(java.lang.String[] buttons, java.lang.String title)
- Parameters:
buttons
- Labels of the buttons in the dialog. The first is used as the default button (pressed if user pushes Enter) and is the right most button on MacOS or left most button on Windows. If there is more than one button then the last is treated as a Cancel button which is the left most button on MacOS or right most button on Windows. If the user closes the dialog or pushes Escape this is treated as if the Cancel button has been pressed. Never nulltitle
- Title of the dialog. For correct capitalisation, see TitleCap using option 'Capitalize words with five or more letters' (based on Use the Right Capitalization Style in Labels and Text)
-
DialogOptions
public DialogOptions(Dialogs.DialogAction[] buttons, java.lang.String title)
- Parameters:
buttons
- Actions for the buttons in the dialog. The first is used as the default button (pressed if user pushes Enter) and is the right most button on MacOS or left most button on Windows. If there is more than one button then the last is treated as a Cancel button which is the left most button on MacOS or right most button on Windows. If the user closes the dialog or pushes Escape this is treated as if the Cancel button has been pressed. Never nulltitle
- Title of the dialog. For correct capitalisation, see TitleCap using option 'Capitalize words with five or more letters' (based on Use the Right Capitalization Style in Labels and Text)
-
DialogOptions
public DialogOptions(java.lang.String[] buttons, java.lang.String title, java.awt.Component owner)
- Parameters:
buttons
- Labels of the buttons in the dialog. The first is used as the default button (pressed if user pushes Enter) and is the right most button on MacOS or left most button on Windows. If there is more than one button then the last is treated as a Cancel button which is the left most button on MacOS or right most button on Windows. If the user closes the dialog or pushes Escape this is treated as if the Cancel button has been pressed. Never nulltitle
- Title of the dialog. For correct capitalisation, see TitleCap using option 'Capitalize words with five or more letters' (based on Use the Right Capitalization Style in Labels and Text)owner
- Any component within the Window which will be the owner of this dialog. If null, the currently focused document frame (or JDialog withgetClientProperty(ALLOW_AS_PARENT) != null
) is used as the owner.
-
DialogOptions
public DialogOptions(Dialogs.DialogAction[] buttons, java.lang.String title, java.awt.Component owner)
- Parameters:
buttons
- Actions for the buttons in the dialog. The first is used as the default button (pressed if user pushes Enter) and is the right most button on MacOS or left most button on Windows. If there is more than one button then the last is treated as a Cancel button which is the left most button on MacOS or right most button on Windows. If the user closes the dialog or pushes Escape this is treated as if the Cancel button has been pressed. Never nulltitle
- Title of the dialog. For correct capitalisation, see TitleCap using option 'Capitalize words with five or more letters' (based on Use the Right Capitalization Style in Labels and Text)owner
- Any component within the Window which will be the owner of this dialog. If null, the currently focused document frame (or JDialog withgetClientProperty(ALLOW_AS_PARENT) != null
) is used as the owner.
-
DialogOptions
public DialogOptions(java.lang.String[] buttons, java.lang.String title, java.awt.Component owner, Dialogs.DialogIcon dialogIcon)
- Parameters:
buttons
- Labels of the buttons in the dialog. The first is used as the default button (pressed if user pushes Enter) and is the right most button on MacOS or left most button on Windows. If there is more than one button then the last is treated as a Cancel button which is the left most button on MacOS or right most button on Windows. If the user closes the dialog or pushes Escape this is treated as if the Cancel button has been pressed. Never nulltitle
- Title of the dialog. For correct capitalisation, see TitleCap using option 'Capitalize words with five or more letters' (based on Use the Right Capitalization Style in Labels and Text)owner
- Any component within the Window which will be the owner of this dialog. If null, the currently focused document frame (or JDialog withgetClientProperty(ALLOW_AS_PARENT) != null
) is used as the owner.dialogIcon
- The icon to display on the left of the dialog, eg.Dialogs.DialogIcon.WARNING
, never null
-
DialogOptions
public DialogOptions(Dialogs.DialogAction[] buttons, java.lang.String title, java.awt.Component owner, Dialogs.DialogIcon dialogIcon)
- Parameters:
buttons
- Actions for the buttons in the dialog. The first is used as the default button (pressed if user pushes Enter) and is the right most button on MacOS or left most button on Windows. If there is more than one button then the last is treated as a Cancel button which is the left most button on MacOS or right most button on Windows. If the user closes the dialog or pushes Escape this is treated as if the Cancel button has been pressed. Never nulltitle
- Title of the dialog. For correct capitalisation, see TitleCap using option 'Capitalize words with five or more letters' (based on Use the Right Capitalization Style in Labels and Text)owner
- Any component within the Window which will be the owner of this dialog. If null, the currently focused document frame (or JDialog withgetClientProperty(ALLOW_AS_PARENT) != null
) is used as the owner.dialogIcon
- The icon to display on the left of the dialog, eg.Dialogs.DialogIcon.WARNING
, never null
-
-
Method Detail
-
setTopLevelDialogWithTaskBarIcon
public void setTopLevelDialogWithTaskBarIcon(boolean topLevelDialogWithTaskBarIcon)
Sets this dialog as a top level window in the Geneious Prime application, with its own task bar icon on Windows.- Parameters:
topLevelDialogWithTaskBarIcon
- true to make the dialog a top level window- Since:
- API 4.202110 (Geneious 2021.1.0)
-
setMoreOptionsButtonText
public void setMoreOptionsButtonText(java.lang.String moreOptionsText, java.lang.String lessOptionsText)
If any of theshowMoreOptionsDialog
methods are used to show a dialog with these options then the specified text will be used on the More/Fewer Options button.- Parameters:
moreOptionsText
- the text used instead of "More Options"lessOptionsText
- the text used instead of "Fewer Options"- See Also:
Dialogs.showMoreOptionsDialog( com.biomatters.geneious.publicapi.components.Dialogs.DialogOptions , String, String)
,Dialogs.showMoreOptionsDialog( com.biomatters.geneious.publicapi.components.Dialogs.DialogOptions , java.awt.Component, java.awt.Component)
-
getMaxDimensions
public java.awt.Dimension getMaxDimensions()
Get the maximum dimensions that the dialog will pack to.- Returns:
- the maximum dimensions
-
getTitle
public java.lang.String getTitle()
Get the desired title for the dialog- Returns:
- the desired title for the dialog
-
setMaxWidth
public void setMaxWidth(int maxWidth)
Set the maximum width that the dialog will pack itself to. The user can manually resize it larger than this.- Parameters:
maxWidth
- maximum width for the dialog
-
setMaxHeight
public void setMaxHeight(int maxHeight)
Set the maximum height that the dialog will pack itself to. The user can manually resize it larger than this.- Parameters:
maxHeight
- maximum height for the dialog
-
getCancelButton
public java.lang.Object getCancelButton()
Get the button which is treated as a cancel button. This will be either a String or anDialogs.DialogAction
depending on what was used to specify the buttons for these options. If this dialog has only a single button, this method will return that button, even if it is an OK button!- Returns:
- the button which is treated as a cancel button.
-
setCancelButton
public void setCancelButton(java.lang.String cancelButton)
Set the button which is treated as a cancel button. This must be one of the buttons passed to the constructor- Parameters:
cancelButton
- the button which is treated as a cancel button.- See Also:
setCancelButton( com.biomatters.geneious.publicapi.components.Dialogs.DialogAction )
-
setCloseAction
public void setCloseAction(Dialogs.DialogAction closeAction)
Sets the action associated with clicking the windows's close button (the X in the top-right hand corner of the window in Windows). This does not need to be one of the buttons passed to the constructor.- Parameters:
closeAction
- the action (usuallyDialogs.CANCEL
) or null for the close action to be the same as the cancel button.
-
setCancelButton
public void setCancelButton(Dialogs.DialogAction cancelButton)
Set the button which is treated as a cancel button. This must be one of the buttons passed to the constructor.- Parameters:
cancelButton
- the button which is treated as a cancel button.- See Also:
setCancelButton(String)
-
getDefaultButton
public java.lang.Object getDefaultButton()
Get the button which is the dialogs default button. This will be either a String or anDialogs.DialogAction
depending on what was used to specify the buttons for these options.- Returns:
- the button which is the dialogs default button.
-
setDefaultButton
public void setDefaultButton(java.lang.String defaultButton)
Set the button which is the dialogs default button. This must be one of the buttons passed to the constructor- Parameters:
defaultButton
- the button which is the dialogs default button.- See Also:
setDefaultButton( com.biomatters.geneious.publicapi.components.Dialogs.DialogAction )
-
setDefaultButton
public void setDefaultButton(Dialogs.DialogAction defaultButton)
Set the button which is the dialogs default button. This must be one of the buttons passed to the constructor- Parameters:
defaultButton
- the button which is the dialogs default button.- See Also:
setDefaultButton(String)
-
isModal
public boolean isModal()
Get whether the dialog should be modal.- Returns:
- true if the dialog should be modal
-
setModal
public void setModal(boolean modal)
Set whether the dialog should be modal. WARNING setting this to false will cause any of the Dialogs show methods to return a null result as soon as the dialog is displayed. The dialog will not wait for input from the user. You should useDialogAction
s to receive events from the buttons in this case.- Parameters:
modal
- true if the dialog should be modal
-
getCustomIcon
public javax.swing.Icon getCustomIcon()
Get the custom icon to use or null if none set- Returns:
- the custom icon to use or null if none set
-
setCustomIcon
public void setCustomIcon(javax.swing.Icon customIcon)
Set a custom icon to use instead of the standard JOptionPane ones. If a custom icon is set then the iconType setting will be ignored.- Parameters:
customIcon
- the custom icon to use
-
setAdvancedOptionsInitiallyVisible
public void setAdvancedOptionsInitiallyVisible(boolean advancedOptionsInitiallyVisible)
Set whether the advanced options panel or message is visible initially if a 'More Options Dialog' is shown with these options.- Parameters:
advancedOptionsInitiallyVisible
- whether the advanced options panel or message is visible initially- See Also:
Dialogs.showMoreOptionsDialog( com.biomatters.geneious.publicapi.components.Dialogs.DialogOptions , String, String)
,Dialogs.showMoreOptionsDialog( com.biomatters.geneious.publicapi.components.Dialogs.DialogOptions , Component, Component)
-
setAllowAsOwnerOfOtherDialogs
public void setAllowAsOwnerOfOtherDialogs(boolean allowAsOwnerOfOtherDialogs)
Normally a dialog will not be used as the owner of other dialogs (unless explicitly specified as the owner). Setting this to true will allow this dialog to be used as the owner of other dialogs. This is only true by default for dialogs shown usingDialogs.showOptionsDialog(com.biomatters.geneious.publicapi.plugin.Options, String, boolean)
andDialogs.showOptionsDialog(com.biomatters.geneious.publicapi.plugin.Options, String, boolean, javax.swing.JComponent)
- Parameters:
allowAsOwnerOfOtherDialogs
- true to allow this dialog to be the owner of other dialogs, false otherwise.- Since:
- API 4.14 (Geneious 5.1)
-
addDialogClosedListener
public void addDialogClosedListener(Dialogs.DialogClosedListener listener)
Add a listener to be notified when a dialog constructed with these options is closed. Normally aDialogs.showDialog(com.biomatters.geneious.publicapi.components.Dialogs.DialogOptions, String)
call returns the result, unless it is a non-modal dialog invoked from outside the Swing thread, in which case it will return null and the result is only obtainable using addDialogClosedListener- Parameters:
listener
- the listener to be notified- Since:
- API 4.900 (Geneious 9.0.0)
-
-