bibliothek.gui.dock.station.screen
Class ScreenDockStationFactory

java.lang.Object
  extended by bibliothek.gui.dock.station.screen.ScreenDockStationFactory
All Implemented Interfaces:
DockFactory<ScreenDockStation>
Direct Known Subclasses:
SecureScreenDockStationFactory

public class ScreenDockStationFactory
extends java.lang.Object
implements DockFactory<ScreenDockStation>

A DockFactory which writes and reads instances of ScreenDockStation. For every station, the bounds of all dialogs are stored.

Author:
Benjamin Sigg

Field Summary
static java.lang.String ID
           
private  java.awt.Window owner
           
 
Constructor Summary
ScreenDockStationFactory(java.awt.Window owner)
          Constructs a factory
 
Method Summary
protected  ScreenDockStation createStation()
          Creates a new ScreenDockStation which will be returned by read.
 java.lang.String getID()
          Gets the unique name of this factory.
 java.awt.Window getOwner()
          Gets the owner of all created dialogs.
 ScreenDockStation read(java.util.Map<java.lang.Integer,Dockable> children, boolean ignore, java.io.DataInputStream in)
          Reads a DockElement which was earlier stored by a DockFactoy of the same type.
 void read(java.util.Map<java.lang.Integer,Dockable> children, boolean ignore, ScreenDockStation station, java.io.DataInputStream in)
          Reads a DockElement which was earlier stored by a DockFactory of the same type.
 void write(ScreenDockStation station, java.util.Map<Dockable,java.lang.Integer> children, java.io.DataOutputStream out)
          Saves the properties of a DockElement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID

public static final java.lang.String ID
See Also:
Constant Field Values

owner

private java.awt.Window owner
Constructor Detail

ScreenDockStationFactory

public ScreenDockStationFactory(java.awt.Window owner)
Constructs a factory

Parameters:
owner - the window which will be used as owner for dialogs
Method Detail

getOwner

public java.awt.Window getOwner()
Gets the owner of all created dialogs.

Returns:
the owner

getID

public java.lang.String getID()
Description copied from interface: DockFactory
Gets the unique name of this factory.

Specified by:
getID in interface DockFactory<ScreenDockStation>
Returns:
the id

write

public void write(ScreenDockStation station,
                  java.util.Map<Dockable,java.lang.Integer> children,
                  java.io.DataOutputStream out)
           throws java.io.IOException
Description copied from interface: DockFactory
Saves the properties of a DockElement. If the element is a DockStation, then the factory has to store the location of the children. The factory can use the unique ids of the children which are stored in the map children. The factory don't have to store any information about the children itself.
If element is a Dockable, no information about the parent has to be stored.

Specified by:
write in interface DockFactory<ScreenDockStation>
Parameters:
station - the element to save
children - a list of unique names for each child of element, may be null if element is not a DockStation.
out - a stream to write information
Throws:
java.io.IOException - if the element can't be saved

read

public ScreenDockStation read(java.util.Map<java.lang.Integer,Dockable> children,
                              boolean ignore,
                              java.io.DataInputStream in)
                       throws java.io.IOException
Description copied from interface: DockFactory
Reads a DockElement which was earlier stored by a DockFactoy of the same type.

Specified by:
read in interface DockFactory<ScreenDockStation>
Parameters:
children - the known children of the element that is read. It's possible that not all children that were stored last time could be read again. In this case the map will contain no or a null entry.
ignore - true if the layout of the current children should not be changed. The map children is empty if ignoreChildren is true.
in - the stream to read from. The number of bytes read don't have to be the same number as the bytes that were written.
Returns:
the element that was read, null is a valid result and indicates that an element is no longer available.
Throws:
java.io.IOException - if the element can't be read from the stream

read

public void read(java.util.Map<java.lang.Integer,Dockable> children,
                 boolean ignore,
                 ScreenDockStation station,
                 java.io.DataInputStream in)
          throws java.io.IOException
Description copied from interface: DockFactory
Reads a DockElement which was earlier stored by a DockFactory of the same type. The contents have to be written into an already existing element.

Specified by:
read in interface DockFactory<ScreenDockStation>
Parameters:
children - the known children of the element that is read. It's possible that not all children that were stored last time could be read again. In this case the map will contain no or a null entry.
ignore - true if the layout of the current children should not be changed. The map children is empty if ignoreChildren is true.
station - an element which was created elsewhere and now has to be set up correctly by this factory
in - the stream to read from. The number of bytes read don't have to be the same number as the bytes that were written.
Throws:
java.io.IOException - if the element can't be read from the stream

createStation

protected ScreenDockStation createStation()
Creates a new ScreenDockStation which will be returned by read.

Returns:
the new station