01: package org.osbl.riskmanagement.gui.report;
02:
03: import org.wingx.treetable.XTreeTableModel;
04: import org.wingx.treetable.XTreeTableNode;
05: import org.osbl.riskmanagement.model.*;
06: import org.osbl.client.wings.shell.Client;
07:
08: import java.math.BigDecimal;
09:
10: public class RiskTreeTableModel extends XTreeTableModel {
11: private static final Class[] columnClasses = { String.class,
12: BigDecimal.class, BigDecimal.class, BigDecimal.class,
13: BigDecimal.class, Criticality.class, };
14: private static final String[] columnNames = {
15: Client.getInstance().getResourceProvider().getMessage(
16: RiskType.class.getName() + ".name"),
17: Client.getInstance().getResourceProvider().getMessage(
18: Risk.class.getName() + ".amount"),
19: Client.getInstance().getResourceProvider().getMessage(
20: Risk.class.getName() + ".probability"),
21: Client.getInstance().getResourceProvider().getMessage(
22: Risk.class.getName() + ".multiplied"),
23: Client.getInstance().getResourceProvider().getMessage(
24: Risk.class.getName() + ".coverage"),
25: Client.getInstance().getResourceProvider().getMessage(
26: Risk.class.getName() + ".criticality"), };
27:
28: public RiskTreeTableModel() {
29: super (new RiskTreeModel());
30: }
31:
32: @Override
33: public int getColumnCount() {
34: return columnClasses.length;
35: }
36:
37: @Override
38: public String getColumnName(int index) {
39: return columnNames[index];
40: }
41:
42: @Override
43: public Class<?> getColumnClass(int index) {
44: return columnClasses[index];
45: }
46:
47: public String getFirstColumnValue(int row) {
48: XTreeTableNode node = (XTreeTableNode) getNodeModel().get(row);
49: return "" + node.getValueAt(0);
50: }
51: }
|