01: package org.swingml.component;
02:
03: import java.util.*;
04:
05: import javax.swing.table.*;
06:
07: import org.swingml.model.*;
08:
09: import org.swingml.model.TableColumnModel;
10:
11: public class TableCellIconDecorator {
12:
13: public TableCellIconDecorator(JTableComponent aTable) {
14: super ();
15: JTableModel theTableModel = (JTableModel) aTable.getModel();
16: Iterator theColumns = theTableModel.getColumns().iterator();
17: TableColumnModel theColumn = null;
18: while (theColumns.hasNext()) {
19: theColumn = (TableColumnModel) theColumns.next();
20: TableCellRenderer originalRenderer = aTable
21: .getDefaultRenderer(theColumn.getType().getClass());
22: if (!(originalRenderer instanceof TableCellIconRenderer)) {
23: aTable.setDefaultRenderer(theColumn.getType()
24: .getClass(), new TableCellIconRenderer(
25: originalRenderer));
26: }
27: }
28: }
29: }
|