public abstract class Option<T>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Option.DataType |
Modifier and Type | Field and Description |
---|---|
protected ConfigCallback<T> |
cb
The configCallback associated to the Option
|
protected SubConfig |
config
The parent SubConfig object
|
protected T |
currentValue |
protected T |
defaultValue |
protected boolean |
expert
Is this config variable expert-only?
|
protected boolean |
forceWrite
Is this config variable to be written out even if it uses the default value?
|
protected java.lang.String |
longDesc
Long description of value e.g.
|
protected java.lang.String |
name
The option name
|
protected java.lang.String |
shortDesc
Short description of value e.g.
|
protected int |
sortOrder
The sort order
|
Modifier and Type | Method and Description |
---|---|
void |
forceUpdate()
Call the callback with the current value of the option.
|
ConfigCallback<T> |
getCallback() |
Option.DataType |
getDataType() |
java.lang.String |
getDataTypeStr() |
java.lang.String |
getDefault() |
java.lang.String |
getLocalisedLongDesc()
Get the localised long description
|
java.lang.String |
getLocalisedLongDesc(BaseL10n l10n)
Useful for plugins as can pass own BaseL10n in
|
java.lang.String |
getLocalisedShortDesc()
Get the localised short description
|
java.lang.String |
getLocalisedShortDesc(BaseL10n l10n)
Useful for plugins as can pass own BaseL10n in
|
HTMLNode |
getLongDescNode() |
HTMLNode |
getLongDescNode(FredPluginConfigurable plugin)
Get the localised long description as an HTMLNode, possibly with translation link
|
java.lang.String |
getName() |
java.lang.String |
getShortDesc()
Used in alt="" to label a box with the option name used in the config file.
|
HTMLNode |
getShortDescNode() |
HTMLNode |
getShortDescNode(FredPluginConfigurable plugin)
Get the localised short description as an HTMLNode, possibly with translation link
|
int |
getSortOrder() |
T |
getValue()
Get the current value.
|
java.lang.String |
getValueDisplayString()
Get the current value of the option as a string suited to end-user display.
|
java.lang.String |
getValueString()
Get the current value of the option as a string.
|
boolean |
isDefault()
Is this option set to the default?
|
boolean |
isExpert() |
boolean |
isForcedWrite() |
protected abstract T |
parseString(java.lang.String val) |
protected void |
set(T val) |
void |
setDefault()
Set to the default.
|
void |
setInitialValue(java.lang.String val)
Set to a value from the config file; this is not passed on to the callback, as we
expect the client-side initialization to check the value.
|
void |
setValue(java.lang.String val)
Set this option's current value to a string.
|
protected java.lang.String |
toDisplayString(T val) |
protected abstract java.lang.String |
toString(T val) |
protected final SubConfig config
protected final java.lang.String name
protected final int sortOrder
protected final boolean expert
protected final boolean forceWrite
protected final java.lang.String shortDesc
protected final java.lang.String longDesc
protected final ConfigCallback<T> cb
protected T defaultValue
protected T currentValue
public final void setValue(java.lang.String val) throws InvalidConfigValueException, NodeNeedRestartException
protected abstract T parseString(java.lang.String val) throws InvalidConfigValueException
InvalidConfigValueException
protected abstract java.lang.String toString(T val)
protected java.lang.String toDisplayString(T val)
protected final void set(T val) throws InvalidConfigValueException, NodeNeedRestartException
public final java.lang.String getValueString()
public final java.lang.String getValueDisplayString()
public final void setInitialValue(java.lang.String val) throws InvalidConfigValueException
InvalidConfigValueException
public void forceUpdate() throws InvalidConfigValueException, NodeNeedRestartException
public java.lang.String getName()
public java.lang.String getShortDesc()
public boolean isExpert()
public boolean isForcedWrite()
public int getSortOrder()
public Option.DataType getDataType()
public java.lang.String getDataTypeStr()
public final T getValue()
public boolean isDefault()
public final void setDefault()
public final java.lang.String getDefault()
public final ConfigCallback<T> getCallback()
public java.lang.String getLocalisedShortDesc(BaseL10n l10n)
public java.lang.String getLocalisedShortDesc()
public java.lang.String getLocalisedLongDesc(BaseL10n l10n)
public java.lang.String getLocalisedLongDesc()
public HTMLNode getShortDescNode(FredPluginConfigurable plugin)
public HTMLNode getShortDescNode()
public HTMLNode getLongDescNode(FredPluginConfigurable plugin)
public HTMLNode getLongDescNode()