org.netbeans.modules.wizard
Class MergeMap

java.lang.Object
  extended by org.netbeans.modules.wizard.MergeMap
All Implemented Interfaces:
java.util.Map

public class MergeMap
extends java.lang.Object
implements java.util.Map

A map which proxies a collection of sub-maps each of which has a unique id. Submaps can be added or removed en banc. Values from removed maps are retained; if push ("someKnownId") happens, the values previously added to the map while that ID was active reappear.

This allows us to implement backward/forward semantics for wizards, in which each pane (identified with a unique ID) can add its own settings to the settings map, but if the user presses the Back button, the settings from the formerly active pane can disappear - but if the user moves forward again, they are not lost.

Calling remove("someKeyBelongingToAnEarlierId") will completely remove that value; calling put ("someKeyBelongingToAnEarlierId", "newValue") replaces the earler value permanently.

This class is NOT AN API CLASS. There is no commitment that it will remain backward compatible or even exist in the future. The API of this library is in the packages org.netbeans.api.wizard and org.netbeans.spi.wizard.


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
MergeMap(java.lang.String currID)
          Creates a new instance of MergeMap
MergeMap(java.lang.String currId, java.util.Map everpresent)
          Creates a MergeMap with a set of key/value pairs that are always there (they came from a legacy wizard - used for bridging the old NetBeans wizards API and this one - some bridged wizards will have a first panel that gathered some settings using the old APIs framework, and we need to inject them here.
 
Method Summary
 void clear()
           
 boolean containsKey(java.lang.Object obj)
           
 boolean containsValue(java.lang.Object obj)
           
 java.lang.String currID()
          Get the ID of the current sub-map being written into.
 java.util.Set entrySet()
           
 java.lang.Object get(java.lang.Object obj)
           
 boolean isEmpty()
           
 java.util.Set keySet()
           
 java.lang.String popAndCalve()
          Remove the current sub-map.
 java.util.Map push(java.lang.String id)
          Move to a different ID (meaning add a new named map to proxy which can be calved off if necessary).
 java.lang.Object put(java.lang.Object obj, java.lang.Object obj1)
           
 void putAll(java.util.Map map)
           
 java.lang.Object remove(java.lang.Object obj)
           
 int size()
           
 java.lang.String toString()
           
 java.util.Collection values()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

MergeMap

public MergeMap(java.lang.String currID)
Creates a new instance of MergeMap


MergeMap

public MergeMap(java.lang.String currId,
                java.util.Map everpresent)
Creates a MergeMap with a set of key/value pairs that are always there (they came from a legacy wizard - used for bridging the old NetBeans wizards API and this one - some bridged wizards will have a first panel that gathered some settings using the old APIs framework, and we need to inject them here.

Method Detail

push

public java.util.Map push(java.lang.String id)
Move to a different ID (meaning add a new named map to proxy which can be calved off if necessary).


currID

public java.lang.String currID()
Get the ID of the current sub-map being written into.


popAndCalve

public java.lang.String popAndCalve()
Remove the current sub-map. Removes all of its settings from the MergedMap, but if push() is called with the returned value, the values associated with the ID being removed will be restored.


clear

public void clear()
Specified by:
clear in interface java.util.Map

containsKey

public boolean containsKey(java.lang.Object obj)
Specified by:
containsKey in interface java.util.Map

containsValue

public boolean containsValue(java.lang.Object obj)
Specified by:
containsValue in interface java.util.Map

entrySet

public java.util.Set entrySet()
Specified by:
entrySet in interface java.util.Map

get

public java.lang.Object get(java.lang.Object obj)
Specified by:
get in interface java.util.Map

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Map

keySet

public java.util.Set keySet()
Specified by:
keySet in interface java.util.Map

put

public java.lang.Object put(java.lang.Object obj,
                            java.lang.Object obj1)
Specified by:
put in interface java.util.Map

putAll

public void putAll(java.util.Map map)
Specified by:
putAll in interface java.util.Map

remove

public java.lang.Object remove(java.lang.Object obj)
Specified by:
remove in interface java.util.Map

size

public int size()
Specified by:
size in interface java.util.Map

values

public java.util.Collection values()
Specified by:
values in interface java.util.Map

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object