public static class Options.OptionValue extends Object implements XMLSerializable
Options.RadioOption or Options.ComboBoxOption can
take on. Note that although this class is called OptionValue, in general
values that options can take don't have to be subclasses of this class.
For example, IntegerOption extends OptionXMLSerializable.OldVersionCompatible, XMLSerializable.VersionSupportTypeROOT_ELEMENT_NAME| Modifier | Constructor and Description |
|---|---|
protected |
Options.OptionValue(org.jdom.Element element) |
|
Options.OptionValue(String name,
String label)
Construct a new option value.
|
|
Options.OptionValue(String name,
String label,
String description)
Construct a new option value.
|
|
Options.OptionValue(String name,
String label,
String description,
boolean enabled)
Construct a new option value.
|
|
Options.OptionValue(String name,
String label,
String description,
boolean enabled,
Icons icons)
Construct a new option value.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addWeakEnabledMayHaveChangedListener(SimpleListener listener)
Adds a weakly referenced listener to be notified when the enabled state of this option value may have changed.
|
boolean |
equals(Object o)
Two OptionValue's are considered equal with if only if their names are equal
|
void |
fromXML(org.jdom.Element element)
Restore the object from the JDOM Element returned by
XMLSerializable.toXML(). |
String |
getDescription()
get the 1 line description of this option value.
|
String |
getLabel()
get the name of this option value displayed to the user.
|
String |
getName()
Get the programmatic name used for referencing this option value.
|
int |
hashCode() |
boolean |
isEnabled()
Determine whether this option value is enabled not.
|
boolean |
isProOnly()
determine whether or not this option requires an active license.
|
void |
setEnabled(boolean enabled)
Sets whether or not this option value is enabled.
|
void |
setProOnly(boolean proOnly)
Sets whether or not this option value requires an active license.
|
String |
toString() |
org.jdom.Element |
toXML()
Convert object to a JDOM element.
|
protected Options.OptionValue(org.jdom.Element element)
throws XMLSerializationException
XMLSerializationExceptionpublic Options.OptionValue(String name, String label)
name - Programmatic name used to reference this option. This should never change and scripts or programs can refer to the value using this name.
Names should be in standard Java variable name style eg. "myAwesomeOption".label - a name used to display this option to the end user. This may vary. Use empty string to create a separator option valuepublic Options.OptionValue(String name, String label, String description)
name - Programmatic name used to reference this option value. This should never change and scripts or programs can refer to the value using this name.
Names should be in standard Java variable name style eg. "myAwesomeOption".label - a short name (1 to 3 words) used to display this option value to the end user. This may vary. Use empty string to create a separator option valuedescription - a one line description for this option value.public Options.OptionValue(String name, String label, String description, boolean enabled)
name - Programmatic name used to reference this option value. This should never change and scripts or programs can refer to the value using this name.
Names should be in standard Java variable name style eg. "myAwesomeOption".label - a short name (1 to 3 words) used to display this option value to the end user. This may vary. Use empty string to create a separator option valuedescription - a one line description for this option value (may be "" to specify none)enabled - specifies whether this option is enabled or not.public Options.OptionValue(String name, String label, String description, boolean enabled, Icons icons)
name - Programmatic name used to reference this option value. This should never change and scripts or programs can refer to the value using this name.
Names should be in standard Java variable name style eg. "myAwesomeOption".label - a short name (1 to 3 words) used to display this option value to the end user. This may vary. Use empty string to create a separator option valuedescription - a one line description for this option value (may be "" to specify none)enabled - specifies whether this option is enabled or not.icons - specifies icons rendered next to this value. Currently only combo boxes display Icons.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 XMLSerializablepublic final void fromXML(org.jdom.Element element)
throws XMLSerializationException
XMLSerializableXMLSerializable.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().fromXML in interface XMLSerializableelement - representation from a previous call to XMLSerializable.toXML()XMLSerializationException - if the Element can't be converted into this type of objectpublic final String getName()
public final String getLabel()
public final String getDescription()
public void setEnabled(boolean enabled)
enabled - true if it should be enabled. Note that isEnabled() may not return this same value in the case of option values that require an active license.public void addWeakEnabledMayHaveChangedListener(SimpleListener listener)
listener - the listener to be notified.public final void setProOnly(boolean proOnly)
proOnly - true if this option value requires an active license.public final boolean isProOnly()
public final boolean isEnabled()
setEnabled(boolean) in the case of option values that require an active license.public final boolean equals(Object o)