1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.xnap.gui.table;
21
22 import javax.swing.table.TableCellRenderer;
23 import javax.swing.table.TableColumn;
24
25 public class Column extends TableColumn
26 {
27
28
29
30
31
32 protected Class dataType;
33 protected String name;
34 protected boolean visible = false;
35 private String key;
36
37
38
39 public Column(String key, String name, Class dataType, TableCellRenderer r)
40 {
41 super(0, 50, r, null);
42
43 this.name = name;
44 this.dataType = dataType;
45 this.key = key;
46 }
47
48 public Column(String name, Class dataType, TableCellRenderer r)
49 {
50 this(name, name, dataType, r);
51 }
52
53 public Column(String key, String name, Class dataType)
54 {
55 this(key, name, dataType, null);
56 }
57
58 public Column(String name, Class dataType)
59 {
60 this(name, name, dataType, null);
61 }
62
63
64
65 /***
66 * Returns the key. Used to store the "is visible" preference.
67 */
68 public String getKey()
69 {
70 return key;
71 }
72
73 public Class getDataType()
74 {
75 return dataType;
76 }
77
78 public Object getHeaderValue()
79 {
80 return name;
81 }
82
83 public String getName()
84 {
85 return name;
86 }
87
88 public boolean isVisible()
89 {
90 return visible;
91 }
92
93 public void setVisible(boolean newValue)
94 {
95 visible = newValue;
96 }
97
98 public String toString()
99 {
100 return name;
101 }
102
103 }