net.infonode.docking.util
Class MixedViewHandler

java.lang.Object
  extended by net.infonode.docking.util.MixedViewHandler
All Implemented Interfaces:
ViewFactoryManager, ViewSerializer

public class MixedViewHandler
extends java.lang.Object
implements ViewFactoryManager, ViewSerializer

The mixed view map simplifies mixing static and dynamic views inside the same root window. The static views are handled by an AbstractViewMap and the dynamic views are handled by an custom ViewSerializer.

Since:
IDW 1.3.0
Version:
$Revision: 1.4 $
Author:
$Author: jesper $

Field Summary
private  AbstractViewMap viewMap
           
private  ViewSerializer viewSerializer
           
 
Constructor Summary
MixedViewHandler(AbstractViewMap viewMap, ViewSerializer viewSerializer)
          Constructor.
 
Method Summary
 ViewFactory[] getViewFactories()
          Returns the view factories.
 View readView(java.io.ObjectInputStream in)
          Reads and returns a view.
 void writeView(View view, java.io.ObjectOutputStream out)
          Writes a view to a stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

viewMap

private AbstractViewMap viewMap

viewSerializer

private ViewSerializer viewSerializer
Constructor Detail

MixedViewHandler

public MixedViewHandler(AbstractViewMap viewMap,
                        ViewSerializer viewSerializer)
Constructor.

Parameters:
viewMap - this map is first searched when serializing a view
viewSerializer - is used if the view was not found in the viewMap
Method Detail

getViewFactories

public ViewFactory[] getViewFactories()
Description copied from interface: ViewFactoryManager
Returns the view factories.

Specified by:
getViewFactories in interface ViewFactoryManager
Returns:
the view factories

writeView

public void writeView(View view,
                      java.io.ObjectOutputStream out)
               throws java.io.IOException
Description copied from interface: ViewSerializer
Writes a view to a stream. Note that the view property values are written automatically, so this method should not write them.

Specified by:
writeView in interface ViewSerializer
Parameters:
view - the view to write
out - the stream on which to write the view
Throws:
java.io.IOException - if there is a stream error

readView

public View readView(java.io.ObjectInputStream in)
              throws java.io.IOException
Description copied from interface: ViewSerializer
Reads and returns a view. Must read all the data written in the ViewSerializer.writeView(net.infonode.docking.View, java.io.ObjectOutputStream) method. Note that the view property values are read automatically, so this method should not read them. This method should return null if the serialized view can't be resolved.

Specified by:
readView in interface ViewSerializer
Parameters:
in - the stream from which to read the view state
Returns:
the view, null if the view can't be resolved
Throws:
java.io.IOException - if there is a stream error