Class AbstractOption<V>
- java.lang.Object
-
- com.e1c.g5.v8.dt.formatter.ui.preferences.option.AbstractOption<V>
-
- All Implemented Interfaces:
IOption<V>
- Direct Known Subclasses:
BooleanOption
,IntegerOption
,StringOption
public abstract class AbstractOption<V> extends Object implements IOption<V>
This class implements#IOption
's UI handling mechanism.
-
-
Field Summary
Fields Modifier and Type Field Description protected IUpdatableControl<V>
control
Control that option representsprotected V
value
The value of the preference
-
Constructor Summary
Constructors Constructor Description AbstractOption(String prefrenceKey, String presentation)
Creates new Option with given associated preference key and manager to perform write/read.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getPreferenceKey()
Getter for#preferenceKey
String
getPresentation()
V
getValue()
Returns current value held by this option.void
handleSelection(V value)
This method invoked when associated UI element has changed selection and the given value is now set to UI element So there is no need to update UI element but preference representation.void
setControl(IUpdatableControl<V> control)
Associates this option with given controlprotected void
setUploaded()
Sets the fieldisUploaded
totrue
.void
setValue(V value)
Sets the value of this option to the given value.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.e1c.g5.v8.dt.formatter.ui.preferences.option.IOption
restoreDefault, uploadValue, writeSelf
-
-
-
-
Field Detail
-
value
protected V value
The value of the preference
-
control
protected IUpdatableControl<V> control
Control that option represents
-
-
Constructor Detail
-
AbstractOption
public AbstractOption(String prefrenceKey, String presentation)
Creates new Option with given associated preference key and manager to perform write/read. Also sets thevalue
with default value according to given manager- Parameters:
prefrenceKey
- The associated to this option preference key, cannot benull
presentation
- The options presentation that describes its aim, cannot benull
-
-
Method Detail
-
handleSelection
public void handleSelection(V value)
Description copied from interface:IOption
This method invoked when associated UI element has changed selection and the given value is now set to UI element So there is no need to update UI element but preference representation. This method shall not write preferences right to the store as this changes can be canceled with no callback.- Specified by:
handleSelection
in interfaceIOption<V>
- Parameters:
value
- the new value to be set, can benull
-
setValue
public void setValue(V value)
Description copied from interface:IOption
Sets the value of this option to the given value. This shall update UI representation
-
getValue
public V getValue()
Description copied from interface:IOption
Returns current value held by this option. This shall not be affected byIOption.handleSelection(Object)
.
-
getPreferenceKey
public String getPreferenceKey()
Description copied from interface:IOption
Getter for#preferenceKey
- Specified by:
getPreferenceKey
in interfaceIOption<V>
- Returns:
#preferenceKey
, cannot benull
-
setControl
public void setControl(IUpdatableControl<V> control)
Description copied from interface:IOption
Associates this option with given control- Specified by:
setControl
in interfaceIOption<V>
- Parameters:
control
- The control associated with this option, can benull
-
getPresentation
public String getPresentation()
- Specified by:
getPresentation
in interfaceIOption<V>
- Returns:
- Description of this option
-
setUploaded
protected void setUploaded()
Sets the fieldisUploaded
totrue
. Meaning that this option has its value initialized
-
-