01: package org.swingml.treetablebrowser.ext;
02:
03: import javax.swing.*;
04: import javax.swing.table.*;
05:
06: /**
07: * @author Crosslogic
08: */
09: public class TreeTableBrowserCellLabelDecorator {
10:
11: public TreeTableBrowserCellLabelDecorator(
12: TreeTableComponent aTreeTable) {
13: super ();
14: TreeTableBrowserModelAdapter theTreeTableModel = (TreeTableBrowserModelAdapter) aTreeTable
15: .getModel();
16: for (int columnIndex = 0; columnIndex < theTreeTableModel
17: .getColumnCount(); columnIndex++) {
18: TableCellRenderer originalRenderer = aTreeTable
19: .getDefaultRenderer(theTreeTableModel
20: .getColumnClass(columnIndex));
21: TableCellEditor originalEditor = aTreeTable
22: .getDefaultEditor(theTreeTableModel
23: .getColumnClass(columnIndex));
24: if (originalRenderer instanceof JLabel) {
25: aTreeTable.setDefaultRenderer(theTreeTableModel
26: .getColumnClass(columnIndex),
27: new TreeTableBrowserCellLabelRenderer(
28: originalRenderer));
29: aTreeTable.setDefaultEditor(theTreeTableModel
30: .getColumnClass(columnIndex),
31: new TreeTableBrowserCellLabelEditor(
32: originalEditor));
33: }
34: }
35: }
36: }
|