summaryrefslogtreecommitdiff
path: root/java/src/IceGrid/TreeNode/ApplicationViewRoot.java
blob: 9b25db9604278bb0e85cc87ba36e86bf4ec0f116 (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
// **********************************************************************
//
// 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 ApplicationViewRoot extends Parent
{
    public ApplicationViewRoot(NodeViewRoot nodeViewRoot)
    {
	super(TreeModelI.APPLICATION_VIEW);
	_nodeViewRoot = nodeViewRoot;
    }

    //
    // The node view root must be (re-)initialized before the application view root
    // 
    public void init(ApplicationDescriptor[] descriptors)
    {
	assert(_children.size() == 0);

	_descriptors = descriptors;

	for(int i = 0; i <  descriptors.length; ++i)
	{
	    Application child = new  Application(descriptors[i], _nodeViewRoot);
	    addChild(child);
	    child.addParent(this);
	}

	//
	// Fire structure change for both application and node views
	//
	fireStructureChanged(this);
	_nodeViewRoot.fireStructureChanged(this);
    }
    
    public void clear()
    {
	clearChildren();
	_descriptors = null;
	fireStructureChanged(this);
    }

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

    private ApplicationDescriptor[] _descriptors;
    private NodeViewRoot _nodeViewRoot;
}