From 254ee6f47eebfc00462c10756a92066e82cc1a96 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Tue, 21 Jun 2011 15:46:02 +0200 Subject: Initial commit --- source/com/c2kernel/gui/data/NodeContext.java | 61 +++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100755 source/com/c2kernel/gui/data/NodeContext.java (limited to 'source/com/c2kernel/gui/data/NodeContext.java') diff --git a/source/com/c2kernel/gui/data/NodeContext.java b/source/com/c2kernel/gui/data/NodeContext.java new file mode 100755 index 0000000..6e2bc75 --- /dev/null +++ b/source/com/c2kernel/gui/data/NodeContext.java @@ -0,0 +1,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); + } + +} + + + + + + + -- cgit v1.2.3