01: package org.osbl.orga.gui;
02:
03: import java.util.*;
04:
05: import org.osbl.orga.logic.OrgaStructureLogic;
06: import org.osbl.orga.model.Organisation;
07: import org.osbl.client.wings.form.GenericObjectTreeNode;
08: import org.osbl.client.wings.form.ObjectContext;
09:
10: /**
11: * @author hengels
12: * @version $Revision$
13: */
14: public class OrganisationsTreeNode extends GenericObjectTreeNode {
15: public OrganisationsTreeNode() {
16: }
17:
18: public OrganisationsTreeNode(String object) {
19: this .object = object;
20: }
21:
22: protected void loadChildren() {
23: OrgaTreeModel model = (OrgaTreeModel) getModel();
24: OrgaStructureLogic logic = model.getTreeLogic();
25: List<Organisation> organisations = logic.trees();
26: children = new ArrayList<GenericObjectTreeNode>();
27: for (Iterator<Organisation> iterator = organisations.iterator(); iterator
28: .hasNext();) {
29: Organisation organisation = iterator.next();
30: OrganisationTreeNode child = new OrganisationTreeNode(
31: organisation);
32: children.add(child);
33: child.setParent(this );
34: }
35: sortChildren();
36: }
37:
38: public boolean getAllowsChildren() {
39: return true;
40: }
41:
42: public boolean isLeaf() {
43: return false;
44: }
45:
46: public String toString() {
47: return "Orga";
48: }
49:
50: public Class getObjectType() {
51: return String.class;
52: }
53:
54: public Class[] getChildTypes() {
55: return new Class[] { Organisation.class };
56: }
57:
58: public String loadObject() {
59: return (String) object;
60: }
61: }
|