Interface Options
- All Known Implementing Classes:
AbstractOptions
,FileOptions
,SubOptions
,ToolOptions
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Return true if a option exists with the given name.void
createAlias
(String aliasName, Options options, String optionsName) Create an alias in this options for an existing option in some other options object.getActionTrigger
(String optionName, ActionTrigger defaultValue) Get theActionTrigger
for the given full action name.boolean
getBoolean
(String optionName, boolean defaultValue) Get the boolean value for the given option name.byte[]
getByteArray
(String optionName, byte[] defaultValue) Get the byte array for the given option name.Returns a list of Options objects that are nested one level down from this Options object.Get the Color for the given option name.getCustomOption
(String optionName, CustomOption defaultValue) Get the custom option value for the given option name.Get the Date for the given option name.getDefaultValue
(String optionName) Returns the default value for the given option.getDefaultValueAsString
(String optionName) Returns the default value as a string for the given option.getDescription
(String optionName) Get the description for the given option name.double
Get the double value for the given option name.<T extends Enum<T>>
TGet the Enum value for the given option name.Get the File for the given option name.float
Get the float value for the given option name.Get the Font for the given option name.getHelpLocation
(String optionName) Get the location for where help can be found for the option with the given name.Returns a unique id for option in this options with the given name.int
Get the int value for the given option name.getKeyStroke
(String optionName, KeyStroke defaultValue) Deprecated, for removal: This API element is subject to removal in a future version.Returns a list of option names that immediately fall under this options.long
Get the long value for the given option name.getName()
Get the name of this options object.Get the object value; called when the options dialog is being populated.Get the list of option names.getOptions
(String path) Returns a Options object that is a sub-options of this options.Get the editor that will handle editing all the values in this options or sub group of options.Returns the HelpLocation for this entire Options object.getPropertyEditor
(String optionName) Get the property editor for the option with the given name.getRegisteredPropertyEditor
(String optionName) Get the property editor that was registered for the specific option with the given name.Get the string value for the given option name.Returns the OptionType of the given option.getValueAsString
(String name) Returns the value as a string for the given option.static boolean
hasSameOptionsAndValues
(Options options1, Options options2) Returns true if the two options objects have the same set of options and valuesboolean
Returnsboolean
isDefaultValue
(String optionName) Returns true if the option with the given name's current value is the default value.boolean
isRegistered
(String optionName) Returns true if the specified option has been registered.void
Put the object value.void
registerOption
(String optionName, OptionType type, Object defaultValue, HelpLocation help, String description) Registers an option with a description, help location, and a optional default value.default void
registerOption
(String optionName, OptionType type, Object defaultValue, HelpLocation help, String description, PropertyEditor editor) Deprecated, for removal: This API element is subject to removal in a future version.void
registerOption
(String optionName, OptionType type, Object defaultValue, HelpLocation help, String description, Supplier<PropertyEditor> editor) Registers an option with a description, help location, and a optional default value.void
registerOption
(String optionName, Object defaultValue, HelpLocation help, String description) Registers an option with a description, help location, and a default value without specifying the option type.default void
registerOptionsEditor
(OptionsEditor editor) Deprecated, for removal: This API element is subject to removal in a future version.Use insteadregisterOptionsEditor(Supplier)
void
registerOptionsEditor
(Supplier<OptionsEditor> editor) Register the options editor that will handle the editing for all the options or a sub-group of options.void
registerThemeColorBinding
(String optionName, String colorId, HelpLocation help, String description) Register/binds the option to a theme color id.void
registerThemeFontBinding
(String optionName, String fontId, HelpLocation help, String description) Register/binds the option to a theme font id.void
removeOption
(String optionName) Remove the option name.void
restoreDefaultValue
(String optionName) Restores the option denoted by the given name to its default value.void
Restores all options contained herein to their default values.void
setActionTrigger
(String optionName, ActionTrigger value) Sets the action trigger value for the optionvoid
setBoolean
(String optionName, boolean value) Sets the boolean value for the option.void
setByteArray
(String optionName, byte[] value) Sets the byte[] value for the given option name.void
Sets the Color value for the optionvoid
setCustomOption
(String optionName, CustomOption value) Sets the Custom option value for the option.void
Sets the Date value for the option.void
Sets the double value for the option.<T extends Enum<T>>
voidSet the Enum value for the option.void
Sets the File value for the option.void
Sets the float value for the option.void
Sets the Font value for the optionvoid
Sets the int value for the option.void
setKeyStroke
(String optionName, KeyStroke value) Deprecated, for removal: This API element is subject to removal in a future version.usesetActionTrigger(String, ActionTrigger)
insteadvoid
Sets the long value for the option.void
setOptionsHelpLocation
(HelpLocation helpLocation) Set the location for where help can be found for this entire options object.void
Set the String value for the option.
-
Field Details
-
DELIMITER
static final char DELIMITER- See Also:
-
DELIMITER_STRING
-
ILLEGAL_DELIMITER
-
-
Method Details
-
getName
String getName()Get the name of this options object.- Returns:
- String
-
getID
Returns a unique id for option in this options with the given name. This will be the full path name to the root options object.- Parameters:
optionName
- the name of the option for which to get an ID;- Returns:
- the unique ID for the given option.
-
getType
Returns the OptionType of the given option.- Parameters:
optionName
- the name of the option for which to get the type.- Returns:
- the OptionType of option with the given name.
-
getPropertyEditor
Get the property editor for the option with the given name. Note: This method must be called from the swing thread.- Parameters:
optionName
- the option name- Returns:
- either the PropertyEditor that was registered for this option or a default editor for the property type if one can be found; otherwise null.
- Throws:
IllegalStateException
- if not called from the swing thread.
-
getRegisteredPropertyEditor
Get the property editor that was registered for the specific option with the given name. Unlike the getPropertyEditor() method, this method does not have to be called from the swing thread- Parameters:
optionName
- the option name- Returns:
- the PropertyEditor that was registered for this option.
-
getChildOptions
Returns a list of Options objects that are nested one level down from this Options object.- Returns:
- a list of Options objects that are nested one level down from this Options object.
-
getLeafOptionNames
Returns a list of option names that immediately fall under this options. For example, if this options object had the following options named ("a", "b", "c.d"), only "a" and "b" would be returned. The "c.d" leaf option name could be returned by getOptions("c").getLeafOptionNames()- Returns:
- the list of the names of the options that are immediate children of this options object.
-
setOptionsHelpLocation
Set the location for where help can be found for this entire options object.- Parameters:
helpLocation
- location for help on the option
-
getOptionsHelpLocation
HelpLocation getOptionsHelpLocation()Returns the HelpLocation for this entire Options object.- Returns:
- the HelpLocation for this entire Options object.
-
getHelpLocation
Get the location for where help can be found for the option with the given name.- Parameters:
optionName
- name of the option- Returns:
- null if the help location was not set on the option
-
registerOption
Registers an option with a description, help location, and a default value without specifying the option type. This form requires that the default value not be null so that the option type can be inferred from the default value.Note, this method should not be used for colors and font as doing so will result in those colors and fonts becoming disconnected to the current theme. Instead use
registerThemeColorBinding(String, String, HelpLocation, String)
orregisterThemeFontBinding(String, String, HelpLocation, String)
.- Parameters:
optionName
- the name of the option being registered.defaultValue
- the defaultValue for the option. The default value must not be null so that the OptionType can be determined. If the default value should be null, useregisterOption(String, OptionType, Object, HelpLocation, String)
help
- the HelpLocation for this option.description
- a description of the option.- Throws:
IllegalArgumentException
- if the defaultValue is null
-
registerOption
void registerOption(String optionName, OptionType type, Object defaultValue, HelpLocation help, String description) Registers an option with a description, help location, and a optional default value. With an optional default value, an OptionType must be passed as it is otherwise derived from the default value.Note, this method should not be used for colors and font as doing so will result in those colors and fonts becoming disconnected to the current theme. Instead use
registerThemeColorBinding(String, String, HelpLocation, String)
orregisterThemeFontBinding(String, String, HelpLocation, String)
.- Parameters:
optionName
- the name of the option being registered.type
- the OptionType for this options.defaultValue
- the defaultValue for the option. In this version of the method, the default value may be null.help
- the HelpLocation for this option.description
- a description of the option.
-
registerOption
void registerOption(String optionName, OptionType type, Object defaultValue, HelpLocation help, String description, Supplier<PropertyEditor> editor) Registers an option with a description, help location, and a optional default value. With an optional default value, an OptionType must be passed as it is otherwise derived from the default value.Note, this method should not be used for colors and font as doing so will result in those colors and fonts becoming disconnected to the current theme. Instead use
registerThemeColorBinding(String, String, HelpLocation, String)
orregisterThemeFontBinding(String, String, HelpLocation, String)
.Note: we use a supplier of a custom editor, instead of a custom editor, to avoid creating
PropertyEditor
s until needed. This allows us to use the same API in both GUI mode and headless mode. If GUI property editors are created in headless mode, exceptions may be thrown. This API will not use the supplier when in headless mode, this avoiding the creation of GUI components. For this to work correctly, clients using custom property editors must defer construction of the editor until the supplier is called.- Parameters:
optionName
- the name of the option being registered.type
- the OptionType for this options.defaultValue
- the defaultValue for the option. In this version of the method, the default value may be null.help
- the HelpLocation for this option.description
- a description of the option.editor
- an optional supplier of a custom editor for this property. Note if the option is a custom option, then the property editor can't be null;- Throws:
IllegalStateException
- if the options is a custom option and the editor is null.
-
registerOption
@Deprecated(since="11.0.2", forRemoval=true) default void registerOption(String optionName, OptionType type, Object defaultValue, HelpLocation help, String description, PropertyEditor editor) Deprecated, for removal: This API element is subject to removal in a future version.- Parameters:
optionName
- the name of the option being registered.type
- the OptionType for this options.defaultValue
- the defaultValue for the option. In this version of the method, the default value may be null.help
- the HelpLocation for this option.description
- a description of the option.editor
- an optional supplier of a custom editor for this property. Note if the option is a custom option, then the property editor can't be null;
-
registerThemeColorBinding
void registerThemeColorBinding(String optionName, String colorId, HelpLocation help, String description) Register/binds the option to a theme color id. Changing the option's color via the options Gui will result in directly changing the theme color of the given color id.- Parameters:
optionName
- the name of the color optioncolorId
- the theme color id whose color value is changed when the option's color is changedhelp
- the HelpLocation for this optiondescription
- a description of the option
-
registerThemeFontBinding
void registerThemeFontBinding(String optionName, String fontId, HelpLocation help, String description) Register/binds the option to a theme font id. Changing the option's font via the options Gui will result in directly changing the theme color of the given font id.- Parameters:
optionName
- the name of the font optionfontId
- the theme color id whose color value is changed when the option's color is changedhelp
- the HelpLocation for this optiondescription
- a description of the option
-
registerOptionsEditor
Register the options editor that will handle the editing for all the options or a sub-group of options.Note: we use a supplier of a custom editor, instead of a custom editor, to avoid creating
PropertyEditor
s until needed. This allows us to use the same API in both GUI mode and headless mode. If GUI property editors are created in headless mode, exceptions may be thrown. This API will not use the supplier when in headless mode, this avoiding the creation of GUI components. For this to work correctly, clients using custom property editors must defer construction of the editor until the supplier is called.- Parameters:
editor
- a supplier for the custom editor panel to be used to edit the options or sub-group of options.
-
registerOptionsEditor
@Deprecated(since="11.0.2", forRemoval=true) default void registerOptionsEditor(OptionsEditor editor) Deprecated, for removal: This API element is subject to removal in a future version.Use insteadregisterOptionsEditor(Supplier)
Use insteadregisterOptionsEditor(Supplier)
- Parameters:
editor
- the editor
-
getOptionsEditor
OptionsEditor getOptionsEditor()Get the editor that will handle editing all the values in this options or sub group of options.- Returns:
- null if no options editor was registered
-
putObject
Put the object value. If the option exists, the type must match the type of the existing object.- Parameters:
optionName
- the option nameobj
- the option value- Throws:
IllegalStateException
- if the object does not match the existing type of the option.IllegalArgumentException
- if the object is null or not a supported type.
-
getObject
Get the object value; called when the options dialog is being populated.- Parameters:
optionName
- option namedefaultValue
- default value- Returns:
- object with the given option name; if no option was found, return default value (this value is not stored in the option maps)
-
getBoolean
Get the boolean value for the given option name.- Parameters:
optionName
- option namedefaultValue
- value that is stored and returned if there is no option with the given name.- Returns:
- boolean option value
-
getByteArray
Get the byte array for the given option name.- Parameters:
optionName
- option namedefaultValue
- value that is stored and returned if there is no option with the given name- Returns:
- byte[] byte array value
-
getInt
Get the int value for the given option name.- Parameters:
optionName
- option namedefaultValue
- value that is stored and returned if there is no option with the given name- Returns:
- int option value
-
getDouble
Get the double value for the given option name.- Parameters:
optionName
- option namedefaultValue
- value that is stored and returned if there is no option with the given name- Returns:
- double value for the option
-
getFloat
Get the float value for the given option name.- Parameters:
optionName
- option namedefaultValue
- value that is stored and returned if there is no option with the given name- Returns:
- float value for the option
-
getLong
Get the long value for the given option name.- Parameters:
optionName
- option namedefaultValue
- value that is stored and returned if there is no option with the given name- Returns:
- long value for the option
-
getCustomOption
Get the custom option value for the given option name.- Parameters:
optionName
- option namedefaultValue
- value that is stored and returned if there is no option with the given name- Returns:
- WrappedOption value for the option
-
getColor
Get the Color for the given option name.- Parameters:
optionName
- option namedefaultValue
- value that is stored and returned if there is no option with the given name- Returns:
- Color option
- Throws:
IllegalArgumentException
- is a option exists with the given name but it is not a Color
-
getFile
Get the File for the given option name.- Parameters:
optionName
- option namedefaultValue
- value that is stored and returned if there is no option with the given name- Returns:
- File option
- Throws:
IllegalArgumentException
- is a option exists with the given name but it is not a File options
-
getDate
Get the Date for the given option name.- Parameters:
pName
- the property namedate
- the default date that is stored and returned if there is no option with the given name- Returns:
- the Date for the option
- Throws:
IllegalArgumentException
- is a option exists with the given name but it is not a Date options
-
getFont
Get the Font for the given option name.- Parameters:
optionName
- option namedefaultValue
- value that is stored and returned if there is no option with the given name- Returns:
- Font option
- Throws:
IllegalArgumentException
- is a option exists with the given name but it is not a Font
-
getKeyStroke
@Deprecated(since="11.1", forRemoval=true) KeyStroke getKeyStroke(String optionName, KeyStroke defaultValue) Deprecated, for removal: This API element is subject to removal in a future version.usegetActionTrigger(String, ActionTrigger)
insteadGet the KeyStroke for the given action name.- Parameters:
optionName
- the option namedefaultValue
- value that is stored and returned if there is no option with the given name- Returns:
- KeyStroke option
- Throws:
IllegalArgumentException
- is a option exists with the given name but it is not a KeyStroke
-
getActionTrigger
Get theActionTrigger
for the given full action name.- Parameters:
optionName
- the action namedefaultValue
- value that is stored and returned if there is no option with the given name- Returns:
- the action trigger
-
getString
Get the string value for the given option name.- Parameters:
optionName
- option namedefaultValue
- value that is stored and returned if there is no option with the given name- Returns:
- String value for the option
-
getEnum
Get the Enum value for the given option name.- Parameters:
optionName
- option namedefaultValue
- default value that is stored and returned if there is no option with the given name- Returns:
- Enum value for the option
-
setLong
Sets the long value for the option.- Parameters:
optionName
- name of the optionvalue
- value of the option
-
setBoolean
Sets the boolean value for the option.- Parameters:
optionName
- name of the optionvalue
- value of the option
-
setInt
Sets the int value for the option.- Parameters:
optionName
- name of the optionvalue
- value of the option
-
setDouble
Sets the double value for the option.- Parameters:
optionName
- name of the optionvalue
- value of the option
-
setFloat
Sets the float value for the option.- Parameters:
optionName
- name of the optionvalue
- value of the option
-
setCustomOption
Sets the Custom option value for the option.- Parameters:
optionName
- name of the optionvalue
- the value
-
setByteArray
Sets the byte[] value for the given option name.- Parameters:
optionName
- the name of the option on which to save bytes.value
- the value
-
setFile
Sets the File value for the option.- Parameters:
optionName
- name of the optionvalue
- the value
-
setDate
Sets the Date value for the option.- Parameters:
optionName
- name of the optionnewSetting
- the Date to set
-
setColor
Sets the Color value for the option- Parameters:
optionName
- name of the optionvalue
- Color to set- Throws:
IllegalArgumentException
- if a option with the given name already exists, but it is not a Color
-
setFont
Sets the Font value for the option- Parameters:
optionName
- name of the optionvalue
- Font to set- Throws:
IllegalArgumentException
- if a option with the given name already exists, but it is not a Font
-
setKeyStroke
Deprecated, for removal: This API element is subject to removal in a future version.usesetActionTrigger(String, ActionTrigger)
insteadSets the KeyStroke value for the option- Parameters:
optionName
- name of the optionvalue
- KeyStroke to set- Throws:
IllegalArgumentException
- if a option with the given name already exists, but it is not a KeyStroke
-
setActionTrigger
Sets the action trigger value for the option- Parameters:
optionName
- name of the optionvalue
- action trigger to set- Throws:
IllegalArgumentException
- if a option with the given name already exists, but it is not an action trigger
-
setString
Set the String value for the option.- Parameters:
optionName
- name of the optionvalue
- value of the option
-
setEnum
Set the Enum value for the option.- Parameters:
optionName
- name of the optionvalue
- Enum value of the option
-
removeOption
Remove the option name.- Parameters:
optionName
- name of option to remove
-
getOptionNames
Get the list of option names. This method will return the names (paths) of all options contained in this options object or below. For example, if the options has ("aaa", "bbb", "ccc.ddd"), all three will be returned. thegetLeafOptionNames()
method will return only the "aaa" and "bbb" names.- Returns:
- the list of all option names(paths) under this options.
-
contains
Return true if a option exists with the given name.- Parameters:
optionName
- option name- Returns:
- true if there exists an option with the given name
-
getDescription
Get the description for the given option name.- Parameters:
optionName
- name of the option- Returns:
- null if the description or option name does not exist
-
isRegistered
Returns true if the specified option has been registered. Only registered names are saved.- Parameters:
optionName
- the option name- Returns:
- true if registered
-
isDefaultValue
Returns true if the option with the given name's current value is the default value.- Parameters:
optionName
- the name of the option.- Returns:
- true if the options has its current value equal to its default value.
-
restoreDefaultValues
void restoreDefaultValues()Restores all options contained herein to their default values.- See Also:
-
restoreDefaultValue
Restores the option denoted by the given name to its default value.- Parameters:
optionName
- The name of the option to restore- See Also:
-
getOptions
Returns a Options object that is a sub-options of this options.Note: the option path can have
DELIMITER
characters which will be used to create a hierarchy with each element in the path resulting in sub-option of the previous path element.- Parameters:
path
- the path for the sub-options object- Returns:
- an Options object that is a sub-options of this options
-
createAlias
Create an alias in this options for an existing option in some other options object.- Parameters:
aliasName
- the name within this options object that will actually refer to some other options object.options
- the options object that has the actual option.optionsName
- the name within the given options object of the actual option.
-
isAlias
Returns- Parameters:
aliasName
- the name of the alias.- Returns:
- a Options object that is a sub-options of this options.
-
getDefaultValue
Returns the default value for the given option.- Parameters:
optionName
- the name of the option for which to retrieve the default value.- Returns:
- the default value for the given option.
-
getValueAsString
Returns the value as a string for the given option.- Parameters:
name
- the name of the option for which to retrieve the value as a string- Returns:
- the value as a string for the given option.
-
getDefaultValueAsString
Returns the default value as a string for the given option.- Parameters:
optionName
- the name of the option for which to retrieve the default value as a string- Returns:
- the default value as a string for the given option.
-
hasSameOptionsAndValues
Returns true if the two options objects have the same set of options and values- Parameters:
options1
- the first options object to testoptions2
- the second options object to test- Returns:
- true if the two options objects have the same set of options and values
-
getActionTrigger(String, ActionTrigger)
instead