net.infonode.docking.util
Class AbstractViewMap

java.lang.Object
  extended by net.infonode.docking.util.AbstractViewMap
All Implemented Interfaces:
ViewFactoryManager, ViewSerializer
Direct Known Subclasses:
StringViewMap, ViewMap

public abstract class AbstractViewMap
extends java.lang.Object
implements ViewFactoryManager, ViewSerializer

Base class for view maps.

Since:
IDW 1.1.0
Version:
$Revision: 1.11 $
Author:
$Author: jesper $

Field Summary
private  java.util.HashMap viewMap
           
private  java.util.ArrayList views
           
 
Constructor Summary
AbstractViewMap()
           
 
Method Summary
protected  void addView(java.lang.Object id, View view)
           
 boolean contains(View view)
          Returns true if this view map contains the view.
protected  View getView(java.lang.Object id)
           
 View getViewAtIndex(int index)
          Returns the view at a specific index.
 int getViewCount()
          Returns the number of views in this map.
 ViewFactory[] getViewFactories()
          Returns the view factories.
 View readView(java.io.ObjectInputStream in)
          Reads and returns a view.
protected abstract  java.lang.Object readViewId(java.io.ObjectInputStream in)
           
protected  void removeView(java.lang.Object id)
           
 void writeView(View view, java.io.ObjectOutputStream out)
          Writes a view to a stream.
protected abstract  void writeViewId(java.lang.Object id, java.io.ObjectOutputStream out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

viewMap

private java.util.HashMap viewMap

views

private java.util.ArrayList views
Constructor Detail

AbstractViewMap

public AbstractViewMap()
Method Detail

writeViewId

protected abstract void writeViewId(java.lang.Object id,
                                    java.io.ObjectOutputStream out)
                             throws java.io.IOException
Throws:
java.io.IOException

readViewId

protected abstract java.lang.Object readViewId(java.io.ObjectInputStream in)
                                        throws java.io.IOException
Throws:
java.io.IOException

getViewCount

public int getViewCount()
Returns the number of views in this map.

Returns:
the number of views in this map

getViewAtIndex

public View getViewAtIndex(int index)
Returns the view at a specific index. The view index is the same as the number of views in the map when the view was added to the map.

Parameters:
index - the view index
Returns:
the view at the index

getViewFactories

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

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

contains

public boolean contains(View view)
Returns true if this view map contains the view.

Parameters:
view - the view
Returns:
true if this view map contains the view
Since:
IDW 1.3.0

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

addView

protected void addView(java.lang.Object id,
                       View view)

removeView

protected void removeView(java.lang.Object id)

getView

protected View getView(java.lang.Object id)