|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object bibliothek.extension.gui.dock.preference.AbstractPreferenceModel bibliothek.extension.gui.dock.preference.MergedPreferenceModel
public class MergedPreferenceModel
A preference model that envelops other models and uses their preferences. This model
makes use of a PathCombiner
to create unique identifiers for all preferences of its
sub-models.
Nested Class Summary | |
---|---|
protected static class |
MergedPreferenceModel.Index
Describes an index in one of the childen of a MergedPreferenceModel . |
Constructor Summary | |
---|---|
MergedPreferenceModel()
Creates a new model |
|
MergedPreferenceModel(PathCombiner combiner)
Creates a new path. |
Method Summary | |
---|---|
void |
add(PreferenceModel model,
Path path)
Adds model at the end of this model. |
void |
addPreferenceModelListener(PreferenceModelListener listener)
Adds a listener to this model. |
void |
clear()
Removes all children from this model. |
String |
getDescription(int index)
Gets a description of the index 'th object. |
String |
getLabel(int index)
Gets a short label that can be presented to the user for the index 'th object. |
PreferenceModel |
getModel(int index)
Gets the index 'th model of this merged model. |
Path |
getPath(int index)
Gets the unique identifier of the index 'th preference of
this model. |
int |
getSize()
Gets the number of preferences stored in 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 MergedPreferenceModel.Index |
indexAt(int globalIndex)
Gets the model and the index that globalIndex describe in
this model. |
protected int |
indexAt(PreferenceModel model,
int index)
Finds the global index if index is part of model . |
int |
indexOf(Path path)
Gets the index of path . |
int |
indexOf(PreferenceModel model)
Gets the index of model . |
void |
insert(int index,
PreferenceModel model,
Path path)
Inserts a new submodel into this model. |
boolean |
isNatural(int index)
Tells whether the index 'th preference is natural or
artificial. |
void |
read()
Uses an unknown source to update this model and load all the preferences that are currently available. |
void |
remove(int index)
Removes the index'th model of this merged model. |
void |
remove(MergedPreferenceModel model)
Removes model from this merged model. |
void |
remove(Path path)
Removes the model with the path path . |
void |
removePreferenceModelListener(PreferenceModelListener listener)
Removes a listener from this model. |
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 |
write()
Writes the current preferences to the location where they are used. |
Methods inherited from class bibliothek.extension.gui.dock.preference.AbstractPreferenceModel |
---|
doOperation, firePreferenceAdded, firePreferenceChanged, firePreferenceRemoved, getOperations, hasListeners, isEnabled, listeners |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MergedPreferenceModel()
public MergedPreferenceModel(PathCombiner combiner)
combiner
- tells how to combine the path of a model and of
its preferences in getPath(int)
. Not null
.Method Detail |
---|
public void add(PreferenceModel model, Path path)
model
at the end of this model.
model
- the additional modelpath
- the location of the new modelinsert(int, PreferenceModel, Path)
public void insert(int index, PreferenceModel model, Path path)
index
- the location of the new modelmodel
- the new modelpath
- the path of the new model, the path must be unique compared
to the paths of any other model.public void remove(int index)
index'th
model of this merged model.
index
- the location of a childpublic void remove(MergedPreferenceModel model)
model
from this merged model.
model
- the model to removepublic void remove(Path path)
path
.
path
- some pathpublic void clear()
public int indexOf(PreferenceModel model)
model
.
model
- some model to search
public int indexOf(Path path)
path
.
path
- the path of some model
public PreferenceModel getModel(int index)
index
'th model of this merged model.
index
- some index
public void read()
PreferenceModel
read
in interface PreferenceModel
read
in class AbstractPreferenceModel
public void write()
PreferenceModel
write
in interface PreferenceModel
write
in class AbstractPreferenceModel
public void addPreferenceModelListener(PreferenceModelListener listener)
PreferenceModel
addPreferenceModelListener
in interface PreferenceModel
addPreferenceModelListener
in class AbstractPreferenceModel
listener
- the new listenerpublic void removePreferenceModelListener(PreferenceModelListener listener)
PreferenceModel
removePreferenceModelListener
in interface PreferenceModel
removePreferenceModelListener
in class AbstractPreferenceModel
listener
- the listener to remove.public int getSize()
PreferenceModel
public String getLabel(int index)
PreferenceModel
index
'th object.
index
- the number the preference
public String getDescription(int index)
PreferenceModel
index
'th object. The description
is a longer text that will be presented to the user.
getDescription
in interface PreferenceModel
getDescription
in class AbstractPreferenceModel
index
- the number of the preference
null
, might be formated
in HTMLpublic Object getValueInfo(int index)
PreferenceModel
index
'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)
.
index
- the index of the info
null
if no information is
availablepublic Object getValue(int index)
PreferenceModel
index
'th preference. The type path
determines how the value is to be presented on the screen.
index
- the number of the preference
null
, has to be immutablepublic void setValue(int index, Object value)
PreferenceModel
index
'th preference.
index
- the number of the preferencevalue
- the new value, may be null
public Path getTypePath(int index)
PreferenceModel
index
'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
.
index
- the number of the value
public Path getPath(int index)
PreferenceModel
index
'th preference of
this model.
index
- the index of the preference
public boolean isNatural(int index)
PreferenceModel
index
'th preference is natural or
artificial.
isNatural
in interface PreferenceModel
isNatural
in class AbstractPreferenceModel
index
- the index of the preference
true
if the preference is natural, false
if it is artificialpublic void setValueNatural(int index)
PreferenceModel
PreferenceModel.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 PreferenceModel
setValueNatural
in class AbstractPreferenceModel
index
- the index of the preference to updateprotected MergedPreferenceModel.Index indexAt(int globalIndex)
globalIndex
describe in
this model.
globalIndex
- some global index
protected int indexAt(PreferenceModel model, int index)
index
is part of model
.
model
- a child of this modelindex
- an index in model
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |