1:
31:
32: package ;
33:
34: import ;
35:
36:
41: public final class TableModelInfo
42: {
43:
46: private TableModelInfo ()
47: {
48: }
49:
50:
55: public static void printTableModel (final TableModel mod)
56: {
57: System.out.println("Tablemodel contains " + mod.getRowCount() + " rows.");
58: for (int i = 0; i < mod.getColumnCount(); i++)
59: {
60: System.out.println("Column: " + i + " Name = " + mod.getColumnName(i) + "; DataType = "
61: + mod.getColumnClass(i));
62: }
63:
64: System.out.println("Checking the data inside");
65: for (int rows = 0; rows < mod.getRowCount(); rows++)
66: {
67: for (int i = 0; i < mod.getColumnCount(); i++)
68: {
69: final Object value = mod.getValueAt(rows, i);
70: final Class c = mod.getColumnClass(i);
71: if (value == null)
72: {
73: System.out.println("ValueAt (" + rows + ", " + i + ") is null");
74: }
75: else
76: {
77: if (c.isAssignableFrom(value.getClass()) == false)
78: {
79: System.out.println
80: ("ValueAt (" + rows + ", " + i + ") is not assignable from " + c);
81: }
82: if (c.equals(Object.class))
83: {
84: System.out.println
85: ("ValueAt (" + rows + ", " + i + ") is in a generic column and is of "
86: + "type " + value.getClass());
87: }
88: }
89: }
90: }
91: }
92:
93:
98: public static void printTableModelContents (final TableModel mod)
99: {
100: System.out.println("Tablemodel contains " + mod.getRowCount() + " rows.");
101: for (int i = 0; i < mod.getColumnCount(); i++)
102: {
103: System.out.println("Column: " + i + " Name = " + mod.getColumnName(i) + "; DataType = "
104: + mod.getColumnClass(i));
105: }
106:
107: System.out.println("Checking the data inside");
108: for (int rows = 0; rows < mod.getRowCount(); rows++)
109: {
110: for (int i = 0; i < mod.getColumnCount(); i++)
111: {
112: final Object value = mod.getValueAt(rows, i);
113:
114: System.out.println("ValueAt (" + rows + ", " + i + ") is " + value);
115: }
116: }
117: }
118: }