Class Options.MultipleOptions

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addChangeListener​(org.virion.jam.util.SimpleListener listener)
      Add a listener to be notified when any of the values or number of values for these multiple options change.
      void addOptionsToShowOnlyInFirstRow​(Options.Option... options)
      Add options that should only show up in the first instance of these multi options.
      Options addValue​(boolean fireChangeListeners)
      Clone and add a new copy of the master options to these multiple options.
      void fromXML​(org.jdom.Element element)
      Restore the object from the JDOM Element returned by XMLSerializable.toXML().
      javax.swing.JComponent getComponent()
      Get a component used to display these multiple options.
      Options getMasterOptions()
      Returns the options that were used to construct this MultipleOptions.
      java.util.List<Options> getValues()
      Get all the current values for a set of multiple options.
      boolean isEnabled()
      Determine if these MultipleOptions appear enabled.
      void removeChangeListener​(org.virion.jam.util.SimpleListener listener)
      Removes a listener previously added using addChangeListener(org.virion.jam.util.SimpleListener).
      void removeOptionsFromOptionsToShowOnlyInFirstRow​(Options.Option... options)
      Removes options that were previously added to only show up in the first instance of these multi options so that these options show up in all rows again.
      void removeValue​(Options value)
      Removes one of the multiple options terms.
      void restoreDefaults()
      Restores these MultipleOptions to their default value (i.e.
      void setAddOptionsUnderneathCurrentIndex​(boolean addOptionsUnderneathCurrentIndex)
      Set whether new options that are added with the 'add button' should appear directly underneath the option whose add button was pressed, or whether they should be added at the bottom of the options (default).
      void setAllowPreferenceRestorationEvenIfSetValueCalled​(boolean value)
      Allows these MultipleOptions to have their preferences restored even if they detect that some of their child options have had their values set already.
      void setButtonVisibility​(boolean isShowAddButton, boolean isShowRemoveButton)
      Use this method to show or hide all of the add or remove buttons for this MultipleOptions.
      void setCanRemoveFirstRow​(boolean canRemoveFirstRow)
      Set whether or not the user can remove the first row or not.
      void setCurrentValuesAsDefaults()
      Sets the current values of these multiple options as the default values.
      void setEnabled​(boolean enabled)
      Sets the enabled state of all these MultipleOptions.
      void setVisible​(boolean visible)
      Sets the visibility of the graphical component that displays these multiple options and makes appropriate changes to the size of the window (if any) that contains the graphical component.
      org.jdom.Element toXML()
      Convert object to a JDOM element.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • addChangeListener

        public void addChangeListener​(org.virion.jam.util.SimpleListener listener)
        Add a listener to be notified when any of the values or number of values for these multiple options change.
        Parameters:
        listener - the listener to be notified
      • setEnabled

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

        public void setVisible​(boolean visible)
        Sets the visibility of the graphical component that displays these multiple 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 multiple options should be visible.
      • isEnabled

        public boolean isEnabled()
        Determine if these MultipleOptions appear enabled. MultipleOptions appear enabled only if they are currently set as enabled ( using setEnabled(boolean) which is true by default) and if all their parent options appear enabled.
        Returns:
        true if these options appear enabled.
      • addValue

        public Options addValue​(boolean fireChangeListeners)
        Clone and add a new copy of the master options to these multiple options.
        Parameters:
        fireChangeListeners - whether to fire the value change listeners for the multiple options
        Returns:
        the new copy of the master options that were added
      • removeValue

        public void removeValue​(Options value)
        Removes one of the multiple options terms. If the last value is removed, it is strongly advised you call addValue(boolean) shortly after or things may behave weirdly.
        Parameters:
        value - the value to remove. This should be one of the values returned from getValues()
        Since:
        API 4.600 (Geneious 6.0.0)
      • getComponent

        public javax.swing.JComponent getComponent()
        Get a component used to display these multiple options. This component includes all the +/- buttons as well as the panels showing the contained options.
        Returns:
        a component used to display these multiple options
      • 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
      • restoreDefaults

        public void restoreDefaults()
        Restores these MultipleOptions to their default value (i.e. one copy of the options, at its default values).
        Since:
        API 4.40 (Geneious 5.4.0)
      • setAllowPreferenceRestorationEvenIfSetValueCalled

        public void setAllowPreferenceRestorationEvenIfSetValueCalled​(boolean value)
        Allows these MultipleOptions to have their preferences restored even if they detect that some of their child options have had their values set already. This can be useful in situations where you wish to set an initial value on certain of the options instances, but not have this prevent a user's previous settings from taking effect.
        Parameters:
        value - the desired value of this setting
        Since:
        API 4.201900 (Geneious 2019.0.0)
      • setCurrentValuesAsDefaults

        public void setCurrentValuesAsDefaults()
        Sets the current values of these multiple options as the default values.
        Since:
        API 4.700 (Geneious 7.0.0)
      • getMasterOptions

        public Options getMasterOptions()
        Returns the options that were used to construct this MultipleOptions. You can alter the value of the Options.Options inside the Options, but do not add any further options.
        Returns:
        the options that were used to construct this MultipleOptions
        Since:
        API 4.40 (Geneious 5.4.0)
        See Also:
        MultipleOptions(String, Options, boolean)
      • setButtonVisibility

        public void setButtonVisibility​(boolean isShowAddButton,
                                        boolean isShowRemoveButton)
        Use this method to show or hide all of the add or remove buttons for this MultipleOptions. If you want to disable the first row, see setCanRemoveFirstRow(boolean).
        Parameters:
        isShowAddButton - True to show all add buttons, false to disable
        isShowRemoveButton - True to show all remove buttons, false to disable
        Since:
        API 4.1101 (Geneious 11.0.1)
        See Also:
        setCanRemoveFirstRow(boolean)
      • setCanRemoveFirstRow

        public void setCanRemoveFirstRow​(boolean canRemoveFirstRow)
        Set whether or not the user can remove the first row or not. Note that no matter what value is set here, if there is only a single row it cannot be removed. This method is intended for use cases where the first row has special significance such that the user can never remove it even if they add other rows.
        Parameters:
        canRemoveFirstRow - can user remove the first row or not
        Since:
        API 4.1101 (Geneious 11.0.1)
        See Also:
        setButtonVisibility(boolean, boolean)
      • setAddOptionsUnderneathCurrentIndex

        public void setAddOptionsUnderneathCurrentIndex​(boolean addOptionsUnderneathCurrentIndex)
        Set whether new options that are added with the 'add button' should appear directly underneath the option whose add button was pressed, or whether they should be added at the bottom of the options (default).
        Parameters:
        addOptionsUnderneathCurrentIndex - true if the options should be added immediately underneath the current option, false if it should be added at the end
        Since:
        API 4.201900 (Geneious 2019.0.0)
      • addOptionsToShowOnlyInFirstRow

        public void addOptionsToShowOnlyInFirstRow​(Options.Option... options)
        Add options that should only show up in the first instance of these multi options. This method is intended for use cases where the first row has special options that should not be repeated, such as headers. Note: the options will still be added, but the status will be set as invisible.
        Parameters:
        options - options that are supposed to show up only on the first instance of these multi options.
        Since:
        API 4.201900 (Geneious 2019.0.0)
      • removeOptionsFromOptionsToShowOnlyInFirstRow

        public void removeOptionsFromOptionsToShowOnlyInFirstRow​(Options.Option... options)
        Removes options that were previously added to only show up in the first instance of these multi options so that these options show up in all rows again.
        Parameters:
        options - options that are supposed to show up in all rows but might have been previously limited to the first row only. Options that were not previously added with addOptionsToShowOnlyInFirstRow(Option...) will be ignored.
        Since:
        API 4.201900 (Geneious 2019.0.0)