public static class Options.DoubleOption extends Options.Option<T,JSpinner>
XMLSerializable.OldVersionCompatible, XMLSerializable.VersionSupportTypeROOT_ELEMENT_NAME| Modifier | Constructor and Description |
|---|---|
protected |
Options.DoubleOption(org.jdom.Element element)
Constructor for XML Serialization.
|
protected |
Options.DoubleOption(String name,
String label,
Double defaultValue)
Construct a new Double option
|
protected |
Options.DoubleOption(String name,
String label,
Double defaultValue,
Double minimum,
Double maximum)
Construct a new Double option
|
| Modifier and Type | Method and Description |
|---|---|
protected JSpinner |
createComponent()
Create a graphical component representing this option.
|
protected Double |
generateValidValue(Double candidateValue)
Clamps the value to the permissible range.
|
T |
getIncrement()
Gets the amount the value of this option changes by when the user clicks the little up/down arrows to the right of it.
|
T |
getMaximum() |
T |
getMinimum() |
protected String |
getPossibleValues()
Provide a descriptive string representation of possible values of this option.
|
JComponent |
getUnitComponent() |
String |
getUnits()
If this option represents a value that has units, this is the string representing the units (eg lb or kg).
|
Double |
getValueFromString(String value)
Convert a String into an instance of the object type used by this option.
|
protected void |
handleSetEnabled(JSpinner component,
boolean enabled)
Set the enabled state of a component.
|
void |
setIncrement(T increment)
Sets the amount the value of this option changes by when the user clicks the little up/down arrows to the right of it.
|
void |
setUnits(String units)
If this option represents a value that has units, set the string representing the units (eg lb or kg) here.
|
protected void |
setValueOnComponent(JSpinner spinner,
T value)
Set the value on this component.
|
void |
setVisible(boolean visible)
Sets the visibility of the graphical component that displays this option together with its label 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.
|
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, moveToOptions, removeChangeListener, restoreDefault, setAdvanced, setAlwaysUsesDefaultPreferenceLocation, setDefaultValue, setDescription, setDisabledValue, setEnabled, setExtraPersistentInformation, setFillHorizontalSpace, setHidden, setLabelComponent, setPreferredHeight, setPreferredWidth, setProOnly, setRestoreDefaultApplies, setRestorePreferenceApplies, setShouldSaveValue, setSpanningComponent, setValue, setValue, setValueFromString, setVerticalWeight, setWarningMessage, shouldSaveValue, toStringprotected Options.DoubleOption(org.jdom.Element element)
throws XMLSerializationException
XMLSerializableXMLSerializationExceptionprotected Options.DoubleOption(String name, String label, Double defaultValue)
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 optionprotected Options.DoubleOption(String name, String label, Double defaultValue, Double minimum, Double maximum)
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 optionminimum - The minimum value that the option can havemaximum - The maximum value that the option can havepublic Double getValueFromString(String value)
Options.OptionOptions.Option.getValueAsString(Object) .getValueFromString in class Options.Option<Double,JSpinner>value - the string representation of the object valueprotected Double generateValidValue(Double candidateValue)
generateValidValue in class Options.Option<Double,JSpinner>candidateValue - the value to determine the validity ofprotected String getPossibleValues()
Options.OptionOptions.ComboBoxOrRadioOption.getPossibleOptionValues() to
get possible values as a List of OptionValues.getPossibleValues in class Options.Option<Double,JSpinner>Options.ComboBoxOrRadioOption.getPossibleOptionValues()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<T extends Number,JSpinner>public final T getMinimum()
public final T getMaximum()
public String getUnits()
public void setUnits(String units)
units - a string representing the units of this option's values. May be null (but will not be returned from getUnits() as null).protected void handleSetEnabled(JSpinner component, boolean enabled)
Options.OptionhandleSetEnabled in class Options.Option<T extends Number,JSpinner>component - the component to set the enabled state ofenabled - true if it should be enabledpublic void setVisible(boolean visible)
Options.OptionsetVisible in class Options.Option<T extends Number,JSpinner>visible - whether or not the graphical component that displays this option should be visible.public void setIncrement(T increment)
increment - the amount the value of this option changes by when the user clicks the little up/down arrows to the right of it.public T getIncrement()
protected JSpinner 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<T extends Number,JSpinner>public JComponent getUnitComponent()
setUnits(String)) if applicable.protected void setValueOnComponent(JSpinner spinner, T value)
Options.OptionsetValueOnComponent in class Options.Option<T extends Number,JSpinner>spinner - a component return from Options.Option.createComponent()value - the value to set.