V
- the kind of value this preference usespublic abstract class AbstractPreference<V> extends Object implements Preference<V>
Preference
that offers support
for PreferenceListener
s.Constructor and Description |
---|
AbstractPreference() |
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 . |
protected void |
fireChanged()
Informs all listeners that the value of this preference has changed.
|
PreferenceOperation[] |
getOperations()
Gets a list of operations which can be executed by this preference.
|
protected boolean |
hasListeners()
Tells whether this preference currently has listeners.
|
boolean |
isEnabled(PreferenceOperation operation)
Tells whether
operation is enabled and thus Preference.doOperation(PreferenceOperation)
can be called. |
protected PreferenceListener<V>[] |
listeners()
Gets all the listeners of this preference.
|
void |
removePreferenceListener(PreferenceListener<V> listener)
Removes a listener from this preference.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDescription, getLabel, getPath, getTypePath, getValue, getValueInfo, isNatural, read, setModel, setValue, write
public void addPreferenceListener(PreferenceListener<V> listener)
Preference
addPreferenceListener
in interface Preference<V>
listener
- the new listenerpublic void removePreferenceListener(PreferenceListener<V> listener)
Preference
removePreferenceListener
in interface Preference<V>
listener
- the listener to removeprotected boolean hasListeners()
true
if there are any listenersprotected PreferenceListener<V>[] listeners()
protected void fireChanged()
public boolean isEnabled(PreferenceOperation operation)
Preference
operation
is enabled and thus Preference.doOperation(PreferenceOperation)
can be called.isEnabled
in interface Preference<V>
operation
- some operation of Preference.getOperations()
true
if the operation can be executedpublic PreferenceOperation[] getOperations()
Preference
getOperations
in interface Preference<V>
public void doOperation(PreferenceOperation operation)
Preference
operation
. This method should not
be called if operation
is disabled.doOperation
in interface Preference<V>
operation
- the key of the operation