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/NodeCollection.java | 66 ++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100755 source/com/c2kernel/gui/data/NodeCollection.java (limited to 'source/com/c2kernel/gui/data/NodeCollection.java') diff --git a/source/com/c2kernel/gui/data/NodeCollection.java b/source/com/c2kernel/gui/data/NodeCollection.java new file mode 100755 index 0000000..3b02098 --- /dev/null +++ b/source/com/c2kernel/gui/data/NodeCollection.java @@ -0,0 +1,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