01: package abbot.editor;
02:
03: import javax.swing.table.AbstractTableModel;
04:
05: import abbot.script.*;
06:
07: /** Formats a list of ComponentReferences for display in a table. */
08: class ReferencesModel extends AbstractTableModel {
09: private Resolver resolver;
10:
11: public ReferencesModel(Resolver resolver) {
12: this .resolver = resolver;
13: }
14:
15: public synchronized int getRowCount() {
16: return resolver.getComponentReferences().size();
17: }
18:
19: public synchronized int getColumnCount() {
20: return 1;
21: }
22:
23: /** Returns the entry object at the given row. */
24: public Object getValueAt(int row, int column) {
25: return resolver.getComponentReferences().toArray()[row];
26: }
27:
28: public String getColumnName(int col) {
29: return "";
30: }
31:
32: public boolean isCellEditable(int row, int col) {
33: return false;
34: }
35:
36: public Class getColumnClass(int col) {
37: if (col == 0)
38: return ComponentReference.class;
39: return Object.class;
40: }
41: }
|