Class Options

    • Field Detail

      • ASSOCIATED_OPTION_PROPERTY

        public static final java.lang.String ASSOCIATED_OPTION_PROPERTY
        The Components (or sub-components) returned by Options.Option.getComponent() may provide this property via JComponent.getClientProperty(Object) which will be a reference to the Option the component belongs to.
        Since:
        API 4.700 (Geneious 7.0.0)
        See Also:
        Constant Field Values
    • Constructor Detail

      • Options

        public Options​(java.lang.Class cl)
        Construct a new options.
        Parameters:
        cl - a class used to generate a unique name under which persistent preferences can be stored. Usually this should be the class that these options are constructed within.
      • Options

        public Options​(java.lang.Class cl,
                       java.lang.String preferenceNameSuffix)
        Construct a new options.
        Parameters:
        cl - a class used to generate a unique name under which persistent preferences can be stored. Usually this should be the class that these options are constructed within.
        preferenceNameSuffix - A suffix to append to the unique name generated from the class. For example, a set of sequence alignment options may vary the value of this parameter depending on whether it is aligning nucleotide or protein sequences in order to have different preference sets for each type of sequence.
        Throws:
        java.lang.IllegalArgumentException - if cl is null and the concrete class of these options is Options.class
    • Method Detail

      • getExtraLeftButtonPanelComponent

        public java.awt.Component getExtraLeftButtonPanelComponent()
        Override this method and return a non-null component to have it displayed in the bottom left corner of this dialog alongside the extra-setting cog button and the help button.
        Returns:
        A component to be shown on the left side of the same button panel which the OK and Cancel buttons are displayed
        Since:
        API 4.202300 (Geneious 2023.0.0)
      • setEnabled

        public void setEnabled​(boolean enabled)
        Sets the enabled state of all these Options. All contained Options are only considered enabled if they are themselves enabled and if their parent Options are enabled.
        Parameters:
        enabled - whether or not these Options should be enabled.
      • setVisible

        public void setVisible​(boolean visible)
        Sets the visibility of the graphical component that displays these options and makes appropriate changes to the size of the window (if any) that contains the graphical component.
        Parameters:
        visible - whether or not the graphical component that displays these options should be visible.
        See Also:
        isVisible()
      • isVisible

        public boolean isVisible()
        Return true if the graphical component that displays these options would be visible to the user when the panel is showing.
        Returns:
        true if the graphical component that displays these options would be visible to the user when the panel is showing.
        See Also:
        setVisible(boolean)
      • isEnabled

        public boolean isEnabled()
        Determine if these options appear enabled. Options appear enabled only if they are currently set as enabled ( using setEnabled(boolean) which is true by default) and if their parent options (if these Options are child options or multiple options inside other Options) appear enabled.
        Returns:
        true if these options appear enabled.
      • setProOnly

        public final void setProOnly​(boolean proOnly)
        Sets whether or not these options require an active license By default all options do not require an active license.
        Parameters:
        proOnly - true if these options require an active license
      • isProOnly

        public boolean isProOnly()
        Determine whether or not these options require an active license.
        Returns:
        true if these options require an active license
      • getIcons

        public final Icons getIcons()
        Gets Icons associated with these options. See setIcons(Icons) for more information.
        Returns:
        Icons associated with these options or null if it has no Icons.
      • getDescriptionAndState

        public final java.lang.String getDescriptionAndState()
        Describe all properties and the state of these options.
        Returns:
        a description of all properties and the state of these options.
        See Also:
        getNamesAndValues(boolean)
      • getNamesAndValues

        public final java.lang.String getNamesAndValues​(boolean includeLabelsToo)
        Provides a text description of all option names and values. For a more complete description of the options which includes all possible values for all options, see getDescriptionAndState()
        Parameters:
        includeLabelsToo - to also include the label displayed next to each option
        Returns:
        a text description of all option names and values.
        Since:
        API 4.611 (Geneious 6.1.1)
        See Also:
        getDescriptionAndState()
      • addCustomOption

        public final <OptionType extends Options.Option> OptionType addCustomOption​(OptionType option)
        Add a custom option. It will have its value reset to its default value. This method should be used only on custom option classes. For adding standard options use addBooleanOption, addStringOption etc. To create a custom option type, extend Option.
        Parameters:
        option - the option to be added
        Returns:
        the newly added custom Option
        Throws:
        java.lang.NullPointerException - if option is null
      • addCustomComponent

        public final Options.Option addCustomComponent​(Options.ComponentCreator componentCreator)
        Adds a custom component that will be laid out along with all the standard options. This component is only created on demand shortly before the component is rendered (if at all) the first time.

        Note: If the component is not XMLSerializable then if these options are serialized and deserialized, then deserialized component will be a blank panel.

        Parameters:
        componentCreator - a ComponentCreator on which Options.ComponentCreator.create() will be later called on the event dispatch thread to create the component when it is about to be rendered. This will be invoked at most once.
        Returns:
        An option that wraps the component. Methods such as Option.setSpanningComponent or Option.setFillHorizontalSpace may be used on it to adjust the size of the component.
        Since:
        API 4.700 (Geneious 7.0.0)
      • addStringOption

        public final Options.StringOption addStringOption​(java.lang.String name,
                                                          java.lang.String label,
                                                          java.lang.String defaultValue,
                                                          java.lang.String watermarkText)
        Add an option that stores a String that is displayed graphically to the user as a single line text field.

        It will have its value set to its default value.

        Parameters:
        name - the name to be used for referencing this option. For example from scripts or source code which wish to programmatically get or set the value of this option.
        label - a label describing this option to be displayed to the user
        defaultValue - the default value for this option
        watermarkText - Watermark to display when no string is entered and textfield doesn't have focus, or null for none.
        Returns:
        the newly added StringOption.
      • addEditableComboBoxOption

        public final Options.EditableComboBoxOption addEditableComboBoxOption​(java.lang.String name,
                                                                              java.lang.String label,
                                                                              java.lang.String defaultValue,
                                                                              java.lang.String[] selectableValues)
        Add an option that stores a String that is displayed graphically to the user as a single line text field. Furthermore you can optionally provide a list of selectable strings to appear in the drop down combo box.

        Parameters:
        name - the name to be used for referencing this option. For example from scripts or source code which wish to programmatically get or set the value of this option.
        label - a label describing this option to be displayed to the user
        defaultValue - the default value for this option
        selectableValues - some selectable values to display in the drop down box.
        Returns:
        the newly added EditableComboBoxOption.
      • addEditableComboBoxOption

        public final Options.EditableComboBoxOption addEditableComboBoxOption​(java.lang.String name,
                                                                              java.lang.String label,
                                                                              java.lang.String defaultValue,
                                                                              java.lang.String[] selectableValues,
                                                                              int historySize)
        Add an option that stores a String that is displayed graphically to the user as a single line text field. Furthermore you can optionally provide a list of selectable strings to appear in the drop down combo box.

        Parameters:
        name - the name to be used for referencing this option. For example from scripts or source code which wish to programmatically get or set the value of this option.
        label - a label describing this option to be displayed to the user
        defaultValue - the default value for this option
        selectableValues - some selectable values to display in the drop down box.
        historySize - the maximum number of user-entered strings to store as a history or 0 to keep no history
        Returns:
        the newly added EditableComboBoxOption.
      • addBooleanOption

        public final Options.BooleanOption addBooleanOption​(java.lang.String name,
                                                            java.lang.String label,
                                                            java.lang.Boolean defaultValue)
        Add an option that stores a Boolean and is represented graphically as a check box.

        It will have its value set to its default value.

        Parameters:
        name - the name to be used for referencing this option. For example from scripts or source code which wish to programmatically get or set the value of this option. Names should be in standard Java variable name style eg. "myAwesomeOption".
        label - a label describing this option to be displayed to the user. eg. "My Awesome Option"
        defaultValue - the default value for this option
        Returns:
        the newly added BooleanOption.
      • addMultipleLineStringOption

        public final Options.MultipleLineStringOption addMultipleLineStringOption​(java.lang.String name,
                                                                                  java.lang.String label,
                                                                                  java.lang.String defaultValue,
                                                                                  int rows,
                                                                                  boolean lineWrap)
        Add an option that stores a String and is displayed to the user as a multiple line text area

        It will have its value set to its default value.

        Parameters:
        name - the name to be used for referencing this option. For example from scripts or source code which wish to programmatically get or set the value of this option. Names should be in standard Java variable name style eg. "myAwesomeOption".
        label - a label describing this option to be displayed to the user. eg. "My Awesome Option"
        defaultValue - the default value for this option
        rows - the number of rows in the text area when displayed to the user
        lineWrap - true if long lines should be wrapped when the text area is displayed to the user
        Returns:
        the newly added MultipleLineStringOption.
      • addIntegerOption

        public final Options.IntegerOption addIntegerOption​(java.lang.String name,
                                                            java.lang.String label,
                                                            java.lang.Integer defaultValue,
                                                            java.lang.Integer minimum,
                                                            java.lang.Integer maximum)
        Add option that stores an Integer and is displayed graphically to the user as a single line text field with a spinner (up and down arrow) on the right-hand side

        For information on what the initial value of this option is set to see addStringOption.

        Parameters:
        name - the name to be used for referencing this option. For example from scripts or source code which wish to programmatically get or set the value of this option. Names should be in standard Java variable name style eg. "myAwesomeOption".
        label - a label describing this option to be displayed to the user. eg. "My Awesome Option"
        defaultValue - the default value for this option
        minimum - The minimum value that the option can have
        maximum - The maximum value that the option can have
        Returns:
        the newly added IntegerOption.
      • addIntegerOption

        public final Options.IntegerOption addIntegerOption​(java.lang.String name,
                                                            java.lang.String label,
                                                            java.lang.Integer defaultValue)
        Add option that stores an Integer and is displayed graphically to the user as a single line text field with a spinner (up and down arrow) on the right-hand side

        For information on what the initial value of this option is set to see addStringOption.

        Parameters:
        name - the name to be used for referencing this option. For example from scripts or source code which wish to programmatically get or set the value of this option.
        label - a label describing this option to be displayed to the user. eg. "My Awesome Option"
        defaultValue - the default value for this option
        Returns:
        the newly added IntegerOption.
      • addButtonOption

        public final Options.ButtonOption addButtonOption​(java.lang.String name,
                                                          java.lang.String label,
                                                          java.lang.String buttonLabel,
                                                          javax.swing.Icon icon,
                                                          int alignment)
        Adds an option that is represented by a button, and may have actions attached to it which are activated when the user clicks the button (see Options.ButtonOption.addActionListener(java.awt.event.ActionListener)).
        Parameters:
        name - the name to be used for referencing this option. For example from scripts or source code which wish to programmatically get or set the value of this option. Names should be in standard Java variable name style eg. "myAwesomeOption".
        label - A label describing this option to be displayed to the user. eg. "My Awesome Option". Usually displayed to the left of the button.
        buttonLabel - The text on the button itself
        icon - An optional icon which will appear on the button. This icon is not XMLSerializable, and can be null.
        alignment - choose how to align the button - only works on if this option is spanning (see Options.Option.setSpanningComponent(boolean)). Choices are Options.ButtonOption.LEFT, Options.ButtonOption.CENTER, and Options.ButtonOption.RIGHT
      • addButtonOption

        public final Options.ButtonOption addButtonOption​(java.lang.String name,
                                                          java.lang.String label,
                                                          java.lang.String buttonLabel)
        Adds an option that is represented by a button, and may have actions attached to it which are activated when the user clicks the button (see Options.ButtonOption.addActionListener(java.awt.event.ActionListener)).
        Parameters:
        name - the name to be used for referencing this option. For example from scripts or source code which wish to programmatically get or set the value of this option. Names should be in standard Java variable name style eg. "myAwesomeOption".
        label - A label describing this option to be displayed to the user. eg. "My Awesome Option". Usually displayed to the left of the button.
        buttonLabel - The text on the button itself
      • addDoubleOption

        public final Options.DoubleOption addDoubleOption​(java.lang.String name,
                                                          java.lang.String label,
                                                          java.lang.Double defaultValue,
                                                          java.lang.Double minimum,
                                                          java.lang.Double maximum)
        Add an option that stores an Double and is displayed graphically to the user as a single line text field with a spinner (up and down arrow) on the right-hand side

        For information on what the initial value of this option is set to see addStringOption.

        Parameters:
        name - the name to be used for referencing this option. For example from scripts or source code which wish to programmatically get or set the value of this option.
        label - a label describing this option to be displayed to the user. eg. "My Awesome Option"
        defaultValue - the default value for this option
        minimum - The minimum value that the option can have
        maximum - The maximum value that the option can have
        Returns:
        the newly added DoubleOption.
      • addDoubleOption

        public final Options.DoubleOption addDoubleOption​(java.lang.String name,
                                                          java.lang.String label,
                                                          java.lang.Double defaultValue)
        Add an option that stores an Double and is displayed graphically to the user as a single line text field with a spinner (up and down arrow) on the right-hand side

        For information on what the initial value of this option is set to see addStringOption.

        Parameters:
        name - the name to be used for referencing this option. For example from scripts or source code which wish to programmatically get or set the value of this option. Names should be in standard Java variable name style eg. "myAwesomeOption".
        label - a label describing this option to be displayed to the user. eg. "My Awesome Option"
        defaultValue - the default value for this option
        Returns:
        the newly added DoubleOption.
      • addDateOption

        public final Options.DateOption addDateOption​(java.lang.String name,
                                                      java.lang.String label,
                                                      java.util.Date defaultValue)
        Add an option that stores a Date (day, month and year only) and is displayed graphically to the user as a set of 3 spinners together with a button that opens a new dialog for nicer date selection from a calendar style view.

        Parameters:
        name - the name to be used for referencing this option. For example from scripts or source code which wish to programmatically get or set the value of this option. Names should be in standard Java variable name style eg. "myAwesomeOption".
        label - a label describing this option to be displayed to the user. eg. "My Awesome Option"
        defaultValue - the default value for this option
        Returns:
        the newly added DateOption.
      • addServiceOption

        public final Options.Option<WritableDatabaseService,​javax.swing.JComponent> addServiceOption​(java.lang.String name,
                                                                                                           java.lang.String label,
                                                                                                           WritableDatabaseService defaultValue)
        Add an option that allows the user to select a WritableDatabaseService which appears under one of the services returned from PluginUtilities.getWritableDatabaseServiceRoots(). Appears as a label showing the name of the currently selected service with a button that pops up a tree to change the selected service.

        Parameters:
        name - the name to be used for referencing this option. For example from scripts or source code which wish to programmatically get or set the value of this option. Names should be in standard Java variable name style eg. "myAwesomeOption".
        label - a label describing this option to be displayed to the user. eg. "My Awesome Option"
        defaultValue - the default value for this option. May be null in which case Options.Option.getValue() on the Option may return a dummy service (with unique ID 'dummy') that returns no documents from its retrieve methods.
        Returns:
        the newly added ServiceOption.
        Since:
        API 4.600 (Geneious 6.0.0)
      • addServiceOption

        public final Options.Option<WritableDatabaseService,​javax.swing.JComponent> addServiceOption​(java.lang.String name,
                                                                                                           java.lang.String label,
                                                                                                           WritableDatabaseService defaultValue,
                                                                                                           java.util.function.Predicate<GeneiousService> rootServiceValidator,
                                                                                                           boolean displayButton,
                                                                                                           boolean showNewFolderButton,
                                                                                                           boolean useStandardButtonLook,
                                                                                                           java.lang.String folderTreeDialogTitle,
                                                                                                           java.util.List<WritableDatabaseService> foldersToDisable)
        Add an option that allows the user to select a WritableDatabaseService which appears under one of the services returned from PluginUtilities.getWritableDatabaseServiceRoots(). Appears as either a label showing the name of the currently selected service with a button that pops up a tree to change the selected service, or simply as a service tree, depending on the value of the displayButton parameter.

        Parameters:
        name - the name to be used for referencing this option. For example from scripts or source code which wish to programmatically get or set the value of this option. Names should be in standard Java variable name style eg. "myAwesomeOption".
        label - a label describing this option to be displayed to the user. eg. "My Awesome Option"
        defaultValue - the default value for this option. May be null in which case Options.Option.getValue() on the Option may return a dummy service (with unique ID 'dummy') that returns no documents from its retrieve methods.
        rootServiceValidator - if not null, will be used to display only valid root services (and descendants)
        displayButton - if true, this option will be displayed as a button that pops up a tree, otherwise the option will be displayed directly as a tree
        showNewFolderButton - if true, the user will be provided with a button allowing them to create a new folder
        useStandardButtonLook - if false, the button will have appear "flat" against the background panel (has no effect if displayButton is false)
        folderTreeDialogTitle - if not null, this will be used as a title for the dialog displaying the service tree (has no effect if displayButton is false)
        foldersToDisable - a list of folders (and descendants) to disable in the service tree selector
        Returns:
        the newly added ServiceOption.
        Since:
        API 4.201900 (Geneious 2019.0.0)
      • addComboBoxOption

        public final <T extends Options.OptionValueOptions.ComboBoxOption<T> addComboBoxOption​(java.lang.String name,
                                                                                                 java.lang.String label,
                                                                                                 java.util.List<? extends T> possibleValues,
                                                                                                 T defaultValue)
        Add a new ComboBoxOption. This is a list of values that are provided to the user graphically as a combo box.

        For information on what the initial value of this option is set to see addStringOption.

        Parameters:
        name - the name to be used for referencing this option. For example from scripts or source code which wish to programmatically get or set the value of this option.
        label - a label describing this option to be displayed to the user. eg. "My Awesome Option"
        defaultValue - the default value for this option
        possibleValues - A list containing all possible values (i.e. all the entries to appear in the combo box)
        Returns:
        the newly added ComboBoxOption.
      • addDocumentSelectionOption

        public final DocumentSelectionOption addDocumentSelectionOption​(java.lang.String name,
                                                                        java.lang.String label,
                                                                        DocumentSelectionOption.FolderOrDocuments defaultValue,
                                                                        java.util.Set<DocumentType> allowedDocumentTypes,
                                                                        DocumentFilter documentFilter,
                                                                        java.lang.String documentTypeDescription,
                                                                        java.util.List<DocumentField> fieldsToDisplay,
                                                                        boolean allowMultipleSelections,
                                                                        java.util.List<AnnotatedPluginDocument> additionalDocuments)
        An option to allow the user to select a number of documents of a particular type from their local database. The list of documents is taken from the search index, so the user will not be able to choose documents unless search indexing has completed.

        To add a primer selection option, see addPrimerOption.

        Parameters:
        name - The name to be used for referencing this option. For example from scripts or source code which wish to programmatically get or set the value of this option. Names should be in standard Java variable name style eg. "myAwesomeOption". The name is used to restore recently used documents (if available), provide different names for this option if it is used for different purposes. Use DocumentSelectionOption.setPreferenceKeyForChooserDialog(String) to stop options with the same name from sharing preferences
        label - A label describing this option to be displayed to the user. eg. "My Awesome Option"
        defaultValue - The default value for this option.
        allowedDocumentTypes - The types of documents to allow the user to choose from (for example DocumentType.OLIGO_DOC_TYPE). The type you want to search on must be a type defined prior to the documents being indexed so if you introduce a new document type that matches existing documents those documents will not be found.
        documentFilter - An optional filter to further reject documents even if they are one of the provided allowedDocumentTypes. May be null to perform no additional filtering. The filter must not load the internal PluginDocuments. Instead it must only filter using properties of the AnnotatedPluginDocument
        documentTypeDescription - An optional description of what the allowedDocumentTypes and documentFilter accept. For example "linear nucleotide sequences". May be null in which case this implementation will choose an reasonable description
        fieldsToDisplay - A list of DocumentFields which will be displayed in columns in the document selection dialog. If the list is null, then one will be created from the fields present on the documents.
        allowMultipleSelections - True if the user is able to select more than one document at a time, also enables folder selection
        additionalDocuments - A list of additional documents (possibly not in the user's database), which the user can also choose from
        Returns:
        The newly added DocumentSelectionOption.
        Since:
        API 4.810 (Geneious 8.1.0)
        See Also:
        addPrimerSelectionOption(String, String, com.biomatters.geneious.publicapi.plugin.DocumentSelectionOption.FolderOrDocuments, boolean, java.util.List), DocumentSelectionOption.setAllowSearchCache(boolean), DocumentSelectionOption.setPreferenceKeyForChooserDialog(String)
      • addComboBoxOption

        public final <T extends Options.OptionValueOptions.ComboBoxOption<T> addComboBoxOption​(java.lang.String name,
                                                                                                 java.lang.String label,
                                                                                                 T[] possibleValues,
                                                                                                 T defaultValue)
        Add a new ComboBoxOption. This is a list of values that are provided to the user graphically as a combo box.

        For information on what the initial value of this option is set to see addStringOption.

        Parameters:
        name - the name to be used for referencing this option. For example from scripts or source code which wish to programmatically get or set the value of this option.
        label - a label describing this option to be displayed to the user. eg. "My Awesome Option"
        defaultValue - the default value for this option
        possibleValues - A list containing all possible values (i.e. all the entries to appear in the combo box)
        Returns:
        the newly added ComboBoxOption.
      • addRadioOption

        public final <T extends Options.OptionValueOptions.RadioOption<T> addRadioOption​(java.lang.String name,
                                                                                           java.lang.String label,
                                                                                           T[] possibleValues,
                                                                                           T defaultValue,
                                                                                           Options.Alignment alignment)
        Construct a new Radio option. This is a list of values that are provided to the user graphically as a set of radio buttons

        For information on what the initial value of this option is set to see addStringOption.

        Parameters:
        name - the name to be used for referencing this option. For example from scripts or source code which wish to programmatically get or set the value of this option.
        label - a non-null label describing this option to be displayed to the user. eg. "My Awesome Option"
        possibleValues - An array containing all possible values (i.e. all the radio button names)
        defaultValue - the default value for this option, not null
        alignment - the alignment of the radio buttons (horizontally or vertically)
        Returns:
        the newly added RadioOption.
      • addRadioOption

        public final <T extends Options.OptionValueOptions.RadioOption<T> addRadioOption​(java.lang.String name,
                                                                                           java.lang.String label,
                                                                                           java.util.List<T> possibleValues,
                                                                                           T defaultValue,
                                                                                           Options.Alignment alignment)
        Construct a new Radio option. This is a list of values that are provided to the user graphically as a set of radio buttons

        For information on what the initial value of this option is set to see addStringOption.

        Parameters:
        name - the name to be used for referencing this option. For example from scripts or source code which wish to programmatically get or set the value of this option.
        label - a non-null label describing this option to be displayed to the user. eg. "My Awesome Option"
        possibleValues - An array containing all possible values (i.e. all the radio button names)
        defaultValue - the default value for this option
        alignment - the alignment of the radio buttons (horizontally or vertically). Also consider using Options.RadioOption.setDependentPosition(RadioOption.DependentPosition) in addition to this
        Returns:
        the newly added RadioOption.
      • addColorChooserOption

        public final Options.Option<java.awt.Color,​javax.swing.JPanel> addColorChooserOption​(java.lang.String name,
                                                                                                   java.lang.String label,
                                                                                                   java.awt.Color defaultColor)
        Add an option for letting the user choose a Color
        Parameters:
        name - the name to be used for referencing this option. For example from scripts or source code which wish to programmatically get or set the value of this option.
        label - a non-null label describing this option to be displayed to the user. eg. "My Awesome Option"
        defaultColor - the default value for this option
        Returns:
        the newly added Option. The value can be obtained via Options.Option.getValue()
        Since:
        API 4.1100 (Geneious 11.0.0)
      • addFileSelectionOption

        public final Options.FileSelectionOption addFileSelectionOption​(java.lang.String name,
                                                                        java.lang.String label,
                                                                        java.lang.String defaultValue,
                                                                        java.lang.String[] selectableFileNames,
                                                                        java.lang.String buttonLabel)
        Add an option that provides functionality to let the user choose a file. For example, the cost matrix selection when doing a clustal alignment

        For information on what the initial value of this option is set to see addStringOption.

        If the file is expected to be an executable file, use addExecutableFileSelectionOption(String, String, String) instead

        Parameters:
        name - the name to be used for referencing this option. For example from scripts or source code which wish to programmatically get or set the value of this option.
        label - a label describing this option to be displayed to the user. eg. "My Awesome Option"
        defaultValue - the default value for this option
        selectableFileNames - A list of selectable filenames to be provided to the user.
        buttonLabel - The text displayed on the button instead of "Browse"
        Returns:
        the newly added FileSelectionOption.
        See Also:
        addExecutableFileSelectionOption(String, String, String)
      • addFileSelectionOption

        public final Options.FileSelectionOption addFileSelectionOption​(java.lang.String name,
                                                                        java.lang.String label,
                                                                        java.lang.String defaultValue,
                                                                        java.lang.String[] selectableFileNames,
                                                                        java.lang.String buttonLabel,
                                                                        java.io.FilenameFilter filter)
        Add an option that provides functionality to let the user choose a file. For example, the cost matrix selection when doing a clustal alignment

        For information on what the initial value of this option is set to see addStringOption.

        If the file is expected to be an executable file, use addExecutableFileSelectionOption(String, String, String) instead

        Parameters:
        name - the name to be used for referencing this option. For example from scripts or source code which wish to programmatically get or set the value of this option.
        label - a label describing this option to be displayed to the user. eg. "My Awesome Option"
        defaultValue - the default value for this option
        selectableFileNames - A list of selectable filenames to be provided to the user.
        buttonLabel - The text displayed on the button instead of "Browse"
        filter - Filter which matches filenames which are a valid selection. This field is not serialized.
        Returns:
        the newly added FileSelectionOption.
        See Also:
        addExecutableFileSelectionOption(String, String, String)
      • addFileSelectionOption

        public final Options.FileSelectionOption addFileSelectionOption​(java.lang.String name,
                                                                        java.lang.String label,
                                                                        java.lang.String defaultValue)
        Add an option that provides functionality to let the user choose a file. For example, the cost matrix selection when doing a clustal alignment

        For information on what the initial value of this option is set to see addStringOption.

        Parameters:
        name - the name to be used for referencing this option. For example from scripts or source code which wish to programmatically get or set the value of this option.
        label - a label describing this option to be displayed to the user. eg. "My Awesome Option"
        defaultValue - the default value for this option
        Returns:
        the newly added FileSelectionOption.
      • addExecutableFileSelectionOption

        public final Options.ExecutableFileSelectionOption addExecutableFileSelectionOption​(java.lang.String name,
                                                                                            java.lang.String label,
                                                                                            java.lang.String fileName)
        Adds an ExecutableFileSelectionOption where the default executable path is just the filename without a path component, i.e. assuming that the executable is on the PATH. This is the same as addExecutableFileSelectionOption(String,String,String,String) with arguments (name, label, fileName, fileName).
        Parameters:
        name - the name to be used for referencing this option. For example from scripts or source code which wish to programmatically get or set the value of this option.
        label - a label describing this option to be displayed to the user. eg. "My Awesome Option"
        fileName - The name of the executable file (without a path component) that we are looking for, e.g. "clustalw.exe". This will also be the default value for this option.
        Returns:
        the newly added ExecutableFileSelectionOption.
      • addExecutableFileSelectionOption

        public final Options.ExecutableFileSelectionOption addExecutableFileSelectionOption​(java.lang.String name,
                                                                                            java.lang.String label,
                                                                                            java.lang.String fileName,
                                                                                            java.lang.String defaultValue)
        Add an option that provides the user with an executable file name and provides assistance with finding the location of it. For example, when doing a clustal alignment, the option to choose the location of the clustal executable. Provides the user with an executable file name and provides assistance with finding the location of it.

        For information on what the initial value of this option is set to see addStringOption.

        Parameters:
        name - the name to be used for referencing this option. For example from scripts or source code which wish to programmatically get or set the value of this option.
        label - a label describing this option to be displayed to the user. eg. "My Awesome Option"
        fileName - The name of the executable file (without a path component) that we are looking for, e.g. "clustalw.exe". This will also be the default value for this option.
        defaultValue - The default location of the executable file; If you don't have a good default for this, it's probably best to assume it is on the PATH, and call addExecutableFileSelectionOption(String, String, String) instead.
        Returns:
        the newly added ExecutableFileSelectionOption.
      • beginAlignHorizontally

        public void beginAlignHorizontally​(java.lang.String label,
                                           boolean useEqualWidths)
        Starts a row of horizontally aligned options that will later be finished with a call to endAlignHorizontally(). The row will contain all options added between those two calls. At the time when the panel is created, all options in the row must agree whether they are advanced or not (see Options.Option.isAdvanced()). The row will fill any remaining available horizontal space if any of the options in the row would (see Options.Option.isFillHorizontalSpace() or if useEqualWidths is true. The row will stretch over the entire width of the options panel if label is null. A call to this method must precede exactly one corresponding later call to endAlignHorizontally(). While the aligned row of options is being populated (i.e. in the time between calling beginAlignHorizontally(String, boolean) and the corresponding call to endAlignHorizontally()), it is illegal to call either beginAlignHorizontally(String, boolean), createPanel() or createAdvancedPanel().
        Parameters:
        label - An optional label that is to be displayed at the left side of the current row in the options panel. A value of null indicates that no label will be displayed and that the horizontally aligned components will begin at the very left of the panel. A empty string label means that the horizontally aligned components will start to the right of standard component labels.
        useEqualWidths - true to make all horizontally alignment options have equal widths. This also expands the row to use the full width available.
      • getChildOptions

        public final java.util.Map<java.lang.String,​Options> getChildOptions()
        Get all child options added using addChildOptions(String, String, String, Options). The key in the returned map is the name specified as the parameter to addChildOptions.
        Returns:
        all child options.
      • addChildOptionsPageChooser

        public final Options.Option addChildOptionsPageChooser​(java.lang.String name,
                                                               java.lang.String label,
                                                               java.util.List<java.lang.String> disabledOptions,
                                                               Options.PageChooserType type,
                                                               boolean allChildOptionsApplySimultaneously)
        Makes all previously added child options available via a list of tab buttons. For example, when choosing to do an alignment, there are buttons along the top to select whether to do Geneious or clustal alignment. These are implemented as child options (using addChildOptions followed by calling this method. When choosing to build a tree from unaligned sequences, the alignment and tree building options are implemented as child options without calling this method.
        Parameters:
        name - A programmatic name used for referring to the option created for choosing which options are visible. This option can be retrieved using getChildOptionsPageChooser().
        label - A label displayed to the user
        disabledOptions - provides a list of child option names that are disabled
        type - the PageChooserType type of the chooser
        allChildOptionsApplySimultaneously - If this is false then after calling this method, choosing to restore defaults (restoreDefaults()) or save preferences (savePreferences()) will apply only to the child options of the currently visible page or to all pages if the options are not yet displayed.
        Returns:
        An option representing the page chooser. The string value (obtained using Options.Option.getValueAsString()) of the returned option will match the name of the currently selected child options (which is the first parameter given to addChildOptions(String, String, String, Options))
        Throws:
        java.lang.IllegalStateException - if this method is called more than once or if addChildOptions has been called less than twice.
        See Also:
        Options.Option.addChildOptionsDependent(Options, Object, boolean)
      • addCollapsibleChildOptions

        public final void addCollapsibleChildOptions​(java.lang.String name,
                                                     java.lang.String label,
                                                     java.lang.String description,
                                                     Options childOptions,
                                                     boolean useParentPreferences,
                                                     boolean defaultCollapsed)
        Add child options that can be expanded and collapsed. If a child options page chooser is added, these child options will not be one of the choices within the chooser, it will be kept outside the chooser.

        Only the basic panel for the child options will be within a collapsible panel, any advanced options will not be.

        Currently the collapsed state of the child options is remembered in preferences but this may be changed in the future.

        Parameters:
        name - specifies a prefix use for referencing individual options within childOptions
        label - a label for the child options which is shown on the expander button. must not be null or empty
        description - short description of the options used as the tooltip for the expander button
        childOptions - the child options
        useParentPreferences - If true, Store the preferences for this child when calling savePreferences() on this parent Options in a sub-node of the parent's preferences. If false, store the preferences for this child in its default preference node (independent of the parent preferences). NOTE: When savePreferences() is called on the child options directly, its default location is always used.
        defaultCollapsed - whether or not the child options should be collapsed or not by default.
        Since:
        API 4.11 (Geneious 5.0)
        See Also:
        addChildOptionsPageChooser(String, String, java.util.List, com.biomatters.geneious.publicapi.plugin.Options.PageChooserType, boolean), Options.Option.addChildOptionsDependent(Options, Object, boolean)
      • addMultipleOptions

        public final Options.MultipleOptions addMultipleOptions​(java.lang.String name,
                                                                Options multipleOptions,
                                                                boolean isAdvanced)
        Adds a set of Options so that the user is able to choose to have one or more instances of these child options through the use of +/- buttons to the right of the options.

        For example, this can be used to create the interface available when doing an advanced Geneious database search. In order to create a nice looking interface, you should consider using beginAlignHorizontally(String, boolean) and endAlignHorizontally() when constructing the multipleOptions parameter.

        Multiple options can have their values set and retrieved programatically via setStringValue(String, String) and getValueAsString(String) by using an option name of the form "multipleName.[0|1|2|...].childName". When using setStringValue(String,String), the numeric index may be equal to current number of values (found using Options.MultipleOptions.getValues().size()) to add a new set of values to these multiple options.

        Example:

             // First create some multiOptions consisting of a string and an integer displayed horizontally adjacent:
             Options multiOptions = new Options(OptionsTest.class);
             multiOptions.beginAlignHorizontally(null, false);
             multiOptions.addStringOption("stringOption", "String", "defaultValue");
             multiOptions.addIntegerOption("integerOption", "Integer", 5);
             multiOptions.endAlignHorizontally();
        
             final Options options = new Options(OptionsTest.class);
             options.addMultipleOptions("multi",multiOptions, false);
             options.setStringValue("multi.0.stringOption","test");
             options.setStringValue("multi.0.integerOption","6");
             // Now add a second set of values:
             options.setStringValue("multi.1.stringOption", "test2"); // this implicity adds "multi.1.integerOption" with value the default value (5)
        
             options.getValueAsString("multi.1.integerOption"); // returns "5";
         
        Implementation note: This feature is implemented by XMLSerializing the multipleOptions parameter and deserializing it again to create the multiple instances. While Options is XMLSerializable, it is not guarenteed that sub-classes fulfil the XMLSerializable contract. Trying to add multiple options for this case will cause a IllegalArgumentException to be thrown.
        Parameters:
        name - a programatic name for referring to the multiple options.
        multipleOptions - the multiple options to add.
        isAdvanced - true if these multiple options should appear in the advanced panel instead of the standard panel.
        Returns:
        the newly added multiple options.
        Throws:
        java.lang.IllegalArgumentException - if multipleOptions does not fulfil the XMLSerializable contract, or if any option in multiOptions is advanced.
        See Also:
        getMultipleOptions(String), Options.MultipleOptions.getValues()
      • addDivider

        public final Options.Option addDivider​(java.lang.String label)
        Add a new divider that is displayed between options when the options are graphically presented to the user.
        Parameters:
        label - An optional label to display to the left of the divider. Must not be null but may be an empty string.
        Returns:
        the newly added divider option
      • addLabel

        public final Options.Option<java.lang.String,​? extends javax.swing.JComponent> addLabel​(java.lang.String label)
        Add a new label that is displayed between options when the options are graphically presented to the user. This is a convenience method for calling addLabel(String, false, false).
        Parameters:
        label - The label to display to the user
        Returns:
        the newly added label option
      • addLabel

        public final Options.Option<java.lang.String,​? extends javax.swing.JComponent> addLabel​(java.lang.String label,
                                                                                                      boolean centreText,
                                                                                                      boolean spanEntirePanelWidth)
        Add a new label that is displayed between options when the options are graphically presented to the user. The option's value is the text displayed by the label, and can be changed and queried via Options.Option.setValue(Object) and Options.Option.getValue(), respectively.
        Parameters:
        label - The label to display to the user
        centreText - centre the text
        spanEntirePanelWidth - make this label span the entire width of the panel rather than using only the space to the right of standard component labels.
        Returns:
        the newly added label option. This is guaranteed to be a Options.LabelOption, but this method is not declared to return that for backwards compatibility reasons.
      • addLabelWithIcon

        public Options.LabelOption addLabelWithIcon​(java.lang.String label,
                                                    Icons icons)
        Adds a label with an icon to the left of it.
        Parameters:
        label - the label
        icons - the icon. Using an icon from StandardIcons is recommended.
        Returns:
        the label option added.
      • savePreferences

        public final void savePreferences​(java.lang.String preferenceNodeSuffix)
        Save the current option values persistently, i.e. across instantiations of the Java Virtual Machine. Next time these options are instantiated, they can be reset to these values instead of their defaults by using restorePreferences(). Typically, this should only be called immediately after a dialog containing the options panel has its OK button clicked.
        Parameters:
        preferenceNodeSuffix - An optional name under which the preferences should be stored. Varying this value allows storage of independent sets of preference values. Use null to store in the default location. Note that this suffix is used in addition to any suffix passed to the constructor, e.g. to Options(Class, String).
      • savePreferences

        public final void savePreferences()
        Save the current option values persistently in the default storage location by calling savePreferences(null)
      • restorePreferences

        public final void restorePreferences()
        Restore the current option values from the default persistent storage location by calling restorePreferences(null, false). This method should always be called from the Swing thread for Options which have previously had their GUI created via calling getPanel(). For Options which have not yet had Swing components created, it is OK to call this outside of the Swing thread.

        Note: If there is no value for an option in preferences then it value isn't changed by this method.

      • restorePreferences

        public final void restorePreferences​(java.lang.String preferenceNodeSuffix,
                                             boolean restorePreferencesOfOptionsThatHaveHadTheirValuesAlreadySet)
        Restores the current option values from persistent storage, i.e. across instantiations of the Java Virtual Machine. Typically, after clicking OK after showing a dialog containing the options, savePreferences() is called. Immediately prior to showing a dialog in future, restorePreferences() should be called.

        Note: If there is no value for an option in preferences then it value isn't changed by this method.

        Parameters:
        preferenceNodeSuffix - An optional name under which the preferences should be restored from. Varying this value allows storage of independent sets of preference values. Use null to restore from the default location. Note that this suffix is used in addition to any suffix passed to the constructor, e.g. to Options(Class, String).
        restorePreferencesOfOptionsThatHaveHadTheirValuesAlreadySet - In some cases it is not desirable to restore the preferences of Options that have had their value manually set. For example, an operation may want to set the value of an Option to match some property of of the selected documents. In this case when restorePreferences is later called, with this parameter false, the Options with values already set won't be restored to their saved values.
      • restoreDefaults

        public final void restoreDefaults()
        Restores all current option values and child options to their default values. If these Options have child options in a page chooser, and we are currently displaying these options graphically, then only those options on the currently visible page will have their defaults restored.

        This method does not affect the current values stored in preferences. If you wish to restore these to their defaults, immediately call savePreferences() after this method.

        See Also:
        canRestoreDefaults()
      • addDefaultsRestoredListener

        public void addDefaultsRestoredListener​(org.virion.jam.util.SimpleListener listener)
        add a listener to be notified when the options are restored to their defaults (e.g. when the restore defaults button is pressed in option dialogs).
        Parameters:
        listener - the listener to be notified
        Since:
        API 4.50 (Geneious 5.5.0)
        See Also:
        restoreDefaults()
      • removeDefaultsRestoredListener

        public void removeDefaultsRestoredListener​(org.virion.jam.util.SimpleListener listener)
        Remove a listener to be notified when the options are restored to their defaults (e.g. when the restore defaults button is pressed in option dialogs).
        Parameters:
        listener - the listener added using addDefaultsRestoredListener(org.virion.jam.util.SimpleListener).
        Since:
        API 4.50 (Geneious 5.5.0)
      • canRestoreDefaults

        public final boolean canRestoreDefaults()
        Return true if calling restoreDefaults() would change anything.
        Returns:
        true if calling restoreDefaults() would change anything.
      • isHideRestoreDefaultsButton

        public boolean isHideRestoreDefaultsButton()
        Returns:
        true if the "Restore Defaults" button or menu option should be hidden for dialogs shown on these options using methods such as Dialogs.showOptionsDialog(Options, String, boolean)
        Since:
        API 4.202121 (Geneious 2021.2.1)
      • setHideRestoreDefaultsButton

        public void setHideRestoreDefaultsButton​(boolean hideRestoreDefaultsButton)
        Sets whether to hide the "Restore Defaults" button in options dialogs. The default behaviour is to show the "Restore Defaults" button.
        Parameters:
        hideRestoreDefaultsButton - true if the "Restore Defaults" button or menu option should be hidden for dialogs shown on these options using methods such as Dialogs.showOptionsDialog(Options, String, boolean)
        Since:
        API 4.202120 (Geneious 2021.2.0)
      • valuesToXML

        public final org.jdom.Element valuesToXML​(java.lang.String rootElementName)
        Serializes the current values for these options to XML for use with a later call to valuesFromXML(org.jdom.Element). This does not serialize the options (names, descriptions etc) themselves. Use toXML() to do this
        Parameters:
        rootElementName - the name of the root element for the returned XML
        Returns:
        an XML representation of the option values.
        See Also:
        valuesFromXML(org.jdom.Element)
      • valuesToXML

        public final org.jdom.Element valuesToXML​(Geneious.MajorVersion version,
                                                  java.lang.String rootElementName)
        Serializes the current values for these options to XML for use with a later call to valuesFromXML(org.jdom.Element). This does not serialize the options (names, descriptions etc) themselves. Use toXML() to do this
        Parameters:
        version - the version of Geneious to make the XML compatible with
        rootElementName - the name of the root element for the returned XML
        Returns:
        an XML representation of the option values.
        Since:
        API 4.600 (Geneious 6.0.0)
        See Also:
        valuesFromXML(org.jdom.Element)
      • valuesToXML

        public final org.jdom.Element valuesToXML​(Geneious.MajorVersion version,
                                                  java.lang.String rootElementName,
                                                  boolean excludeOptionsWhereRestorePreferenceApplies)
        Serializes the current values for these options to XML for use with a later call to valuesFromXML(org.jdom.Element). This does not serialize the options (names, descriptions etc) themselves. Use toXML() to do this
        Parameters:
        version - the version of Geneious to make the XML compatible with
        rootElementName - the name of the root element for the returned XML
        excludeOptionsWhereRestorePreferenceApplies - true to exclude option values from the returned XML for which is true. This is useful when we want to save the values of only those options that would not be saved during restorePreferences()
        Returns:
        an XML representation of the option values. If excludeOptionsWhereRestorePreferenceApplies==true and no applicable options were found, then null may be returned
        Since:
        API 4.810 (Geneious 8.1.0)
        See Also:
        valuesFromXML(org.jdom.Element)
      • valuesFromXML

        public final void valuesFromXML​(org.jdom.Element root)
        Deserializes the current values for these options from XML. Calls valuesFromXML(root, true) This does not deserialize the options (names, descriptions etc) themselves. Use fromXML(org.jdom.Element) to do this. This method should always be called from the Swing thread for Options which have previously had their GUI created via calling getPanel(). For Options which have not yet had Swing components created, it is OK to call this outside of the Swing thread.
        Parameters:
        root - some XML returned from a previous call to valuesToXML(String). Must not be null
        See Also:
        valuesToXML(String), valuesFromXML(Element, boolean)
      • valuesFromXML

        public final void valuesFromXML​(org.jdom.Element root,
                                        boolean includeOptionsWhichDontRestorePreferences)
        Deserializes the current values for these options from XML. This does not deserialize the options (names, descriptions etc) themselves. Use fromXML(org.jdom.Element) to do this. This method should always be called from the Swing thread for Options which have previously had their GUI created via calling getPanel(). For Options which have not yet had Swing components created, it is OK to call this outside of the Swing thread.
        Parameters:
        root - some XML returned from a previous call to valuesToXML(String). Must not be null
        includeOptionsWhichDontRestorePreferences - true to include options for which Options.Option.setRestorePreferenceApplies(boolean) is false.
        Since:
        API 4.702 (Geneious 7.0.2)
        See Also:
        valuesToXML(String)
      • valuesFromXMLReturningErrors

        public final java.util.List<java.lang.String> valuesFromXMLReturningErrors​(org.jdom.Element root,
                                                                                   boolean includeOptionsWhichDontRestorePreferences)
        Deserializes the current values for these options from XML. This does not deserialize the options (names, descriptions etc) themselves. Use fromXML(org.jdom.Element) to do this.
        Parameters:
        root - some XML returned from a previous call to valuesToXML(String). Must not be null
        includeOptionsWhichDontRestorePreferences - true to include options for which Options.Option.setRestorePreferenceApplies(boolean) is false.
        Returns:
        a list of errors if some of the options or values can't be deserialized.
        Since:
        API 4.910 (Geneious 9.1.0)
        See Also:
        valuesToXML(String)
      • addChangeListener

        public final void addChangeListener​(org.virion.jam.util.SimpleListener listener)
        add a listener to be notified when the value of any option changes The listener is also notified if some options requires an active license, and the licence type changes.
        Parameters:
        listener - the listener to be notified
      • removeChangeListener

        public final void removeChangeListener​(org.virion.jam.util.SimpleListener listener)
        Remove a listener to be notified when the value of any option changes
        Parameters:
        listener - the listener added using addChangeListener(org.virion.jam.util.SimpleListener).
      • verifyOptionsAreValid

        public java.lang.String verifyOptionsAreValid()
        Override this to have the current contents of options checked (for example String options that allow the user to enter arbitrary text) to make sure they are valid before proceeding. When used in a graphical environment, if this function returns a non-null value, then the options dialog will remain open for the user to correct the invalid input. The default implementation of this method returns the first non-null result of calling this method on the first visible child options or null if these Options have no child options.

        To preserve this behavior, it is strongly recommended that any class that overrides this method begin its implementation with code similar to the following:

         String superMessage = super.verifyOptionsAreValid();
         if (superMessage != null) {
             return superMessage;
         }

        areValuesGoodEnoughToContinue() and verifyOptionsAreValid are two methods that essentially provide the same functionality, although depending on your use case, one may be simpler to implement than the other. For example verifyOptionsAreValid handles displaying a dialog for you. It is recommended that an Options implementation only implement one of these two methods.

        Returns:
        null if the current option values are valid or a String message describing how the options are invalid.
        See Also:
        areValuesGoodEnoughToContinue()
      • areValuesGoodEnoughToContinue

        public boolean areValuesGoodEnoughToContinue()
        This is called by Geneious when the user clicks OK in the options dialog. The options may wish to confirm with the user (by displaying a dialog) if they really want to continue using the selected options. For example, the Geneious assembler checks if the user probably has enough free memory to perform the assembly with these options and warns them if not.

        The default implementation of this method returns the false if any of the visible child options returns false, or returns true otherwise. To preserve this behavior, it is strongly recommended that any class that overrides this method begin its implementation with the following:

         if (!super.areValuesGoodEnoughToContinue()) {
             return false;
         }

        areValuesGoodEnoughToContinue and verifyOptionsAreValid() are two methods that essentially provide the same functionality, although depending on your use case, one may be simpler to use than the other. For example verifyOptionsAreValid handles displaying a dialog for you. It is recommended that an Options implementation only implement one of these two methods.

        Returns:
        false to cancel pressing the OK button (it goes back to showing the options again)
        Since:
        API 4.14 (Geneious 5.1)
        See Also:
        verifyOptionsAreValid()
      • getPanel

        public final javax.swing.JPanel getPanel()
        Get a graphical panel used to display these options. Multiple calls to this method return the same panel which is created once via createPanel() and cached.

        This method must be called from the swing thread.
        Returns:
        a graphical panel used to display these options or null if there are no options
      • createPanel

        protected javax.swing.JPanel createPanel()
        Creates a graphical panel used to display these options. This includes all options added using any of the add*Option methods. (addBooleanOption, addStringOption, addOption etc). and addChildOptions. Override this method to customise the layout of the options. This method is called the first time getPanel() is called and the return value cached. The default implementation displays a vertical list of all non-advanced options, one per line.

        If you do choose to customise the layout, the custom components must automatically listen to changes to themselves and immediately reflect those in the values of the options. The components must also listen to changes in the value of their responding Option and reflect that in the value of the component. The recommended way to do this automatically is to use Options.Option.getComponent() which automatically does all of this. So just add that component to an appropriate location within a panel. For example, here is a code fragment of some options which customise their layout

        
             private static class CustomOptions extends Options {
             final StringOption test;
             final BooleanOption test2;
             public CustomOptions() {
             super(CustomOptions.class);
             test=addStringOption ("test", "test", "value");
             test2=addBooleanOption ("test2", "test2", true);
             }
        
             protected JPanel createPanel() {
             JPanel panel =new JPanel();
        
             // Add both the label and the component:
             panel.add(new JLabel(test.getLabel()));
             panel.add(test.getComponent());
        
             // For a boolean (checkbox)  option, it doesn't have a separate label so just add the component:
             panel.add(test2.getComponent());
             return panel;
             }
             }
        
         
        Returns:
        a graphical panel used to display these options or null if there are no options
        Throws:
        java.lang.IllegalStateException - If there is a row created with beginAlignHorizontally(String, boolean), endAlignHorizontally() in which some options are advanced and some are nonadvanced.
      • setLeftAlignLabels

        public void setLeftAlignLabels​(boolean leftAlignLabels)
        Ensures the labels of all options are left aligned rather than the default behaviour of aligning labels so that their right hand sides are vertically aligned with each other. This method is only applicable for options within their own row (i.e. not inside a beginAlignHorizontally() block)
        Parameters:
        leftAlignLabels - true to left align labels of options
        Throws:
        java.lang.IllegalStateException - if getPanel() or getAdvancedPanel() has already been called on these options.
        Since:
        API 4.202011 (Geneious 2020.1.1)
      • setPlaceOptionsOnLeft

        public void setPlaceOptionsOnLeft​(boolean placeOptionsOnLeft)
        Attempts to place all options on the left instead of the normal centred layout. Options within child options will not be affected, they should call this method themselves if they want to be placed on the left. This method will also set setHorizontallyCompact(boolean) to the same value passed into this method.
        Parameters:
        placeOptionsOnLeft - true to place options on the left of the dialog instead of in the centre
        Throws:
        java.lang.IllegalStateException - if getPanel() or getAdvancedPanel() has already been called on these options.
        Since:
        API 4.202220 (Geneious 2022.2.0)
      • getAdvancedPanel

        public final javax.swing.JPanel getAdvancedPanel()
        Get a graphical panel used to display advanced options. Multiple calls to this method return the same panel which is created once via createAdvancedPanel() and cached.
        Returns:
        a graphical panel used to display the advanced options or null if there are no advanced options.
      • createAdvancedPanel

        protected javax.swing.JPanel createAdvancedPanel()
        Creates a graphical panel used to display advanced options. Override this method to customise the layout of the advanced options. This method is called the first time getAdvancedPanel() is called and the return value cached. The default implementation displays a vertical list of all advanced options, one per line.
        Returns:
        a graphical panel used to display the advanced options or null if there are no advanced options.
        Throws:
        java.lang.IllegalStateException - If there is a row created with beginAlignHorizontally(String, boolean), endAlignHorizontally() in which some options are advanced and some are nonadvanced.
      • getValue

        public final java.lang.Object getValue​(java.lang.String optionName)
        get the value of the option with the name optionName. As of 2007-04-16, it is not specified whether this will return the exact same object that was last set on this option, or a copy of that value (the value set on the object may have been passed to setValue(String, Object), Options.Option.setDisabledValue(Object) or to the Option's constructor as the default value.
        Parameters:
        optionName - the name of the option to get the value for
        Returns:
        the value or null if there is no option with this name.
      • setValue

        public final boolean setValue​(java.lang.String optionName,
                                      java.lang.Object value)
        set the value of an option
        Parameters:
        optionName - the name of the option to set the value for
        value - the value to set. Note - since Options are implemented using Java generics, there is no way to ensure that value is the correct class type at run time. Therefore, the value given here it is converted to a string and then converted back to an object of the expected type, or the default option value if it is invalid. Essentially, this is what this method implementation looks like:
        
         return setStringValue(optionName, value.toString());
         

        Note: This method is not thread safe. See documentation towards the end of Options.

        Warning: It is almost always preferable to use Options.Option.setValue(Object) because it is typesafe. The Option object on which to set the value can either be obtained via getOption(String), or may be exposed by the Options subclass via a getter method (e.g. getMaxIterationsOption() or similar). A subclass may also choose to provide direct getter and setter methods for particular option values, e.g. int getMaxIterations() and setMaxIterations(int) in the example case of an option holding the maximum number of iterations for something.

        Returns:
        false if there is not an option with this name or the option can't be set to this value (e.g. it being a combo box with a limited supported values, or the option may be disabled)
      • setValueOrFail

        public final void setValueOrFail​(java.lang.String optionName,
                                         java.lang.Object value)
                                  throws com.biomatters.geneious.publicapi.plugin.DocumentOperationException
        Like setValue(String, Object) but throws a DocumentOperationException if an option value can't be set rather than returning false.
        Use setValueOrFail(java.lang.String, java.lang.Object) if Geneious should fail gracefully if the option can't be set. For example a workflow may have been written so set operation values, but if that operation has been changed in later versions we should fail gracefully.
        Use setValueOrCrash(java.lang.String, java.lang.Object) instead if it's a bug and Geneious should crash with an error report if the option can't be set. For example a Biomatters developer is calling one bundled plugin from another bundled plugin.
        Throws:
        com.biomatters.geneious.publicapi.plugin.DocumentOperationException - if either an option with this name does not exist or if the value is invalid for that option.
        Since:
        API 4.201900 (Geneious 2019.0.0)
      • setValueOrCrash

        public final void setValueOrCrash​(java.lang.String optionName,
                                          java.lang.Object value)
        Like setValue(String, Object) but throws an IllegalArgumentException if an option value can't be set rather than returning false Use setValueOrCrash(java.lang.String, java.lang.Object) if it's a bug and Geneious should crash with an error report if the option can't be set. For example a Biomatters developer is calling one bundled plugin from another bundled plugin.
        Use setValueOrFail(java.lang.String, java.lang.Object) instead if Geneious should fail gracefully if the option can't be set. For example a workflow may have been written so set operation values, but if that operation has been changed in later versions we should fail gracefully.
        Throws:
        java.lang.IllegalArgumentException - if either an option with this name does not exist or if the value is invalid for that option.
        Since:
        API 4.201900 (Geneious 2019.0.0)
      • setStringValue

        public final boolean setStringValue​(java.lang.String optionName,
                                            java.lang.String value)
        set the value of an option
        Parameters:
        optionName - the name of the option to set the value for
        value - a string representation of the value to set. The string will be converted to an object of the expected type, or the default option value if it is invalid.

        Note: This method is not thread safe. See documentation towards the end of Options.

        Returns:
        false if there is not an option with this name or the option can't be set to this value (e.g. it being a combo box with a limited supported values). This will return true on a disabled option that has a Options.Option.setDisabledValue(Object) as long as the value set is what the option would return from Options.Option.getValueWhenEnabled()
      • setStringValueOrFail

        public final void setStringValueOrFail​(java.lang.String optionName,
                                               java.lang.String value)
                                        throws com.biomatters.geneious.publicapi.plugin.DocumentOperationException
        Like setStringValue(String, String) but throws a DocumentOperationException if an option value can't be set rather than returning false.
        Use setStringValueOrFail(java.lang.String, java.lang.String) if Geneious should fail gracefully if the option can't be set. For example a workflow may have been written so set operation values, but if that operation has been changed in later versions we should fail gracefully.
        Use setStringValueOrCrash(java.lang.String, java.lang.String) instead if it's a bug and Geneious should crash with an error report if the option can't be set. For example a Biomatters developer is calling one bundled plugin from another bundled plugin.
        Throws:
        com.biomatters.geneious.publicapi.plugin.DocumentOperationException - if either an option with this name does not exist or if the value is invalid for that option.
        Since:
        API 4.201900 (Geneious 2019.0.0)
      • setStringValueOrCrash

        public final void setStringValueOrCrash​(java.lang.String optionName,
                                                java.lang.String value)
        Like setStringValue(String, String) but throws a DocumentOperationException if an option value can't be set rather than returning false.
        Use setStringValueOrCrash(java.lang.String, java.lang.String) if it's a bug and Geneious should crash with an error report if the option can't be set. For example a Biomatters developer is calling one bundled plugin from another bundled plugin.
        Use setStringValueOrFail(java.lang.String, java.lang.String) instead if Geneious should fail gracefully if the option can't be set. For example a workflow may have been written so set operation values, but if that operation has been changed in later versions we should fail gracefully.
        Throws:
        com.biomatters.geneious.publicapi.plugin.DocumentOperationException - if either an option with this name does not exist or if the value is invalid for that option.
        Since:
        API 4.201900 (Geneious 2019.0.0)
      • getOption

        public final Options.Option getOption​(java.lang.String optionName)
        Get an option or child option.
        Parameters:
        optionName - the name of the option or the childOptions name followed by a "." followed by an option name within those child options.
        Returns:
        the Option corresponding to this name, or null if it doesn't exist.
      • getValueAsString

        public final java.lang.String getValueAsString​(java.lang.String optionName)
        Get the value of this option as a string. Note: It is usually preferable to use Options.Option.getValue() because it is typesafe. If you don't have the Option object available, use getOption(String). A subclass may also choose to expose the Option via a getter method (e.g. getMaxIterationsOption() or similar) so that it can be typed correctly rather than just as a generic Option. A subclass may also choose to provide direct getter and setter methods for particular option values, e.g. int getMaxIterations() and setMaxIterations(int) in the example case of an option holding the maximum number of iterations for something.
        Parameters:
        optionName - the name of the option to get the value for, or empty string if the option does not exist
        Returns:
        the value of this option is a string.
      • toXML

        public org.jdom.Element toXML()
        Description copied from interface: XMLSerializable
        Convert object to a JDOM element. The representation should be complete so that XMLSerializable.fromXML(org.jdom.Element) can completely restore the object's representation.

        It is recommended that the returned element use XMLSerializable.ROOT_ELEMENT_NAME as its name, in which case it must not define an attribute called "type". In this case, fromXML, will be called with an element whose name may differ from the element return from this function. This recommendation allows a more compact representation of the XML can be stored.

        This method generally should not be called directly. Instead, you should usually call XMLSerializer.classToXML(String, XMLSerializable) which calls this method internally.

        PluginDocument implementations of this method may choose to throw an XMLSerializationException, enclosed in a RuntimeException.

        Specified by:
        toXML in interface XMLSerializable
        Returns:
        object encoded as a JDOM element
      • fromXML

        public void fromXML​(org.jdom.Element element)
                     throws XMLSerializationException
        Description copied from interface: XMLSerializable
        Restore the object from the JDOM Element returned by XMLSerializable.toXML().

        This method generally should not be called directly. Instead, you should usually call XMLSerializer.classFromXML(org.jdom.Element) or XMLSerializer.classFromXML(org.jdom.Element, Class) which calls this method internally.

        It is optional to implement this method. Instead of implementing an empty constructor and implementing this method properly, the implementation may instead throw an UnsupportedOperationException and implement a constructor that takes a single Element as a parameter. This allows for cleaner code such as support for final fields in the XMLSerializable class.

        The element parameter should not be modified since it may be reused. If you need a modified version of it, take a copy with Element.clone().

        Specified by:
        fromXML in interface XMLSerializable
        Parameters:
        element - representation from a previous call to XMLSerializable.toXML()
        Throws:
        XMLSerializationException - if the Element can't be converted into this type of object
      • setHorizontallyCompact

        public void setHorizontallyCompact​(boolean horizontallyCompact)
        Flags the basic options to be displayed in a visually compact form suitable for displaying in a limited amount of space. When horizontally compact, the options will be left aligned rather than centered. Call setHorizontallyCompactAdvanced(boolean) to make the advanced options horizontally compact.
        Parameters:
        horizontallyCompact - true to display a compact form of these options.
        Throws:
        java.lang.IllegalStateException - if getPanel() has already been called on these options.
      • setHorizontallyCompactAdvanced

        public void setHorizontallyCompactAdvanced​(boolean horizontallyCompact)
        Flags the advanced options to be displayed in a visually compact form suitable for displaying in a limited amount of space. When horizontally compact, the options will be left aligned rather than centered.
        Parameters:
        horizontallyCompact - true to display a compact form of these options.
        Throws:
        java.lang.IllegalStateException - if getPanel() has already been called on these options.
      • setInScrollPane

        public void setInScrollPane​(boolean inScrollPane)
        Specifies whether the options should be displayed in a scroll pane if the panel is shrunk below it's preferred size. By default this is true.
        Parameters:
        inScrollPane - true to have the options added to scroll pane
        Throws:
        java.lang.IllegalStateException - if getPanel() has already been called on these options.
      • setVerticallyCompact

        public void setVerticallyCompact​(boolean verticallyCompact)
        Flags the basic options to be displayed in a visually compact form suitable for displaying in a limited amount of space. Call setVerticallyCompactAdvanced(boolean) to make the advanced panel vertically compact.
        Parameters:
        verticallyCompact - true to display a compact form of these options.
        Throws:
        java.lang.IllegalStateException - if getPanel() has already been called on these options.
      • setVerticallyCompactAdvanced

        public void setVerticallyCompactAdvanced​(boolean verticallyCompact)
        Flags the advanced options to be displayed in a visually compact form suitable for displaying in a limited amount of space.
        Parameters:
        verticallyCompact - true to display a compact form of these options.
        Throws:
        java.lang.IllegalStateException - if getPanel() has already been called on these options.
      • isHorizontallyCompact

        public boolean isHorizontallyCompact()
        Returns true if these options or any ancestor options have been set as horizontally compact using setHorizontallyCompact(boolean).
        Returns:
        true if these options or any ancestor options have been set as horizontally compact using setHorizontallyCompact(boolean).
      • addHelpButton

        public void addHelpButton​(java.lang.String dialogTitle,
                                  java.lang.String dialogMessage)
        Since:
        API 4.610 (Geneious 6.1.0)
      • addHelpButtonOption

        public Options.Option addHelpButtonOption​(java.lang.String dialogTitle,
                                                  java.lang.String dialogMessage)
        Adds a little help button (with a question mark on it) which when clicked shows a dialog containing a message. Alternatively, to add a help button associated with a particular option, use Options.Option.setHelp(String)
        Parameters:
        dialogTitle - the title of the dialog
        dialogMessage - the contents of the dialog, which may be html.
        Returns:
        an Option representing the button.
        Since:
        API 4.711 (Geneious 7.1.1)
        See Also:
        Options.Option.setHelp(String)
      • getOptionsHelp

        public java.lang.String getOptionsHelp()
        Override this method and return a non-null value to have it displayed as html in a dialog when the user clicks on a small help button in the corner of any window showing these options.
        Returns:
        an html fragment with help pertaining to these options or null for no help
        Since:
        API 4.800 (Geneious 8.0.0)