V
- the kind of value this preference holdspublic abstract class DefaultPreference<V> extends AbstractPreference<V>
Preference
that can hold any value. This preference does not implement
the Preference.read()
or Preference.write()
method. If a default-value
is set, then this preference activates the operation PreferenceOperation.DEFAULT
, otherwise
it shows no operations.artificial
preference, subclasses may call
setNatural(boolean)
to change the behavior.Constructor and Description |
---|
DefaultPreference(Path type,
Path path)
Creates a new preference.
|
DefaultPreference(String label,
Path type,
Path path)
Creates a new preference.
|
Modifier and Type | Method and Description |
---|---|
void |
addPreferenceListener(PreferenceListener<V> listener)
Adds a listener to this preference.
|
void |
doOperation(PreferenceOperation operation)
Executes the enabled operation
operation . |
V |
getDefaultValue()
Gets the default value of this preference
|
String |
getDescription()
Gets a long human readable description of this preference.
|
String |
getLabel()
Gets a short human readable string that is used as name for this preference.
|
PreferenceOperation[] |
getOperations()
Gets a list of operations which can be executed by this preference.
|
Path |
getPath()
Gets the unique path of this resource.
|
Path |
getTypePath()
Gets the type of the value that this preferences uses.
|
V |
getValue()
Gets the value of this preference.
|
Object |
getValueInfo()
Information about how the value of this preference can be
modified.
|
boolean |
isEnabled(PreferenceOperation operation)
Tells whether
operation is enabled and thus Preference.doOperation(PreferenceOperation)
can be called. |
boolean |
isNatural()
Tells whether this preference is natural or artificial.
|
void |
removePreferenceListener(PreferenceListener<V> listener)
Removes a listener from this preference.
|
void |
setDefaultValue(V defaultValue)
Sets the default value of this preference
|
void |
setDescription(String description)
Sets a description of this preference.
|
void |
setDescriptionId(String descriptionId)
Sets a unique identifier for the description text, the unique identifier will be used to read
a text from the current
TextManager . |
void |
setLabel(String label)
Sets a short human readable label for this preference.
|
void |
setLabelId(String labelId)
Sets a unique identifier for the label text, the unique identifier will be used to read
a text from the current
TextManager . |
void |
setModel(PreferenceModel model)
Sets the model which is using this preference.
|
void |
setNatural(boolean natural)
Sets whether this preference is natural or artificial.
|
void |
setValue(V value)
Sets the value of this preference.
|
void |
setValueInfo(Object valueInfo)
Sets information about this preferences value.
|
fireChanged, hasListeners, listeners
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
read, write
public DefaultPreference(Path type, Path path)
type
- the type of value this preference usespath
- a unique path for this preference, all paths starting with
"dock" are reserved for this frameworkpublic DefaultPreference(String label, Path type, Path path)
label
- a short human readable label for this preferencetype
- the type of value this preference usespath
- a unique path for this preference, all paths starting with
"dock" are reserved for this frameworkpublic void addPreferenceListener(PreferenceListener<V> listener)
Preference
addPreferenceListener
in interface Preference<V>
addPreferenceListener
in class AbstractPreference<V>
listener
- the new listenerpublic void removePreferenceListener(PreferenceListener<V> listener)
Preference
removePreferenceListener
in interface Preference<V>
removePreferenceListener
in class AbstractPreference<V>
listener
- the listener to removepublic void setModel(PreferenceModel model)
Preference
model
- the model, can be null
public String getLabel()
Preference
public void setLabel(String label)
label
- the new labelpublic void setLabelId(String labelId)
TextManager
.labelId
- the unique identifier, can be null
public String getDescription()
Preference
null
, may be formated
in HTMLpublic void setDescription(String description)
description
- a human readable string, can be null
and
can be formated in HTMLpublic void setDescriptionId(String descriptionId)
TextManager
.descriptionId
- the unique identifier, can be null
public Path getTypePath()
Preference
Path
public void setValueInfo(Object valueInfo)
getTypePath()
.valueInfo
- the new information or null
public Object getValueInfo()
Preference
PreferenceModel.getValueInfo(int)
.null
public V getValue()
Preference
null
public void setValue(V value)
Preference
value
- the value, might be null
(depends on the
editor used for this preference)public void setDefaultValue(V defaultValue)
defaultValue
- the new default valuepublic V getDefaultValue()
null
public Path getPath()
Preference
public void setNatural(boolean natural)
natural
- true
if natural, false
if artificialisNatural()
,
PreferenceModel.isNatural(int)
public boolean isNatural()
Preference
true
if natural, false
if artificialPreferenceModel.isNatural(int)
public PreferenceOperation[] getOperations()
Preference
getOperations
in interface Preference<V>
getOperations
in class AbstractPreference<V>
public boolean isEnabled(PreferenceOperation operation)
Preference
operation
is enabled and thus Preference.doOperation(PreferenceOperation)
can be called.isEnabled
in interface Preference<V>
isEnabled
in class AbstractPreference<V>
operation
- some operation of Preference.getOperations()
true
if the operation can be executedpublic void doOperation(PreferenceOperation operation)
Preference
operation
. This method should not
be called if operation
is disabled.doOperation
in interface Preference<V>
doOperation
in class AbstractPreference<V>
operation
- the key of the operation