public static class Options.RadioOption<ValueType extends Options.OptionValue> extends Options.Option<ValueType,ComponentType>
| Modifier and Type | Class and Description |
|---|---|
static class |
Options.RadioOption.DependentPosition |
XMLSerializable.OldVersionCompatible, XMLSerializable.VersionSupportTypeROOT_ELEMENT_NAME| Modifier | Constructor and Description |
|---|---|
protected |
Options.RadioOption(org.jdom.Element e)
Constructor for XML Serialization.
|
protected |
Options.RadioOption(String name,
String label,
ValueType[] possibleValues,
ValueType defaultValue,
Options.Alignment alignment)
Construct a new Radio option.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDependent(ValueType optionValue,
Options.Option dependent,
boolean layoutDependentNearRadioButton)
Adds a dependent option that will be enabled when the radio button associated with the OptionValue is
selected, and disabled when it is not.
|
void |
addDependent(ValueType optionValue,
Options dependentOptions,
boolean layoutDependentNearRadioButton)
Adds a dependent option that will be enabled when the radio button associated with the OptionValue is
selected, and disabled when it is not.
|
protected JPanel |
createComponent()
Create a graphical component representing this option.
|
protected ValueType |
generateValidValue(ValueType value)
Converts a potentially invalid value into a valid one.
|
protected String |
getPossibleValues()
Provide a descriptive string representation of possible values of this option.
|
List<AbstractButton> |
getRadioButtons()
Get the list of buttons for this radio option.
|
ValueType |
getValueFromString(String value)
Convert a String into an instance of the object type used by this option.
|
protected void |
handleSetEnabled(JPanel panel,
boolean enabled)
Set the enabled state of a component.
|
boolean |
moveToOptions(Options newParentOptions,
String optionalNewLabel,
String optionalNewName)
Moves this Option from its current parent Options to another parent Options.
|
void |
setDependentPosition(Options.RadioOption.DependentPosition radioDependentPosition)
Set the position of all options that are dependent (set with
addDependent)
on this RadioOpion. |
protected void |
setValueOnComponent(JPanel panel,
Options.OptionValue value)
Set the value on this component.
|
org.jdom.Element |
toXML()
Convert object to a JDOM element.
|
addChangeListener, addChildOptionsDependent, addDependent, fromXML, getComponent, getDefaultValue, getDescription, getDescriptionAndState, getDisplayedLabel, getExtraPersistentInformation, getLabel, getName, getParentOptions, getValue, getValueAsString, getValueAsString, getVerticalWeight, hideWarningMessage, isAdvanced, isEnabled, isFillHorizontalSpace, isProOnly, isRestoreDefaultApplies, isRestorePreferenceApplies, isSpanningComponent, isVisible, removeChangeListener, restoreDefault, setAdvanced, setAlwaysUsesDefaultPreferenceLocation, setDefaultValue, setDescription, setDisabledValue, setEnabled, setExtraPersistentInformation, setFillHorizontalSpace, setHidden, setLabelComponent, setPreferredHeight, setPreferredWidth, setProOnly, setRestoreDefaultApplies, setRestorePreferenceApplies, setShouldSaveValue, setSpanningComponent, setValue, setValue, setValueFromString, setVerticalWeight, setVisible, setWarningMessage, shouldSaveValue, toStringprotected Options.RadioOption(org.jdom.Element e)
throws XMLSerializationException
XMLSerializablee - The JDOM Element from which the constructed object should be initialised.XMLSerializationException - if such an exception occurs while initialising the element from XMLprotected Options.RadioOption(String name, String label, ValueType[] possibleValues, ValueType defaultValue, Options.Alignment alignment)
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"possibleValues - An array containing all possible values (i.e. all the radio button names)defaultValue - the default value for this option, not nullalignment - the alignment of the radio buttons (horizontally or vertically)public org.jdom.Element toXML()
XMLSerializableXMLSerializable.fromXML(org.jdom.Element) can completely
restore the objects 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.toXML in interface XMLSerializabletoXML in class Options.Option<ValueType extends Options.OptionValue,JPanel>protected String getPossibleValues()
Options.OptionOptions.ComboBoxOrRadioOption.getPossibleOptionValues() to
get possible values as a List of OptionValues.getPossibleValues in class Options.Option<ValueType extends Options.OptionValue,JPanel>Options.ComboBoxOrRadioOption.getPossibleOptionValues()public ValueType getValueFromString(String value)
Options.OptionOptions.Option.getValueAsString(Object) .getValueFromString in class Options.Option<ValueType extends Options.OptionValue,JPanel>value - the string representation of the object valuepublic boolean moveToOptions(Options newParentOptions, String optionalNewLabel, String optionalNewName)
Options.OptionmoveToOptions in class Options.Option<ValueType extends Options.OptionValue,JPanel>newParentOptions - the Options to move this Option tooptionalNewLabel - a new label (see Options.Option.getLabel()) to assign to this Option or null to leave it unchanged.optionalNewName - a new name (see Options.Option.getName() ()})to assign to this Option or null to leave it unchanged.protected JPanel createComponent()
Options.OptionOptions.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.createComponent in class Options.Option<ValueType extends Options.OptionValue,JPanel>protected ValueType generateValidValue(ValueType value)
Options.OptioncandidateValue, implying that all
values are valid. Subclasses can override this method e.g. to
clamp integer values to a certain interval, or to ensure that a
disabled radio item cannot be selected. If a new value is
determined to be invalid, a subclass may choose to return the
current value (Options.Option.getValue() or any arbitrary other value.
IMPORTANT: subclasses which implement this method should call Options.Option.setDefaultValue(Object) at the end of their constructor(s)generateValidValue in class Options.Option<ValueType extends Options.OptionValue,JPanel>value - the value to determine the validity ofprotected void setValueOnComponent(JPanel panel, Options.OptionValue value)
Options.OptionsetValueOnComponent in class Options.Option<ValueType extends Options.OptionValue,JPanel>panel - a component return from Options.Option.createComponent()value - the value to set.protected void handleSetEnabled(JPanel panel, boolean enabled)
Options.OptionhandleSetEnabled in class Options.Option<ValueType extends Options.OptionValue,JPanel>panel - the component to set the enabled state ofenabled - true if it should be enabledpublic final List<AbstractButton> getRadioButtons()
public void addDependent(ValueType optionValue, Options.Option dependent, boolean layoutDependentNearRadioButton)
layoutDependentNearRadioButton to true), the component for the dependent can appear immediately under the radio button associated
with the given OptionValue in any panel returned by this RadioOption. Use setDependentPosition(com.biomatters.geneious.publicapi.plugin.Options.RadioOption.DependentPosition)
to specify the exact dependent positioning in this case.optionValue - The OptionValue that will be the parent of the dependent Optiondependent - the option whose enabled state (and optionally its position) will changelayoutDependentNearRadioButton - make the component for the dependent can appear immediately under or to the right (see setDependentPosition) of the radio button associated
with the given OptionValue in any panel returned by this RadioOption. Using false for this parameter means that only the enabled state of the dependent is affected.public void addDependent(ValueType optionValue, Options dependentOptions, boolean layoutDependentNearRadioButton)
layoutDependentNearRadioButton to true), the component for the dependent can appear immediately under the radio button associated
with the given OptionValue in any panel returned by this RadioOption. Use setDependentPosition(com.biomatters.geneious.publicapi.plugin.Options.RadioOption.DependentPosition)
to specify the exact dependent positioning in this case.optionValue - The OptionValue that will be the parent of the dependent OptiondependentOptions - the option whose enabled state (and optionally its position) will changelayoutDependentNearRadioButton - make the component for the dependent can appear immediately under or to the right (see setDependentPosition) of the radio button associated
with the given OptionValue in any panel returned by this RadioOption. Using false for this parameter means that only the enabled state of the dependent is affected.public void setDependentPosition(Options.RadioOption.DependentPosition radioDependentPosition)
addDependent)
on this RadioOpion.radioDependentPosition - the position to set. See Options.RadioOption.DependentPosition.BELOW
and Options.RadioOption.DependentPosition.RIGHT.