bibliothek.gui.dock.support.mode
Interface ModeSettingsConverter<A,B>

Type Parameters:
A - the type of properties outside
B - the type of properties that represent the outside properties
All Known Implementing Classes:
LocationSettingConverter

public interface ModeSettingsConverter<A,B>

A converter converts properties from the outside to the inner world. It is used by the ModeSettings to store data in memory, a converter should ensure that the data does not reference any object from the application (such that garbage collection works).

Author:
Benjamin Sigg

Method Summary
 B convertToSetting(A a)
          Converts a property from the inside world into the world outside.
 A convertToWorld(B b)
          Converts a property from the outside world into the world of this setting.
 B readProperty(java.io.DataInputStream in)
          Reads a single property.
 B readPropertyXML(XElement element)
          Reads a single property.
 void writeProperty(B b, java.io.DataOutputStream out)
          Writes a single property of this setting.
 void writePropertyXML(B b, XElement element)
          Writes a single property as xml element.
 

Method Detail

convertToWorld

A convertToWorld(B b)
Converts a property from the outside world into the world of this setting.

Parameters:
b - a property from outside
Returns:
a property from inside

convertToSetting

B convertToSetting(A a)
Converts a property from the inside world into the world outside.

Parameters:
a - the property from inside
Returns:
a property from outside

writeProperty

void writeProperty(B b,
                   java.io.DataOutputStream out)
                   throws java.io.IOException
Writes a single property of this setting.

Parameters:
b - the property to write
out - the stream to write into
Throws:
java.io.IOException - if an I/O-error occurs

readProperty

B readProperty(java.io.DataInputStream in)
               throws java.io.IOException
Reads a single property.

Parameters:
in - the stream to read from
Returns:
the property that has been read.
Throws:
java.io.IOException - if an I/O-error occurs

writePropertyXML

void writePropertyXML(B b,
                      XElement element)
Writes a single property as xml element.

Parameters:
b - the property to write
element - the element to write into, the attributes of the element must not be changed

readPropertyXML

B readPropertyXML(XElement element)
Reads a single property.

Parameters:
element - the element to read the property from
Returns:
the new property