blob: 3b02098b53da5d7aa52c98b792a5bf2e447dd776 (
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
62
63
64
65
66
|
package com.c2kernel.gui.data;
import java.util.ArrayList;
import javax.swing.tree.DefaultMutableTreeNode;
import com.c2kernel.collection.CollectionMember;
import com.c2kernel.collection.Parent2ChildCollection;
import com.c2kernel.common.ObjectNotFoundException;
import com.c2kernel.entity.proxy.ItemProxy;
import com.c2kernel.gui.EntityTabManager;
import com.c2kernel.lookup.EntityPath;
import com.c2kernel.lookup.InvalidEntityPathException;
import com.c2kernel.utils.Logger;
public class NodeCollection extends Node {
ItemProxy parent;
Parent2ChildCollection thisCollection;
String path;
public NodeCollection(ItemProxy parent, String name, EntityTabManager desktop) {
this.desktop = desktop;
this.parent = parent;
this.name = name;
this.path = parent.getSystemKey()+"/Collection/"+name;
createTreeNode();
this.makeExpandable();
}
public void loadChildren() {
Logger.msg(8, "NodeCollection::loadChildren()");
try {
thisCollection = (Parent2ChildCollection)parent.getObject("Collection/"+name);
} catch (ObjectNotFoundException ex) {
end(false);
return;
}
this.type = thisCollection.getClass().getName();
int lastDot = this.type.lastIndexOf('.');
if (lastDot > -1) this.type = this.type.substring(lastDot+1);
ArrayList collectionMembers = thisCollection.getMembers().list;
for (int i=0; i<collectionMembers.size(); i++)
{
CollectionMember aMember = (CollectionMember)collectionMembers.get(i);
if (aMember!=null)
try
{
EntityPath entityPath = new EntityPath(aMember.getEntityKey());
add(new NodeItem(entityPath, desktop));
}
catch (InvalidEntityPathException ex)
{
Logger.error("InvalidEntityPathException::NodeCollection::loadChildren() " + ex.toString());
}
}
end(false);
}
public DefaultMutableTreeNode getTreeNode() {
return treeNode;
}
}
|