summaryrefslogtreecommitdiff
path: root/java/src/IceGrid/TreeNode/NodeViewRoot.java
blob: 5c60643548302cede4d21a312cfb49db6db1e549 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// **********************************************************************
//
// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
package IceGrid.TreeNode;

import IceGrid.ApplicationDescriptor;
import IceGrid.TreeModelI;

public class NodeViewRoot extends Parent
{
    public NodeViewRoot()
    {
	super(TreeModelI.NODE_VIEW);
    }

    public void init(ApplicationDescriptor[] applications)
    {
	assert(_children.size() == 0);
	
	for(int i = 0; i < applications.length; ++i)
	{
	    for(int j = 0 ; j < applications[i].nodes.length; ++j)
	    {
		String nodeName = applications[i].nodes[j].name;
		if(!_nodeMap.containsKey(nodeName))
		{
		    Node child = new Node(nodeName);
		    addChild(child);
		    child.addParent(this);
		    _nodeMap.put(nodeName, child);
		}
	    }
	}
    }
    
    public void clear()
    {
	_nodeMap.clear();
	clearChildren();
	fireStructureChanged(this);
    }


    Node findNode(String name)
    {
	return (Node)_nodeMap.get(name);
    }

    public String toString()
    {
	return "Nodes";
    }

    private java.util.Map _nodeMap = new java.util.HashMap();
}