bibliothek.extension.gui.dock.preference
Interface Preference<V>

Type Parameters:
V - the kind of value this preference stores
All Known Implementing Classes:
AbstractPreference, BubbleColorSchemePreference, ButtonContentPreference, ChoiceDockPropertyPreference, DefaultPreference, DockPropertyPreference, EclipseIconPreference, EclipseTabPreference, KeyStrokeClosePreference, KeyStrokeExternalizePreference, KeyStrokeHidePreference, KeyStrokeInitSelectorPreference, KeyStrokeMaximizeChangePreference, KeyStrokeMaximizePreference, KeyStrokeMaximizePreference, KeyStrokeMinimizePreference, KeyStrokeNormalizePreference, ModifierMaskNoCombinationPreference, ModifierMaskScreenOnlyPreference, TabContentFilterPreference, TabPlacementPreference, ThemePreference

public interface Preference<V>

A representation of a single entry in a DefaultPreferenceModel. A preference is a wrapper around some kind of exchangeable value. The preference tells how that value can be modified and offers some information for users about the usage of the value.

Author:
Benjamin Sigg

Method Summary
 void addPreferenceListener(PreferenceListener<V> listener)
          Adds a listener to this preference.
 void doOperation(PreferenceOperation operation)
          Executes the enabled operation operation.
 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 doOperation(PreferenceOperation) can be called.
 boolean isNatural()
          Tells whether this preference is natural or artificial.
 void read()
          Uses an unknown source to reload this preference.
 void removePreferenceListener(PreferenceListener<V> listener)
          Removes a listener from this preference.
 void setValue(V value)
          Sets the value of this preference.
 void write()
          Stores the contents of this preference at the location where it will be used.
 

Method Detail

read

void read()
Uses an unknown source to reload this preference. If the underlying resource cannot be interpreted, or contains an invalid value, then this Preference should not change its value.


write

void write()
Stores the contents of this preference at the location where it will be used.


isEnabled

boolean isEnabled(PreferenceOperation operation)
Tells whether operation is enabled and thus doOperation(PreferenceOperation) can be called.

Parameters:
operation - some operation of getOperations()
Returns:
true if the operation can be executed

getOperations

PreferenceOperation[] getOperations()
Gets a list of operations which can be executed by this preference.

Returns:
the list of operations (enabled and disabled operations)

doOperation

void doOperation(PreferenceOperation operation)
Executes the enabled operation operation. This method should not be called if operation is disabled.

Parameters:
operation - the key of the operation

addPreferenceListener

void addPreferenceListener(PreferenceListener<V> listener)
Adds a listener to this preference.

Parameters:
listener - the new listener

removePreferenceListener

void removePreferenceListener(PreferenceListener<V> listener)
Removes a listener from this preference.

Parameters:
listener - the listener to remove

getLabel

String getLabel()
Gets a short human readable string that is used as name for this preference.

Returns:
a short human readable string

getDescription

String getDescription()
Gets a long human readable description of this preference.

Returns:
the description, may be null, may be formated in HTML

getValueInfo

Object getValueInfo()
Information about how the value of this preference can be modified. See PreferenceModel.getValueInfo(int).

Returns:
the information or null

getValue

V getValue()
Gets the value of this preference.

Returns:
the value, might be null

setValue

void setValue(V value)
Sets the value of this preference.

Parameters:
value - the value, might be null (depends on the editor used for this preference)

isNatural

boolean isNatural()
Tells whether this preference is natural or artificial.

Returns:
true if natural, false if artificial
See Also:
PreferenceModel.isNatural(int)

getTypePath

Path getTypePath()
Gets the type of the value that this preferences uses. The path normally is just the name of some class. There is a set of standard paths defined in Path

Returns:
the type of value

getPath

Path getPath()
Gets the unique path of this resource. The path has to be unique within the model which uses this preference. Paths whose first segment is "dock" are reserved for this framework. Clients may use any path not starting with "dock".

Returns:
the unique path