KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > swingwtx > swing > table > TableColumn


1 /*
2    SwingWT
3    Copyright(c)2003-2004, R. Rawson-Tetley
4
5    For more information on distributing and using this program, please
6    see the accompanying "COPYING" file.
7
8    Contact me by electronic mail: bobintetley@users.sourceforge.net
9
10    $Log: TableColumn.java,v $
11    Revision 1.8 2004/04/16 14:39:03 bobintetley
12    Table and Tree cell editor support
13
14    Revision 1.7 2004/04/16 10:19:07 dannaab
15    Misc bug fixes, InputMap implementation, preliminary undo support
16
17    Revision 1.6 2004/02/02 09:33:39 bobintetley
18    Fixed broken TableColumn constructors
19
20    Revision 1.5 2003/12/17 10:57:35 bobintetley
21    JTableHeader implementation plus Table event/model fixes
22
23    Revision 1.4 2003/12/15 16:40:05 bobintetley
24    Core methods + skeleton JTableHeader/JScrollBar support
25
26    Revision 1.3 2003/12/14 09:13:39 bobintetley
27    Added CVS log to source headers
28
29 */

30
31 package swingwtx.swing.table;
32
33 public class TableColumn {
34
35     protected TableCellRenderer cellRenderer = null;
36     protected TableCellRenderer headerRenderer = null;
37     private int idx = 0;
38     private int width = 0;
39     private int maxWidth = 0;
40     private int minWidth = 0;
41     private int preferredWidth = 0;
42     private boolean resizable = true;
43     private Object JavaDoc headerValue = "";
44     private Object JavaDoc identifier = "";
45     private TableCellEditor tableCellEditor = null;
46
47     public TableColumn() {}
48     public TableColumn(int index) { idx = index; }
49     public TableColumn(int index, int width) { idx = index; this.width = width; }
50     public TableColumn(int index, int width, TableCellRenderer renderer, TableCellEditor editor) { idx = index; this.width = width; cellRenderer = renderer; tableCellEditor = editor;}
51
52
53     public void setCellRenderer(TableCellRenderer newrenderer) {
54         cellRenderer = newrenderer;
55     }
56
57     public TableCellRenderer getCellRenderer() {
58         return cellRenderer;
59     }
60
61     /** Not implemented - any reason to? */
62     public void setHeaderRenderer(TableCellRenderer headerRenderer) {
63         this.headerRenderer = headerRenderer;
64     }
65
66     public TableCellRenderer getHeaderRenderer() {
67         return headerRenderer;
68     }
69
70     public int getModelIndex() {
71         return idx;
72     }
73
74     public void setModelIndex(int index) {
75         idx = index;
76     }
77
78     public java.lang.Object JavaDoc getHeaderValue() {
79         return headerValue;
80     }
81     public void setHeaderValue(java.lang.Object JavaDoc headerValue) {
82         this.headerValue = headerValue;
83     }
84
85     public java.lang.Object JavaDoc getIdentifier() {
86         return identifier;
87     }
88     public void setIdentifier(java.lang.Object JavaDoc identifier) {
89         this.identifier = identifier;
90     }
91
92     public int getMaxWidth() {
93         return maxWidth;
94     }
95
96     /** Setter for property maxWidth.
97      * @param maxWidth New value of property maxWidth.
98      *
99      */

100     public void setMaxWidth(int maxWidth) {
101         this.maxWidth = maxWidth;
102     }
103
104     public int getMinWidth() {
105         return minWidth;
106     }
107
108     public void setMinWidth(int minWidth) {
109         this.minWidth = minWidth;
110     }
111
112     public int getPreferredWidth() {
113         return preferredWidth;
114     }
115
116     public void setPreferredWidth(int preferredWidth) {
117         this.preferredWidth = preferredWidth;
118     }
119
120     public boolean isResizable() {
121         return resizable;
122     }
123
124     public void setResizable(boolean resizable) {
125         this.resizable = resizable;
126     }
127
128     public TableCellEditor getCellEditor() {
129         return tableCellEditor;
130     }
131     
132     public void setCellEditor(TableCellEditor tableCellEditor) {
133         this.tableCellEditor = tableCellEditor;
134     }
135
136     public int getWidth() {
137         return width;
138     }
139
140     public void setWidth(int width) {
141         this.width = width;
142     }
143
144 }
145
Popular Tags