bibliothek.gui.dock.layout
Class PropertyTransformer

java.lang.Object
  extended by bibliothek.gui.dock.layout.PropertyTransformer

public class PropertyTransformer
extends Object

A PropertTransformer can read and write instances of DockableProperty , assuming that a factory is installed for the property.

Author:
Benjamin Sigg

Field Summary
static Path FACTORY_EXTENSION
          Name of the ExtensionName that allows to load additional DockablePropertyFactorys
static String FACTORY_EXTENSION_PARAMETER
          Name of the only property of an ExtensionName that points to this
 
Constructor Summary
PropertyTransformer(DockController controller)
          Creates a new transformer, the factories for all DockablePropertys implemented by this framework are installed.
PropertyTransformer(DockController controller, DockablePropertyFactory... factories)
          Creates a new transformer and installs factories.
 
Method Summary
 void addFactory(DockablePropertyFactory factory)
          Installs a factory
 DockableProperty read(DataInputStream in)
          Reads a property which was earlier stored.
 DockableProperty readXML(XElement element)
          Reads a DockableProperty and its successors from an xml element.
 void write(DockableProperty property, DataOutputStream out)
          Writes property and all its successors into out.
 void writeXML(DockableProperty property, XElement element)
          Writes property and all its successors into element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FACTORY_EXTENSION

public static final Path FACTORY_EXTENSION
Name of the ExtensionName that allows to load additional DockablePropertyFactorys


FACTORY_EXTENSION_PARAMETER

public static final String FACTORY_EXTENSION_PARAMETER
Name of the only property of an ExtensionName that points to this

See Also:
Constant Field Values
Constructor Detail

PropertyTransformer

public PropertyTransformer(DockController controller)
Creates a new transformer, the factories for all DockablePropertys implemented by this framework are installed.

Parameters:
controller - the controller in whose realm this transformer is used

PropertyTransformer

public PropertyTransformer(DockController controller,
                           DockablePropertyFactory... factories)
Creates a new transformer and installs factories.

Parameters:
factories - a list of factories to install
controller - the controller in whose realm this transformer is used
Method Detail

addFactory

public void addFactory(DockablePropertyFactory factory)
Installs a factory

Parameters:
factory - the new factory

write

public void write(DockableProperty property,
                  DataOutputStream out)
           throws IOException
Writes property and all its successors into out.

Parameters:
property - the property to write
out - a stream to write into
Throws:
IOException - if the stream throws an exception

read

public DockableProperty read(DataInputStream in)
                      throws IOException
Reads a property which was earlier stored. If the property had any successors, then they are read as well.

Parameters:
in - a stream to read from
Returns:
the properties
Throws:
IOException - if the property can't be read

writeXML

public void writeXML(DockableProperty property,
                     XElement element)
Writes property and all its successors into element.

Parameters:
property - the property to write
element - an xml element to which this method will add some children

readXML

public DockableProperty readXML(XElement element)
Reads a DockableProperty and its successors from an xml element.

Parameters:
element - the element to read from
Returns:
the property or null if element is empty
Throws:
IllegalArgumentException - if a DockablePropertyFactory is missing.