summaryrefslogtreecommitdiff
path: root/source/com/c2kernel/gui/data/NodeContext.java
blob: 6e2bc758143729cc6288908fffb47a379bb6b188 (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
61
package com.c2kernel.gui.data;

import java.util.Enumeration;

import com.c2kernel.entity.proxy.DomainPathSubscriber;
import com.c2kernel.gui.EntityTabManager;
import com.c2kernel.lookup.DomainPath;
import com.c2kernel.lookup.Path;
import com.c2kernel.process.Gateway;
import com.c2kernel.utils.Logger;


public class NodeContext extends Node implements DomainPathSubscriber {
    Enumeration children;

    public NodeContext(Path path, EntityTabManager desktop) {
        super(path, desktop);
        this.sysKey=Path.INVALID;
        createTreeNode();
        this.makeExpandable();
        this.type = "Cristal Context";
    }


    public void loadChildren() {
        if (children == null) {
            Gateway.getProxyManager().subscribeTree(this, (DomainPath)binding);
            children = binding.getChildren();
        }

        int batch = 75;
        while (children.hasMoreElements() && batch > 0) {
            Path newPath = (Path)children.nextElement();
            if (newPath == null) break;
            Logger.msg(2, "Subscription.run() - new node: " + newPath );
            add( newNode(newPath));
            batch--;
        }
        end(children.hasMoreElements());
    }
    
    public void pathAdded(DomainPath path) {
        add(newNode(path));
    }

    public void refresh() {
        children = null;
        super.refresh();
    }
    public void pathRemoved(DomainPath path) {
        remove(path);
    }

}