public static class SequenceAnnotationGenerator.SelectionGrabOption extends Options.Option<Interval,JButton>
SequenceAnnotationGenerator.getOptions(com.biomatters.geneious.publicapi.documents.AnnotatedPluginDocument[], com.biomatters.geneious.publicapi.plugin.SequenceAnnotationGenerator.SelectionRange)
is a SelectionGrabOption then the sequence viewer will interact with the option such that when the user clicks on the button representing this option, the current selection
in the sequence viewer is copied to this option value.
The getOptions implemenation should add a change listener to the SelectionGrabOption and update the values of other option values as appropriate.
For example, the getOptions implementation may have a code fragment such as this:
final IntegerOption rangeMin = addIntegerOption("rangeMin", "Min", 1);
final IntegerOption rangeMax = addIntegerOption("rangeMax", "Max", maxSequenceLength);
final SequenceAnnotationGenerator.SelectionGrabOption selectionGrabber = addCustomOption(new SequenceAnnotationGenerator.SelectionGrabOption("selectionGrabber",new Interval(1,maxSequenceLength)));
excludeRangeGrabber.addChangeListener(new SimpleListener() {
public void objectChanged() {
rangeMin.setValue(selectionGrabber.getValue().getMin());
rangeMax.setValue(selectionGrabber.getValue().getMax());
}
});
A SelectionGrabOption is invisible by default so that it does not show up when Options are displayed in a non-sequence viewer
environment. The Sequence Viewer will set the SelectionGrabOption as visible when displaying the options.XMLSerializable.OldVersionCompatible, XMLSerializable.VersionSupportTypeROOT_ELEMENT_NAME| Modifier | Constructor and Description |
|---|---|
protected |
SequenceAnnotationGenerator.SelectionGrabOption(org.jdom.Element element) |
|
SequenceAnnotationGenerator.SelectionGrabOption(String name,
Interval defaultValue)
Constructs a new SelectionGrabOption
|
| Modifier and Type | Method and Description |
|---|---|
void |
addActionListener(ActionListener actionListener)
Adds a listener to be notified when the button has been clicked on.
|
protected JButton |
createComponent()
Create a graphical component representing this option.
|
Interval |
getValueFromString(String value)
Convert a String into an instance of the object type used by this option.
|
boolean |
isRestoreDefaultApplies()
Returns true if calling
Options.restoreDefaults() should restore this setting to its default value |
boolean |
isRestorePreferenceApplies()
Returns true if calling
Options.restorePreferences() should restore this setting to its value saved in preferences, and
Options.Option.shouldSaveValue() returns true |
protected void |
setValueOnComponent(JButton component,
Interval value)
Set the value on this component.
|
addChangeListener, addChildOptionsDependent, addDependent, fromXML, generateValidValue, getComponent, getDefaultValue, getDescription, getDescriptionAndState, getDisplayedLabel, getExtraPersistentInformation, getLabel, getName, getParentOptions, getPossibleValues, getValue, getValueAsString, getValueAsString, getVerticalWeight, handleSetEnabled, hideWarningMessage, isAdvanced, isEnabled, isFillHorizontalSpace, isProOnly, isSpanningComponent, isVisible, moveToOptions, 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, toString, toXMLpublic SequenceAnnotationGenerator.SelectionGrabOption(String name, Interval defaultValue)
name - the name of the option Options.Option.getName()).defaultValue - the default value.protected SequenceAnnotationGenerator.SelectionGrabOption(org.jdom.Element element)
throws XMLSerializationException
XMLSerializationExceptionpublic Interval getValueFromString(String value)
Options.OptionOptions.Option.getValueAsString(Object) .getValueFromString in class Options.Option<Interval,JButton>value - the string representation of the object valueprotected void setValueOnComponent(JButton component, Interval value)
Options.OptionsetValueOnComponent in class Options.Option<Interval,JButton>component - a component return from Options.Option.createComponent()value - the value to set.protected JButton 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<Interval,JButton>public boolean isRestoreDefaultApplies()
Options.OptionOptions.restoreDefaults() should restore this setting to its default valueisRestoreDefaultApplies in class Options.Option<Interval,JButton>Options.restoreDefaults() should restore this setting to its default valuepublic boolean isRestorePreferenceApplies()
Options.OptionOptions.restorePreferences() should restore this setting to its value saved in preferences, and
Options.Option.shouldSaveValue() returns trueisRestorePreferenceApplies in class Options.Option<Interval,JButton>Options.restorePreferences() should restore this setting to its value saved in preferences, and
() returns truepublic void addActionListener(ActionListener actionListener)
Options.Option.addChangeListener(org.virion.jam.util.SimpleListener) to be notified
when the value of this option has changed as a result of the sequence viewer setting the value.actionListener - a listener to be notified when the button has been clicked.