net.infonode.docking.util
Class StringViewMap

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

public class StringViewMap
extends AbstractViewMap

A map of views that handles view serialization by assigning a string id to each view. The id is unique for each view in the map. To guarantee serialization compatibility a view id must remain constant.

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

Constructor Summary
StringViewMap()
          Constructor.
StringViewMap(View[] views)
          Utility constructor that creates a map with a number of views.
 
Method Summary
 void addView(java.lang.String id, View view)
          Adds a view to the map.
 void addView(View view)
          Adds a view to the map.
 View getView(java.lang.String id)
          Returns the view with a specific id.
protected  java.lang.Object readViewId(java.io.ObjectInputStream in)
           
 void removeView(java.lang.String id)
          Removes a view with a specific id from the map.
protected  void writeViewId(java.lang.Object id, java.io.ObjectOutputStream out)
           
 
Methods inherited from class net.infonode.docking.util.AbstractViewMap
addView, contains, getView, getViewAtIndex, getViewCount, getViewFactories, readView, removeView, writeView
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringViewMap

public StringViewMap()
Constructor.


StringViewMap

public StringViewMap(View[] views)
Utility constructor that creates a map with a number of views. A view gets it's title as id.

Parameters:
views - the views to add to the map
Method Detail

addView

public void addView(View view)
Adds a view to the map. The view title is used as id.

Parameters:
view - the view

addView

public void addView(java.lang.String id,
                    View view)
Adds a view to the map.

Parameters:
id - the view id
view - the view

removeView

public void removeView(java.lang.String id)
Removes a view with a specific id from the map.

Parameters:
id - the view id

getView

public View getView(java.lang.String id)
Returns the view with a specific id.

Parameters:
id - the view id
Returns:
the view with the id

writeViewId

protected void writeViewId(java.lang.Object id,
                           java.io.ObjectOutputStream out)
                    throws java.io.IOException
Specified by:
writeViewId in class AbstractViewMap
Throws:
java.io.IOException

readViewId

protected java.lang.Object readViewId(java.io.ObjectInputStream in)
                               throws java.io.IOException
Specified by:
readViewId in class AbstractViewMap
Throws:
java.io.IOException