1 package edu.jiangxin.apktoobox.swing.treetable;
2
3 import edu.jiangxin.apktoolbox.swing.treetable.MyAbstractTreeTableModel;
4 import edu.jiangxin.apktoolbox.swing.treetable.MyTreeTableModel;
5
6 import java.util.Date;
7
8 public class MyDataModel extends MyAbstractTreeTableModel {
9
10 static protected String[] columnNames = { "Knotentext", "String", "Datum", "Integer" };
11
12
13 static protected Class<?>[] columnTypes = { MyTreeTableModel.class, String.class, Date.class, Integer.class };
14
15 public MyDataModel(MyDataNode rootNode) {
16 super(rootNode);
17 root = rootNode;
18 }
19
20 public Object getChild(Object parent, int index) {
21 return ((MyDataNode) parent).getChildren().get(index);
22 }
23
24
25 public int getChildCount(Object parent) {
26 return ((MyDataNode) parent).getChildren().size();
27 }
28
29
30 public int getColumnCount() {
31 return columnNames.length;
32 }
33
34
35 public String getColumnName(int column) {
36 return columnNames[column];
37 }
38
39
40 public Class<?> getColumnClass(int column) {
41 return columnTypes[column];
42 }
43
44 public Object getValueAt(Object node, int column) {
45 switch (column) {
46 case 0:
47 return ((MyDataNode) node).getName();
48 case 1:
49 return ((MyDataNode) node).getCapital();
50 case 2:
51 return ((MyDataNode) node).getDeclared();
52 case 3:
53 return ((MyDataNode) node).getArea();
54 default:
55 break;
56 }
57 return null;
58 }
59
60 public boolean isCellEditable(Object node, int column) {
61 return true;
62 }
63
64 public void setValueAt(Object aValue, Object node, int column) {
65 }
66
67 }