public abstract class AbstractPreferenceModel extends Object implements PreferenceModel
PreferenceModel handling events and
returning null in most methods.| Constructor and Description |
|---|
AbstractPreferenceModel(DockController controller) |
| Modifier and Type | Method and Description |
|---|---|
void |
addPreferenceModelListener(PreferenceModelListener listener)
Adds a listener to this model.
|
void |
doOperation(int index,
PreferenceOperation operation)
Executes the enabled operation
operation. |
protected void |
firePreferenceAdded(int beginIndex,
int endIndex)
Informs all listeners that some preferences were added.
|
protected void |
firePreferenceChanged(int beginIndex,
int endIndex)
Informs all listeners that some preferences were changed.
|
protected void |
firePreferenceRemoved(int beginIndex,
int endIndex)
Informs all listeners that some preferences were removed.
|
DockController |
getController()
Gets the
DockController in whose realm this model is used. |
String |
getDescription(int index)
Gets a description of the
index'th object. |
PreferenceOperation[] |
getOperations(int index)
Gets all operations for which this model has a definition for
the preference at location
index. |
protected boolean |
hasListeners()
Tells whether this model has listeners attached or not.
|
boolean |
isEnabled(int index,
PreferenceOperation operation)
Tells whether the operation
operation is enabled for
the preference at location index. |
boolean |
isNatural(int index)
Tells whether the
index'th preference is natural or
artificial. |
protected PreferenceModelListener[] |
listeners()
Gets a list of all listeners registered at this model.
|
void |
read()
Uses an unknown source to update this model and load all the preferences
that are currently available.
|
void |
removePreferenceModelListener(PreferenceModelListener listener)
Removes a listener from this model.
|
void |
setValueNatural(int index)
Like
PreferenceModel.setValue(int, Object) this method changes the value of the index'th
preference. |
void |
write()
Writes the current preferences to the location where they are used.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetLabel, getPath, getSize, getTypePath, getValue, getValueInfo, setValuepublic AbstractPreferenceModel(DockController controller)
public DockController getController()
PreferenceModelDockController in whose realm this model is used. The controller
is mainly necessary to load icons and text.getController in interface PreferenceModelpublic void read()
PreferenceModelread in interface PreferenceModelpublic void write()
PreferenceModelwrite in interface PreferenceModelpublic boolean isEnabled(int index,
PreferenceOperation operation)
PreferenceModeloperation is enabled for
the preference at location index.isEnabled in interface PreferenceModelindex - some locationoperation - an operation from PreferenceModel.getOperations(int)true if the operation is enabled, false
if notpublic PreferenceOperation[] getOperations(int index)
PreferenceModelindex. Note: a PreferenceEditor
has operations as well, if the editor and the model share an operation,
then the operation is considered to belong to the editor.getOperations in interface PreferenceModelindex - the location of a preferencenullpublic void doOperation(int index,
PreferenceOperation operation)
PreferenceModeloperation.doOperation in interface PreferenceModelindex - the location of the affected preferenceoperation - the operation to executepublic void addPreferenceModelListener(PreferenceModelListener listener)
PreferenceModeladdPreferenceModelListener in interface PreferenceModellistener - the new listenerpublic void removePreferenceModelListener(PreferenceModelListener listener)
PreferenceModelremovePreferenceModelListener in interface PreferenceModellistener - the listener to remove.protected PreferenceModelListener[] listeners()
protected boolean hasListeners()
true if there are listenersprotected void firePreferenceAdded(int beginIndex,
int endIndex)
beginIndex - the index of the first new preferenceendIndex - the index of the last new preferenceprotected void firePreferenceRemoved(int beginIndex,
int endIndex)
beginIndex - the index of the first removed preferenceendIndex - the index of the last removed preferenceprotected void firePreferenceChanged(int beginIndex,
int endIndex)
beginIndex - the index of the first changed preferenceendIndex - the index of the last changed preferencepublic String getDescription(int index)
PreferenceModelindex'th object. The description
is a longer text that will be presented to the user.getDescription in interface PreferenceModelindex - the number of the preferencenull, might be formated
in HTMLpublic boolean isNatural(int index)
PreferenceModelindex'th preference is natural or
artificial.
isNatural in interface PreferenceModelindex - the index of the preferencetrue if the preference is natural, false
if it is artificialpublic void setValueNatural(int index)
PreferenceModelPreferenceModel.setValue(int, Object) this method changes the value of the index'th
preference. But this time the natural preference has to extract the value from
its underlying property.setValueNatural in interface PreferenceModelindex - the index of the preference to updateCopyright © 2017 Docking Frames. All rights reserved.