|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbibliothek.gui.dock.support.mode.ModeSettings<A,B>
A - the objects used by ModeManager to store informationB - the independent objects used by this ModeSettings to store informationpublic class ModeSettings<A,B>
A set of properties extracted from a ModeManager and its Modes. The properties
can be stored persistently and do not depend on any existing object (like for example the Modes).
| Constructor Summary | |
|---|---|
ModeSettings(ModeSettingsConverter<A,B> converter)
Creates a new setting |
|
| Method Summary | |
|---|---|
void |
add(Mode<A> mode)
Adds the settings of mode to this. |
void |
add(String id,
Path current,
Map<Path,A> properties,
Collection<Path> history)
Adds a new set of properties to this setting. |
void |
addFactory(ModeSettingFactory<A> factory)
Adds a factory to this setting. |
ModeSettingsConverter<A,B> |
getConverter()
Gets the converter that is used to transform internal and external properties. |
Path |
getCurrent(int index)
Gets the current mode of the index'th set. |
Path[] |
getHistory(int index)
Gets the history of the index'th set. |
String |
getId(int index)
Gets the unique id of the index'th set. |
Map<Path,A> |
getProperties(int index)
Gets the converted properties of the index'th set. |
ModeSetting<A> |
getSettings(Path modeId)
Gets the settings which belong to a Mode with unique
identifier modeId. |
void |
read(DataInputStream in)
Clears all properties of this setting and then reads new properties from in. |
void |
readXML(XElement element)
Clears all properties of this setting and then reads new properties from element. |
protected void |
rescueSettings(DataInputStream in,
Version version)
Called if some setting with version < 1.0.8 is found. |
protected void |
rescueSettings(XElement element)
Called if some setting does not have the "modes" entry, the assumption is that only old settings are missing this entry. |
protected Path |
resuceMode(String identifier)
Called if a single identifier of a mode is found as was used in version 1.0.7 and below. |
int |
size()
Gets the number of sets this setting stores. |
void |
write(DataOutputStream out)
Writes all properties of this setting into out. |
void |
writeXML(XElement element)
Writes the contents of this setting in xml format. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ModeSettings(ModeSettingsConverter<A,B> converter)
converter - the converter to read and write properties| Method Detail |
|---|
public ModeSettingsConverter<A,B> getConverter()
nullpublic void addFactory(ModeSettingFactory<A> factory)
ModeSettings.
factory - the new factory, not null
public void add(String id,
Path current,
Map<Path,A> properties,
Collection<Path> history)
id - the unique identifier of this set of propertiescurrent - the current mode of the set, can be nullproperties - the properties, will be copied by this methodhistory - older modes of the setting, will be copied by this methodpublic void add(Mode<A> mode)
mode to this.
mode - the mode whose settings are to be storedpublic int size()
public String getId(int index)
index - the index of the set
public Path getCurrent(int index)
index - the index of the set
public Path[] getHistory(int index)
index - the index of the set
public Map<Path,A> getProperties(int index)
index - the index of the set
public ModeSetting<A> getSettings(Path modeId)
Mode with unique
identifier modeId.
modeId - the unique identifier of some mode
null if not found
public void write(DataOutputStream out)
throws IOException
out.
out - the stream to write into
IOException - if an I/O-error occurs
protected void rescueSettings(DataInputStream in,
Version version)
throws IOException
in - the stream to read fromversion - the version that was found
IOException - in case of an errorprotected void rescueSettings(XElement element)
element - the entry that has to be rescued
XException - in case of an error related to a wrongly read attributeprotected Path resuceMode(String identifier)
identifier - the single identifier
null
public void read(DataInputStream in)
throws IOException
in.
in - the stream to read from
IOException - if an I/O-error occurspublic void writeXML(XElement element)
element - the elemnt to write into, the attributes of
element will not be changed.readXML(XElement)public void readXML(XElement element)
element.
element - the element from which the properties should be readwriteXML(XElement)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||