Class Options.EditableComboBoxOption

  • All Implemented Interfaces:
    XMLSerializable
    Enclosing class:
    Options

    public static class Options.EditableComboBoxOption
    extends Options.Option<java.lang.String,​GComboBox>
    Like a ComboBoxOption, but besides letting the user choose one of the preconfigured default values, also allows arbitrary custom strings to be entered. Therefore, the value of this option can be an arbitrary string.
    • Method Detail

      • 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
        Overrides:
        toXML in class Options.Option<java.lang.String,​GComboBox>
        Returns:
        object encoded as a JDOM element
      • getPossibleValues

        public java.lang.String getPossibleValues()
        Description copied from class: Options.Option
        Provide a descriptive string representation of possible values of this option. For example, combo box and radio options should provide a list of all available values. The default implementation returns null. Radio and ComboBox options provide Options.ComboBoxOrRadioOption.getPossibleOptionValues() to get possible values as a List of OptionValues.
        Overrides:
        getPossibleValues in class Options.Option<java.lang.String,​GComboBox>
        Returns:
        a descriptive string representation of possible values of this option or null if this option may have any String value.
        See Also:
        Options.ComboBoxOrRadioOption.getPossibleOptionValues()
      • getValueFromString

        public java.lang.String getValueFromString​(java.lang.String value)
        Description copied from class: Options.Option
        Convert a String into an instance of the object type used by this option. This method should generally create a new object every time it is invoked. Only disregard this advice if you know what you are doing - e.g. it is safe to maintain an object pool and return the same object more than once if your Option's ValueType is immutable.

        This method is the inverse of Options.Option.getValueAsString(Object) .

        Specified by:
        getValueFromString in class Options.Option<java.lang.String,​GComboBox>
        Parameters:
        value - the string representation of the object value
        Returns:
        the object value or the default value if the string representation is not valid.
      • getExtraPersistentInformation

        protected java.lang.String getExtraPersistentInformation()
        Description copied from class: Options.Option
        Gets any information in addition to the option value that should be persistent between instances. For example, an editable combo box option stores a list of previous entries the user has entered. The default implementation returns null.
        Overrides:
        getExtraPersistentInformation in class Options.Option<java.lang.String,​GComboBox>
        Returns:
        any additional persistent information or null if this option has none.
      • setExtraPersistentInformation

        protected void setExtraPersistentInformation​(java.lang.String extras)
        Description copied from class: Options.Option
        Sets any information in addition to the option value that should be persistent between instances. For example, an editable combo box option stores a list of previous entries the user has entered. The default implementation does nothing.
        Overrides:
        setExtraPersistentInformation in class Options.Option<java.lang.String,​GComboBox>
        Parameters:
        extras - any additional persistent information or null if this option has none.
      • createComponent

        protected GComboBox createComponent()
        Description copied from class: Options.Option
        Create a graphical component representing this option. The implementation is responsible for making sure that the returned component is initialised to the current value of Options.Option.getValue(). The implementation is also responsible for making sure that the returned component listens to any changes made to itself and reflects those changes in the value of this option using the Options.Option.setValue(Object) method. This method will only be called once for each instance of an Option. After it has been called, getComponent() will return a cached copy of it.
        Specified by:
        createComponent in class Options.Option<java.lang.String,​GComboBox>
        Returns:
        a graphical component representing this option. May not be null.
      • setSelectableValues

        public void setSelectableValues​(java.lang.String[] selectableValues)
        Replace the selectable values that this Option has. If the current value of this option is one of the previous selectable values, and is not one of the new selectable values then the current value of this option is changed to the first of the new selectable values.
        Parameters:
        selectableValues - some selectable values to display in the drop down box.
      • getSelectableValues

        public java.lang.String[] getSelectableValues()
        return the current selectable values that the option has. The current value of this option is not guaranteed to be in this set.
        Returns:
        the current selectable values that the option has
        Since:
        API 4.60 (Geneious 5.6.0)