public static class Options.ButtonOption extends Options.Option<String,JPanel>
addActionListener(java.awt.event.ActionListener).XMLSerializable.OldVersionCompatible, XMLSerializable.VersionSupportType| Modifier and Type | Field and Description |
|---|---|
static int |
CENTER |
static int |
LEFT |
static int |
RIGHT |
ROOT_ELEMENT_NAME| Constructor and Description |
|---|
Options.ButtonOption(org.jdom.Element element)
Constructor for XML Serialization.
|
Options.ButtonOption(String name,
String label,
String buttonLabel)
Construct a new ButtonOption with no icon, and center aligned.
|
Options.ButtonOption(String name,
String label,
String buttonLabel,
Icon icon,
int alignment)
Construct a new ButtonOption.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addActionListener(ActionListener listener)
Adds a listener to be notified when this button option is clicked
|
void |
addDependentChildOptions(Options childOptions,
String dialogTitle)
The child options passed into this method will not be displayed inline in the options panel.
|
protected JPanel |
createComponent()
Create a graphical component representing this option.
|
void |
fireActionListeners()
calls the
ActionListener.actionPerformed(java.awt.event.ActionEvent) methods of all ActionListener objects added to this option by calling addActionListener(java.awt.event.ActionListener). |
Options |
getDependentChildOptions() |
String |
getValueFromString(String value)
Convert a String into an instance of the object type used by this option.
|
protected void |
handleSetEnabled(JPanel component,
boolean enabled)
Set the enabled state of a component.
|
void |
removeActionListener(ActionListener listener)
Removes a listener added using
addActionListener(java.awt.event.ActionListener). |
protected void |
setValueOnComponent(JPanel component,
String value)
Set the value on this component.
|
org.jdom.Element |
toXML()
Convert object to a JDOM element.
|
addChangeListener, addChildOptionsDependent, addDependent, fromXML, generateValidValue, getComponent, getDefaultValue, getDescription, getDescriptionAndState, getDisplayedLabel, getExtraPersistentInformation, getLabel, getName, getParentOptions, getPossibleValues, 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, setVisible, setWarningMessage, shouldSaveValue, toStringpublic static final int RIGHT
public static final int CENTER
public static final int LEFT
public Options.ButtonOption(org.jdom.Element element)
throws XMLSerializationException
XMLSerializableXMLSerializationExceptionpublic Options.ButtonOption(String name, String label, String buttonLabel, Icon icon, int 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". Usually displayed to the left of the button.buttonLabel - The text on the button itselficon - An optional icon which will appear on the button. This icon is not XMLSerializable, and can be null.alignment - choose how to align the button (useful if this option is set to fill horizontal space). Choices are LEFT, CENTER, and RIGHTpublic Options.ButtonOption(String name, String label, String buttonLabel)
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". Usually displayed to the left of the button.buttonLabel - The text on the button itselfpublic 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<String,JPanel>protected void handleSetEnabled(JPanel component, boolean enabled)
Options.OptionhandleSetEnabled in class Options.Option<String,JPanel>component - the component to set the enabled state ofenabled - true if it should be enabledpublic void addDependentChildOptions(Options childOptions, String dialogTitle)
childOptions - an Options which has been added as child options to the same Options that this ButtonOption has been added to.dialogTitle - the title of the dialog displaying the child optionspublic Options getDependentChildOptions()
addDependentChildOptions(Options, String).public String getValueFromString(String value)
Options.OptionOptions.Option.getValueAsString(Object) .getValueFromString in class Options.Option<String,JPanel>value - the string representation of the object valuepublic void addActionListener(ActionListener listener)
listener - the listener to be notified. The EventObject.getSource() of any events will be the action JButton. The option associated with the button is available using JComponent.getClientProperty(Options.ASSOCIATED_OPTION_PROPERTY)public void removeActionListener(ActionListener listener)
addActionListener(java.awt.event.ActionListener).listener - the listener to be notified.protected void setValueOnComponent(JPanel component, String value)
Options.OptionsetValueOnComponent in class Options.Option<String,JPanel>component - a component return from Options.Option.createComponent()value - the value to set.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<String,JPanel>public void fireActionListeners()
ActionListener.actionPerformed(java.awt.event.ActionEvent) methods of all ActionListener objects added to this option by calling addActionListener(java.awt.event.ActionListener).
Also pops out this option's dependent child options into a dialog if addDependentChildOptions(Options, String) has been called.