|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbibliothek.extension.gui.dock.preference.AbstractPreferenceModel
bibliothek.extension.gui.dock.preference.PreferenceTreeModel
public class PreferenceTreeModel
A PreferenceModel that is also a TreeModel. It contains
other PreferenceModels and organizes them in a tree. The nodes
of this TreeModel are of the type PreferenceTreeModel.Node.
The root of this model never has a name nor a model.
| Nested Class Summary | |
|---|---|
static interface |
PreferenceTreeModel.Node
A single node of a PreferenceTreeModel. |
| Constructor Summary | |
|---|---|
PreferenceTreeModel(DockController controller)
Creates a new empty model. |
|
PreferenceTreeModel(PathCombiner combiner,
DockController controller)
Creates a new empty model. |
|
| Method Summary | |
|---|---|
void |
addPreferenceModelListener(PreferenceModelListener listener)
Adds a listener to this model. |
void |
addTreeModelListener(TreeModelListener l)
|
void |
delete(Path path)
Deletes the node at path and all its children from the
tree. |
void |
doOperation(int index,
PreferenceOperation operation)
Executes the enabled operation operation. |
PreferenceTreeModel.Node |
getChild(Object parent,
int index)
|
int |
getChildCount(Object parent)
|
String |
getDescription(int index)
Gets a description of the index'th object. |
int |
getIndexOfChild(Object parent,
Object child)
|
String |
getLabel(int index)
Gets a short label that can be presented to the user for the index'th object. |
PreferenceModel |
getModel(Path path)
Gets the model which was stored using path as key. |
PreferenceOperation[] |
getOperations(int index)
Gets all operations for which this model has a definition for the preference at location index. |
Path |
getPath(int index)
Gets the unique identifier of the index'th preference of
this model. |
PreferenceTreeModel.Node |
getRoot()
|
int |
getSize()
Gets the number of preferences stored in this model. |
protected TreeModelListener[] |
getTreeModelListeners()
Gets all the listeners currently known to this model. |
Path |
getTypePath(int index)
Tells what kind of type the index'th value is. |
Object |
getValue(int index)
Gets the index'th preference. |
Object |
getValueInfo(int index)
Gets information about how the index'th value can
be modified. |
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 |
isLeaf(Object node)
|
boolean |
isNatural(int index)
Tells whether the index'th preference is natural or
artificial. |
void |
put(Path path,
String name,
PreferenceModel model)
Sets name and model of a given node. |
void |
putLinked(Path path,
String nameId)
Sets the name of the node at path. |
void |
putLinked(Path path,
String nameId,
PreferenceModel model)
Sets name and model of a given node. |
void |
putModel(Path path,
PreferenceModel model)
Sets the model of the node at path. |
void |
putNode(Path path,
String name)
Sets the name of the node at path. |
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 |
removeTreeModelListener(TreeModelListener l)
|
void |
setValue(int index,
Object value)
Sets the value of the index'th preference. |
void |
setValueNatural(int index)
Like PreferenceModel.setValue(int, Object) this method changes the value of the index'th
preference. |
void |
valueForPathChanged(TreePath path,
Object newValue)
|
void |
write()
Writes the current preferences to the location where they are used. |
| Methods inherited from class bibliothek.extension.gui.dock.preference.AbstractPreferenceModel |
|---|
firePreferenceAdded, firePreferenceChanged, firePreferenceRemoved, getController, listeners |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PreferenceTreeModel(DockController controller)
controller - the controller in whose realm this model is used
public PreferenceTreeModel(PathCombiner combiner,
DockController controller)
combiner - tells how to combine the Path of a model with
the preferences of a model. Used in getPath(int). Not null.controller - the controller in whose realm this model is usedMergedPreferenceModel.MergedPreferenceModel(PathCombiner, DockController)| Method Detail |
|---|
protected boolean hasListeners()
AbstractPreferenceModel
hasListeners in class AbstractPreferenceModeltrue if there are listenerspublic void addTreeModelListener(TreeModelListener l)
addTreeModelListener in interface TreeModelpublic void addPreferenceModelListener(PreferenceModelListener listener)
PreferenceModel
addPreferenceModelListener in interface PreferenceModeladdPreferenceModelListener in class AbstractPreferenceModellistener - the new listenerpublic void removeTreeModelListener(TreeModelListener l)
removeTreeModelListener in interface TreeModelpublic void removePreferenceModelListener(PreferenceModelListener listener)
PreferenceModel
removePreferenceModelListener in interface PreferenceModelremovePreferenceModelListener in class AbstractPreferenceModellistener - the listener to remove.protected TreeModelListener[] getTreeModelListeners()
public PreferenceTreeModel.Node getChild(Object parent,
int index)
getChild in interface TreeModelpublic int getChildCount(Object parent)
getChildCount in interface TreeModel
public int getIndexOfChild(Object parent,
Object child)
getIndexOfChild in interface TreeModelpublic PreferenceTreeModel.Node getRoot()
getRoot in interface TreeModelpublic boolean isLeaf(Object node)
isLeaf in interface TreeModel
public void valueForPathChanged(TreePath path,
Object newValue)
valueForPathChanged in interface TreeModelpublic String getDescription(int index)
PreferenceModelindex'th object. The description
is a longer text that will be presented to the user.
getDescription in interface PreferenceModelgetDescription in class AbstractPreferenceModelindex - the number of the preference
null, might be formated
in HTMLpublic boolean isNatural(int index)
PreferenceModelindex'th preference is natural or
artificial.
isNatural in interface PreferenceModelisNatural in class AbstractPreferenceModelindex - the index of the preference
true 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 PreferenceModelsetValueNatural in class AbstractPreferenceModelindex - the index of the preference to updatepublic 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 PreferenceModelgetOperations in class AbstractPreferenceModelindex - the location of a preference
null
public boolean isEnabled(int index,
PreferenceOperation operation)
PreferenceModeloperation is enabled for
the preference at location index.
isEnabled in interface PreferenceModelisEnabled in class AbstractPreferenceModelindex - some locationoperation - an operation from PreferenceModel.getOperations(int)
true if the operation is enabled, false
if not
public void doOperation(int index,
PreferenceOperation operation)
PreferenceModeloperation.
doOperation in interface PreferenceModeldoOperation in class AbstractPreferenceModelindex - the location of the affected preferenceoperation - the operation to executepublic void read()
PreferenceModel
read in interface PreferenceModelread in class AbstractPreferenceModelpublic void write()
PreferenceModel
write in interface PreferenceModelwrite in class AbstractPreferenceModelpublic String getLabel(int index)
PreferenceModelindex'th object.
getLabel in interface PreferenceModelindex - the number the preference
public Path getPath(int index)
PreferenceModelindex'th preference of
this model.
getPath in interface PreferenceModelindex - the index of the preference
public int getSize()
PreferenceModel
getSize in interface PreferenceModelpublic Path getTypePath(int index)
PreferenceModelindex'th value is. The type
is represented as a path. Most times the path would equal the name of
some class. Note: there is a set of standard paths defined in Path.
getTypePath in interface PreferenceModelindex - the number of the value
public Object getValueInfo(int index)
PreferenceModelindex'th value can
be modified. For an integer that might be its upper and lower boundaries.
The type of this objects depends on PreferenceModel.getTypePath(int).
getValueInfo in interface PreferenceModelindex - the index of the info
null if no information is
availablepublic Object getValue(int index)
PreferenceModelindex'th preference. The type path
determines how the value is to be presented on the screen.
getValue in interface PreferenceModelindex - the number of the preference
null, has to be immutable
public void setValue(int index,
Object value)
PreferenceModelindex'th preference.
setValue in interface PreferenceModelindex - the number of the preferencevalue - the new value, may be null
public void putNode(Path path,
String name)
path. If there is no
such node, then the node and all its parents are created. Otherwise
just the name gets exchanged.
path - the path to the nodename - the new name of the node
public void putLinked(Path path,
String nameId)
path. If there is no
such node, then the node and all its parents are created. Otherwise
just the name gets exchanged.
path - the path to the nodenameId - the new name, an identifier used for the TextManager
public void putModel(Path path,
PreferenceModel model)
path. If there is
no such node, then the node and all its parents are created. Otherwise
just the model gets exchanged.
path - the path to changemodel - the new model
public void put(Path path,
String name,
PreferenceModel model)
path - the path to the nodename - the new namemodel - the new model, can be nullputLinked(Path, String, PreferenceModel),
putNode(Path, String),
putModel(Path, PreferenceModel)
public void putLinked(Path path,
String nameId,
PreferenceModel model)
path - the path to the nodenameId - the new name, an identifier used for a TextManager.model - the new model, can be nullpublic PreferenceModel getModel(Path path)
path as key.
path - the key of some model
nullpublic void delete(Path path)
path and all its children from the
tree. This also removes any PreferenceModel of the subtree. If
there is no node at path, then nothing happens
path - the path to remove
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||