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