bibliothek.gui.dock.facile.mode
Class LocationSettingConverter

java.lang.Object
  extended by bibliothek.gui.dock.facile.mode.LocationSettingConverter
All Implemented Interfaces:
ModeSettingsConverter<Location,Location>

public class LocationSettingConverter
extends Object
implements ModeSettingsConverter<Location,Location>

A ModeSettingsConverter for the LocationModeManager.

Author:
Benjamin Sigg

Constructor Summary
LocationSettingConverter(DockController controller)
          Creates a new converter.
LocationSettingConverter(PropertyTransformer transformer)
          Creates a new converter.
 
Method Summary
 void addFactory(DockablePropertyFactory factory)
          Adds an additional factory to this converter, needed to read and write DockablePropertys.
 Location convertToSetting(Location a)
          Converts a property from the inside world into the world outside.
 Location convertToWorld(Location b)
          Converts a property from the outside world into the world of this setting.
 Location readProperty(DataInputStream in)
          Reads a single property.
 Location readPropertyXML(XElement element)
          Reads a single property.
 void writeProperty(Location element, DataOutputStream out)
          Writes a single property of this setting.
 void writePropertyXML(Location b, XElement element)
          Writes a single property as xml element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocationSettingConverter

public LocationSettingConverter(DockController controller)
Creates a new converter.

Parameters:
controller - the controller in whose realm settings need to be converted

LocationSettingConverter

public LocationSettingConverter(PropertyTransformer transformer)
Creates a new converter.

Parameters:
transformer - transfomer used to read DockablePropertys.
Method Detail

addFactory

public void addFactory(DockablePropertyFactory factory)
Adds an additional factory to this converter, needed to read and write DockablePropertys.

Parameters:
factory - the additional factory

convertToSetting

public Location convertToSetting(Location a)
Description copied from interface: ModeSettingsConverter
Converts a property from the inside world into the world outside.

Specified by:
convertToSetting in interface ModeSettingsConverter<Location,Location>
Parameters:
a - the property from inside
Returns:
a property from outside

convertToWorld

public Location convertToWorld(Location b)
Description copied from interface: ModeSettingsConverter
Converts a property from the outside world into the world of this setting.

Specified by:
convertToWorld in interface ModeSettingsConverter<Location,Location>
Parameters:
b - a property from outside
Returns:
a property from inside

writeProperty

public void writeProperty(Location element,
                          DataOutputStream out)
                   throws IOException
Description copied from interface: ModeSettingsConverter
Writes a single property of this setting.

Specified by:
writeProperty in interface ModeSettingsConverter<Location,Location>
Parameters:
element - the property to write
out - the stream to write into
Throws:
IOException - if an I/O-error occurs

readProperty

public Location readProperty(DataInputStream in)
                      throws IOException
Description copied from interface: ModeSettingsConverter
Reads a single property.

Specified by:
readProperty in interface ModeSettingsConverter<Location,Location>
Parameters:
in - the stream to read from
Returns:
the property that has been read.
Throws:
IOException - if an I/O-error occurs

writePropertyXML

public void writePropertyXML(Location b,
                             XElement element)
Description copied from interface: ModeSettingsConverter
Writes a single property as xml element.

Specified by:
writePropertyXML in interface ModeSettingsConverter<Location,Location>
Parameters:
b - the property to write
element - the element to write into, the attributes of the element must not be changed

readPropertyXML

public Location readPropertyXML(XElement element)
Description copied from interface: ModeSettingsConverter
Reads a single property.

Specified by:
readPropertyXML in interface ModeSettingsConverter<Location,Location>
Parameters:
element - the element to read the property from
Returns:
the new property