Class Dialogs.DialogOptions

java.lang.Object
com.biomatters.geneious.publicapi.components.Dialogs.DialogOptions
Enclosing class:
Dialogs

public static class Dialogs.DialogOptions extends Object
A class that specifies all the options for displaying a dialog.
  • Constructor Details

    • 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 copy
      okAction - will be performed after the defaultAction is activated
      cancelAction - will be performed after the cancel action is activated
    • DialogOptions

      public DialogOptions(String[] buttons, 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 null
      title - Title of the dialog. For correct capitalisation, see TitleCap using option 'Capitalize words with five or more letters' (based on invalid input: '<'a href=https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/OSXHIGuidelines/TerminologyWording.html#//apple_ref/doc/uid/20000957-CH15-SW4">Use the Right Capitalization Style in Labels and Text)
    • DialogOptions

      public DialogOptions(Dialogs.DialogAction[] buttons, 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 null
      title - Title of the dialog. For correct capitalisation, see TitleCap using option 'Capitalize words with five or more letters' (based on invalid input: '<'a href=https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/OSXHIGuidelines/TerminologyWording.html#//apple_ref/doc/uid/20000957-CH15-SW4">Use the Right Capitalization Style in Labels and Text)
    • DialogOptions

      public DialogOptions(String[] buttons, String title, 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 null
      title - Title of the dialog. For correct capitalisation, see TitleCap using option 'Capitalize words with five or more letters' (based on invalid input: '<'a href=https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/OSXHIGuidelines/TerminologyWording.html#//apple_ref/doc/uid/20000957-CH15-SW4">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 with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.
    • DialogOptions

      public DialogOptions(Dialogs.DialogAction[] buttons, String title, 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 null
      title - Title of the dialog. For correct capitalisation, see TitleCap using option 'Capitalize words with five or more letters' (based on invalid input: '<'a href=https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/OSXHIGuidelines/TerminologyWording.html#//apple_ref/doc/uid/20000957-CH15-SW4">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 with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.
    • DialogOptions

      public DialogOptions(String[] buttons, String title, 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 null
      title - Title of the dialog. For correct capitalisation, see TitleCap using option 'Capitalize words with five or more letters' (based on invalid input: '<'a href=https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/OSXHIGuidelines/TerminologyWording.html#//apple_ref/doc/uid/20000957-CH15-SW4">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 with getClientProperty(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, String title, 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 null
      title - Title of the dialog. For correct capitalisation, see TitleCap using option 'Capitalize words with five or more letters' (based on invalid input: '<'a href=https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/OSXHIGuidelines/TerminologyWording.html#//apple_ref/doc/uid/20000957-CH15-SW4">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 with getClientProperty(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 Details

    • 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(String moreOptionsText, String lessOptionsText)
      If any of the showMoreOptionsDialog 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:
    • getMaxDimensions

      public Dimension getMaxDimensions()
      Get the maximum dimensions that the dialog will pack to.
      Returns:
      the maximum dimensions
    • getTitle

      public 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 Object getCancelButton()
      Get the button which is treated as a cancel button. This will be either a String or an Dialogs.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(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:
    • 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 (usually Dialogs.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:
    • getDefaultButton

      public Object getDefaultButton()
      Get the button which is the dialogs default button. This will be either a String or an Dialogs.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(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

      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:
    • 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 use DialogActions to receive events from the buttons in this case.

      Parameters:
      modal - true if the dialog should be modal
    • getCustomIcon

      public 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(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:
    • 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 using Dialogs.showOptionsDialog(com.biomatters.geneious.publicapi.plugin.Options, String, boolean) and Dialogs.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 a Dialogs.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)