站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 4.1.0

Children.Map (NetBeans APIs) - NetBeans API Javadoc 4.1.0


org.openide.nodes
Class Children.Map

java.lang.Object
  extended byorg.openide.nodes.Children
      extended byorg.openide.nodes.Children.Map
Direct Known Subclasses:
Children.SortedMap
Enclosing class:
Children

public static class Children.Map
extends Children

Implements the storage of node children by a map. This class also permits association of a key with any node and to remove nodes by key. Subclasses should reasonably implement add(org.openide.nodes.Node[]) and remove(java.lang.Object).


Nested Class Summary
 
Nested classes inherited from class org.openide.nodes.Children
Children.Array, Children.Keys, Children.Map, Children.SortedArray, Children.SortedMap
 
Field Summary
protected  Map nodes
          A map to use to store children in.
 
Fields inherited from class org.openide.nodes.Children
LEAF, MUTEX
 
Constructor Summary
  Children.Map()
          Constructs a new list using HashMap.
protected Children.Map(Map m)
          Constructs a new list with a supplied map object.
 
Method Summary
 boolean add(Node[] arr)
          Does nothing.
protected  Map initMap()
          Initialize some nodes.
protected  void put(Object key, Node node)
          Add one key and one node to the list.
protected  void putAll(Map map)
          Add a collection of new key/value pairs into the map.
protected  void refresh()
          Allows subclasses that directly modifies the map with nodes to synchronize the state of the children.
protected  void refreshKey(Object key)
          Allows subclasses that directly modifies the map with nodes to synchronize the state of the children.
 boolean remove(Node[] arr)
          Does nothing.
protected  void remove(Object key)
          Remove a given child node from the list by its key.
protected  void removeAll(Collection keys)
          Remove some children from the list by key.
 
Methods inherited from class org.openide.nodes.Children
addNotify, clone, findChild, getNode, getNodes, getNodes, getNodesCount, isInitialized, nodes, removeNotify
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nodes

protected Map nodes
A map to use to store children in. Keys are Objects, values are Nodes. Do not modify elements in the map! Use it only for read access.

Constructor Detail

Children.Map

protected Children.Map(Map m)
Constructs a new list with a supplied map object. Should be used by subclasses desiring an alternate storage method. The map must not be explicitly modified after creation.

Parameters:
m - the map to use for this list

Children.Map

public Children.Map()
Constructs a new list using HashMap.

Method Detail

refresh

protected final void refresh()
Allows subclasses that directly modifies the map with nodes to synchronize the state of the children.


refreshKey

protected final void refreshKey(Object key)
Allows subclasses that directly modifies the map with nodes to synchronize the state of the children.

Parameters:
key - the key that should be refreshed

putAll

protected final void putAll(Map map)
Add a collection of new key/value pairs into the map. The supplied map may contain any keys, but the values must be Nodes.

Parameters:
map - the map with pairs to add

put

protected final void put(Object key,
                         Node node)
Add one key and one node to the list.

Parameters:
key - the key
node - the node

removeAll

protected final void removeAll(Collection keys)
Remove some children from the list by key.

Parameters:
keys - collection of keys to remove

remove

protected void remove(Object key)
Remove a given child node from the list by its key.

Parameters:
key - key to remove

initMap

protected Map initMap()
Initialize some nodes. Allows a subclass to provide a default map to initialize the map with. Called only if the map has not been provided in the constructor.

The default implementation returns new HashMap (7).

Returns:
a map from Objects to Nodes

add

public boolean add(Node[] arr)
Does nothing. Should be reimplemented in a subclass wishing to support external addition of nodes.

Specified by:
add in class Children
Parameters:
arr - nodes to add
Returns:
false in the default implementation

remove

public boolean remove(Node[] arr)
Does nothing. Should be reimplemented in a subclass wishing to support external removal of nodes.

Specified by:
remove in class Children
Parameters:
arr - nodes to remove
Returns:
false in the default implementation


Built on May 4 2005.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.