01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.admin.common;
05:
06: import javax.swing.table.TableCellEditor;
07: import javax.swing.table.TableCellRenderer;
08: import javax.swing.table.TableModel;
09:
10: public class PropertyTable extends XTable {
11: private PropertyTableModel m_model;
12:
13: public PropertyTable() {
14: super ();
15: }
16:
17: public PropertyTable(PropertyTableModel model) {
18: super ();
19: setModel(m_model = model);
20: }
21:
22: protected TableModel createDefaultDataModel() {
23: return new PropertyTableModel();
24: }
25:
26: public void setModel(TableModel model) {
27: if (!(model instanceof PropertyTableModel)) {
28: throw new IllegalArgumentException(
29: "Must be a PropertyTableModel");
30: }
31: super .setModel(m_model = (PropertyTableModel) model);
32: }
33:
34: public PropertyTableModel getPropertyModel() {
35: return (PropertyTableModel) getModel();
36: }
37:
38: public TableCellEditor getCellEditor(int row, int column) {
39: switch (column) {
40: case PropertyTableModel.VALUE_COLUMN:
41: return getDefaultEditor(m_model.getRowClass(row));
42: }
43:
44: return super .getCellEditor(row, column);
45: }
46:
47: public TableCellRenderer getCellRenderer(int row, int column) {
48: switch (column) {
49: case PropertyTableModel.VALUE_COLUMN:
50: return getDefaultRenderer(m_model.getRowClass(row));
51: }
52:
53: return super.getCellRenderer(row, column);
54: }
55: }
|