|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbibliothek.extension.gui.dock.preference.PreferenceStorage
public class PreferenceStorage
A preference storage can store the contents of one or of many PreferenceModel
s. It
uses the unique Path
s that each preference must have. In order to
read or write preferences some PreferenceFactory
s are used.
Constructor Summary | |
---|---|
PreferenceStorage()
Creates a new preference storage with some default factories set. |
Method Summary | |
---|---|
void |
addFactory(Path type,
PreferenceFactory<?> factory)
Adds a new factory to this storage, the factory will be responsible to write or read some kind of preferences. |
void |
clear()
Removes all preferences from this storage |
void |
load(PreferenceModel model,
boolean missingToNull)
Gets through all the preferences of model and changes
their values according to the values stored in this storage. |
void |
read(DataInputStream in)
Reads the contents of this storage from a stream. |
void |
readXML(XElement element)
Reads the contents of this storage from element . |
void |
store(PreferenceModel model)
Stores all the preferences of model in this storage. |
void |
write(DataOutputStream out)
Writes all values currently stored in this storage to out . |
void |
writeXML(XElement element)
Writes the contents of this storage into element , adds
new elements to element but does
not change the attributes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PreferenceStorage()
Method Detail |
---|
public void addFactory(Path type, PreferenceFactory<?> factory)
type
, then the old factory will be replaced by
factory
type
- the type of values factory
handles, this path
is most times just the name of some class. Node: there is a set of
standard paths defined in Path
factory
- the new factorypublic void store(PreferenceModel model)
model
in this storage. This
storage uses the paths
of the
preferences to store each value individually. If there is already a value
for some path, then that value gets replaced.
model
- the model to read outpublic void load(PreferenceModel model, boolean missingToNull)
model
and changes
their values according to the values stored in this storage.
missingToNull
- whether missing values should be set to null
. If
not set, then missing values remain just unchanged.model
- the model to write intopublic void write(DataOutputStream out) throws IOException
out
.
out
- the stream to write into
IOException
- if the stream is not writable or if there is a
factory missing for some typepublic void read(DataInputStream in) throws IOException
in
- the stream to read from
IOException
- if in
can't be readpublic void writeXML(XElement element)
element
, adds
new elements
to element
but does
not change the attributes. If a factory for some element is missing,
then this element will not be stored.
element
- the element to write intopublic void readXML(XElement element)
element
. Note that this
method does not clear the storage, if there are values in this storage that are not
in element
, then these values remain. If there is a
PreferenceFactory
missing for some type, then this value will silently
be left out.
element
- the element to read from
XException
- if element
is malformedpublic void clear()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |