bibliothek.gui.dock
Class PropertyTransformer

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

public class PropertyTransformer
extends java.lang.Object

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

Author:
Benjamin Sigg

Field Summary
private  java.util.Map<java.lang.String,DockablePropertyFactory> factories
           
 
Constructor Summary
PropertyTransformer()
          Creates a new transformer, the factories for SplitDockProperty, StackDockProperty and FlapDockProperty are installed.
PropertyTransformer(DockablePropertyFactory... factories)
          Creates a new transformer and installs factories.
 
Method Summary
 void addFactory(DockablePropertyFactory factory)
          Installs a factory
 DockableProperty read(java.io.DataInputStream in)
          Reads a property which was earlier stored.
 void write(DockableProperty property, java.io.DataOutputStream out)
          Writes property and all its successors into out.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factories

private java.util.Map<java.lang.String,DockablePropertyFactory> factories
Constructor Detail

PropertyTransformer

public PropertyTransformer()
Creates a new transformer, the factories for SplitDockProperty, StackDockProperty and FlapDockProperty are installed.


PropertyTransformer

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

Parameters:
factories - a list of factories to install
Method Detail

addFactory

public void addFactory(DockablePropertyFactory factory)
Installs a factory

Parameters:
factory - the new factory

write

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

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

read

public DockableProperty read(java.io.DataInputStream in)
                      throws java.io.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:
java.io.IOException - if the property can't be read