01: package org.osbl.riskmanagement.gui.report;
02:
03: import org.wingx.treetable.XTreeTableNode;
04: import org.osbl.riskmanagement.model.RiskType;
05: import org.osbl.riskmanagement.logic.RiskManagementLogic;
06: import org.osbl.client.wings.form.GenericObjectTreeNode;
07: import org.osbl.client.wings.form.ObjectContext;
08:
09: import java.util.ArrayList;
10: import java.util.List;
11:
12: public class RootTreeTableNode extends GenericObjectTreeNode implements
13: XTreeTableNode {
14: boolean expanded;
15:
16: public RootTreeTableNode() {
17: }
18:
19: public RootTreeTableNode(Object object) {
20: this .object = object;
21: }
22:
23: public String getObject() {
24: return "Report";
25: }
26:
27: protected void loadChildren() {
28: RiskTreeModel model = (RiskTreeModel) getModel();
29: RiskManagementLogic logic = model.getTreeLogic();
30: List<RiskType> riskTypes = logic.roots();
31:
32: children = new ArrayList<GenericObjectTreeNode>(riskTypes
33: .size());
34: for (RiskType childRiskType : riskTypes) {
35: RiskTypeTreeTableNode child = new RiskTypeTreeTableNode(
36: childRiskType);
37: children.add(child);
38: child.setParent(this );
39: }
40:
41: sortChildren();
42: }
43:
44: public boolean getAllowsChildren() {
45: return true;
46: }
47:
48: public boolean isLeaf() {
49: return false;
50: }
51:
52: public Class getObjectType() {
53: return String.class;
54: }
55:
56: public Class[] getChildTypes() {
57: return new Class[] { RiskType.class };
58: }
59:
60: public Object loadObject() {
61: return getObject();
62: }
63:
64: public Object getValueAt(int column) {
65: return "" + column;
66: }
67:
68: public void setValueAt(Object value, int column) {
69: }
70:
71: public Class getNodeClass() {
72: return getObjectType();
73: }
74:
75: public boolean isExpanded() {
76: return expanded;
77: }
78:
79: public void setExpanded(boolean expanded) {
80: this .expanded = expanded;
81: }
82:
83: public int getDepth() {
84: return 0;
85: }
86: }
|