1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
| /**
* A results tree table model.
*
* @author Baptiste Wicht
*/
public class ResultsTreeTableModel extends DefaultTreeTableModel implements IModel {
/**
* The columsn of the tree table.
*
* @author Baptiste Wicht
*/
public interface Columns {
int NAME = 0;
int TOTAL = 1;
int AVERAGE = 2;
}
private final String[] headers;
/**
* Construct a new ResultsTreeTableModel.
*
* @param node The root node.
* @param headers The headers.
*/
public ResultsTreeTableModel(TreeTableNode node, String[] headers) {
super(node);
this.headers = headers.clone();
}
@Override
public int getColumnCount() {
return 3;
}
@Override
public Object getValueAt(Object node, int column) {
Object res = "n/a";
if (node instanceof TreeTableNode) {
TreeTableNode defNode = (TreeTableNode) node;
res = defNode.getValueAt(column);
}
return res;
}
@Override
public String getColumnName(int column) {
return headers[column];
}
@Override
public boolean isCellEditable(Object node, int column) {
return false;
}
} |
Partager