Package net.infonode.docking.util
Class ViewMap
java.lang.Object
net.infonode.docking.util.AbstractViewMap
net.infonode.docking.util.ViewMap
- All Implemented Interfaces:
ViewFactoryManager,ViewSerializer
A map of views that handles view serialization by assigning an integer id to each view.
The id is unique for each view in the map. To guarantee serialization compatibility a view id must remain constant.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a view to the map.getView(int id) Returns the view with a specific id.protected ObjectvoidremoveView(int id) Removes a view with a specific id from the map.protected voidwriteViewId(Object id, ObjectOutputStream out) Methods inherited from class net.infonode.docking.util.AbstractViewMap
addView, contains, getView, getViewAtIndex, getViewCount, getViewFactories, readView, removeView, writeView
-
Constructor Details
-
ViewMap
public ViewMap()Constructor. -
ViewMap
Utility constructor that creates a map with a number of views. A view gets it's index in the array as id.- Parameters:
views- the views to add to the map
-
-
Method Details
-
addView
Adds a view to the map.- Parameters:
id- the view idview- the view
-
removeView
public void removeView(int id) Removes a view with a specific id from the map.- Parameters:
id- the view id
-
getView
Returns the view with a specific id.- Parameters:
id- the view id- Returns:
- the view with the id
-
writeViewId
- Specified by:
writeViewIdin classAbstractViewMap- Throws:
IOException
-
readViewId
- Specified by:
readViewIdin classAbstractViewMap- Throws:
IOException
-