1 Clazz.declarePackage ("javax.swing.table");
2 Clazz.load (null, "javax.swing.table.TableColumn", ["java.lang.Boolean", "javax.swing.UIManager", "javax.swing.event.SwingPropertyChangeSupport", "javax.swing.table.DefaultTableCellRenderer"], function () {
3 c$ = Clazz.decorateAsClass (function () {
5 this.identifier = null;
8 this.preferredWidth = 0;
10 this.headerRenderer = null;
11 this.headerValue = null;
12 this.cellRenderer = null;
13 this.cellEditor = null;
14 this.isResizable = false;
15 this.resizedPostingDisableCount = 0;
16 this.changeSupport = null;
17 Clazz.instantialize (this, arguments);
18 }, javax.swing.table, "TableColumn");
19 Clazz.makeConstructor (c$,
23 Clazz.makeConstructor (c$,
24 function (modelIndex) {
25 this.construct (modelIndex, 75, null, null);
27 Clazz.makeConstructor (c$,
28 function (modelIndex, width) {
29 this.construct (modelIndex, width, null, null);
31 Clazz.makeConstructor (c$,
32 function (modelIndex, width, cellRenderer, cellEditor) {
33 this.modelIndex = modelIndex;
34 this.preferredWidth = this.width = Math.max (width, 0);
35 this.cellRenderer = cellRenderer;
36 this.cellEditor = cellEditor;
37 this.minWidth = Math.min (15, this.width);
38 this.maxWidth = 2147483647;
39 this.isResizable = true;
40 this.resizedPostingDisableCount = 0;
41 this.headerValue = null;
42 }, "~N,~N,javax.swing.table.TableCellRenderer,javax.swing.table.TableCellEditor");
43 Clazz.defineMethod (c$, "firePropertyChange",
44 function (propertyName, oldValue, newValue) {
45 if (this.changeSupport != null) {
46 this.changeSupport.firePropertyChange (propertyName, oldValue, newValue);
48 Clazz.defineMethod (c$, "firePropertyChange",
49 function (propertyName, oldValue, newValue) {
50 if (oldValue != newValue) {
51 this.firePropertyChange (propertyName, new Integer (oldValue), new Integer (newValue));
53 Clazz.defineMethod (c$, "firePropertyChange",
54 function (propertyName, oldValue, newValue) {
55 if (oldValue != newValue) {
56 this.firePropertyChange (propertyName, Boolean.$valueOf (oldValue), Boolean.$valueOf (newValue));
58 Clazz.defineMethod (c$, "setModelIndex",
59 function (modelIndex) {
60 var old = this.modelIndex;
61 this.modelIndex = modelIndex;
62 this.firePropertyChange ("modelIndex", old, modelIndex);
64 Clazz.defineMethod (c$, "getModelIndex",
66 return this.modelIndex;
68 Clazz.defineMethod (c$, "setIdentifier",
69 function (identifier) {
70 var old = this.identifier;
71 this.identifier = identifier;
72 this.firePropertyChange ("identifier", old, identifier);
74 Clazz.defineMethod (c$, "getIdentifier",
76 return (this.identifier != null) ? this.identifier : this.getHeaderValue ();
78 Clazz.defineMethod (c$, "setHeaderValue",
79 function (headerValue) {
80 var old = this.headerValue;
81 this.headerValue = headerValue;
82 this.firePropertyChange ("headerValue", old, headerValue);
84 Clazz.defineMethod (c$, "getHeaderValue",
86 return this.headerValue;
88 Clazz.defineMethod (c$, "setHeaderRenderer",
89 function (headerRenderer) {
90 var old = this.headerRenderer;
91 this.headerRenderer = headerRenderer;
92 this.firePropertyChange ("headerRenderer", old, headerRenderer);
93 }, "javax.swing.table.TableCellRenderer");
94 Clazz.defineMethod (c$, "getHeaderRenderer",
96 return this.headerRenderer;
98 Clazz.defineMethod (c$, "setCellRenderer",
99 function (cellRenderer) {
100 var old = this.cellRenderer;
101 this.cellRenderer = cellRenderer;
102 this.firePropertyChange ("cellRenderer", old, cellRenderer);
103 }, "javax.swing.table.TableCellRenderer");
104 Clazz.defineMethod (c$, "getCellRenderer",
106 return this.cellRenderer;
108 Clazz.defineMethod (c$, "setCellEditor",
109 function (cellEditor) {
110 var old = this.cellEditor;
111 this.cellEditor = cellEditor;
112 this.firePropertyChange ("cellEditor", old, cellEditor);
113 }, "javax.swing.table.TableCellEditor");
114 Clazz.defineMethod (c$, "getCellEditor",
116 return this.cellEditor;
118 Clazz.defineMethod (c$, "setWidth",
120 var old = this.width;
121 this.width = Math.min (Math.max (width, this.minWidth), this.maxWidth);
122 this.firePropertyChange ("width", old, this.width);
124 Clazz.defineMethod (c$, "getWidth",
128 Clazz.defineMethod (c$, "setPreferredWidth",
129 function (preferredWidth) {
130 var old = this.preferredWidth;
131 this.preferredWidth = Math.min (Math.max (preferredWidth, this.minWidth), this.maxWidth);
132 this.firePropertyChange ("preferredWidth", old, this.preferredWidth);
134 Clazz.defineMethod (c$, "getPreferredWidth",
136 return this.preferredWidth;
138 Clazz.defineMethod (c$, "setMinWidth",
139 function (minWidth) {
140 var old = this.minWidth;
141 this.minWidth = Math.max (Math.min (minWidth, this.maxWidth), 0);
142 if (this.width < this.minWidth) {
143 this.setWidth (this.minWidth);
144 }if (this.preferredWidth < this.minWidth) {
145 this.setPreferredWidth (this.minWidth);
146 }this.firePropertyChange ("minWidth", old, this.minWidth);
148 Clazz.defineMethod (c$, "getMinWidth",
150 return this.minWidth;
152 Clazz.defineMethod (c$, "setMaxWidth",
153 function (maxWidth) {
154 var old = this.maxWidth;
155 this.maxWidth = Math.max (this.minWidth, maxWidth);
156 if (this.width > this.maxWidth) {
157 this.setWidth (this.maxWidth);
158 }if (this.preferredWidth > this.maxWidth) {
159 this.setPreferredWidth (this.maxWidth);
160 }this.firePropertyChange ("maxWidth", old, this.maxWidth);
162 Clazz.defineMethod (c$, "getMaxWidth",
164 return this.maxWidth;
166 Clazz.defineMethod (c$, "setResizable",
167 function (isResizable) {
168 var old = this.isResizable;
169 this.isResizable = isResizable;
170 this.firePropertyChange ("isResizable", old, this.isResizable);
172 Clazz.defineMethod (c$, "getResizable",
174 return this.isResizable;
176 Clazz.defineMethod (c$, "sizeWidthToFit",
178 if (this.headerRenderer == null) {
180 }var c = this.headerRenderer.getTableCellRendererComponent (null, this.getHeaderValue (), false, false, 0, 0);
181 this.setMinWidth (c.getMinimumSize ().width);
182 this.setMaxWidth (c.getMaximumSize ().width);
183 this.setPreferredWidth (c.getPreferredSize ().width);
184 this.setWidth (this.getPreferredWidth ());
186 Clazz.defineMethod (c$, "disableResizedPosting",
188 this.resizedPostingDisableCount++;
190 Clazz.defineMethod (c$, "enableResizedPosting",
192 this.resizedPostingDisableCount--;
194 Clazz.defineMethod (c$, "addPropertyChangeListener",
195 function (listener) {
196 if (this.changeSupport == null) {
197 this.changeSupport = new javax.swing.event.SwingPropertyChangeSupport (this);
198 }this.changeSupport.addPropertyChangeListener (listener);
199 }, "java.beans.PropertyChangeListener");
200 Clazz.defineMethod (c$, "removePropertyChangeListener",
201 function (listener) {
202 if (this.changeSupport != null) {
203 this.changeSupport.removePropertyChangeListener (listener);
204 }}, "java.beans.PropertyChangeListener");
205 Clazz.defineMethod (c$, "getPropertyChangeListeners",
207 if (this.changeSupport == null) {
208 return new Array (0);
209 }return this.changeSupport.getPropertyChangeListeners ();
211 Clazz.defineMethod (c$, "createDefaultHeaderRenderer",
213 var label = ((Clazz.isClassDefined ("javax.swing.table.TableColumn$1") ? 0 : javax.swing.table.TableColumn.$TableColumn$1$ ()), Clazz.innerTypeInstance (javax.swing.table.TableColumn$1, this, null));
214 label.setHorizontalAlignment (0);
217 c$.$TableColumn$1$ = function () {
219 c$ = Clazz.declareAnonymous (javax.swing.table, "TableColumn$1", javax.swing.table.DefaultTableCellRenderer);
220 Clazz.overrideMethod (c$, "getTableCellRendererComponent",
221 function (table, value, isSelected, hasFocus, row, column) {
223 var header = table.getTableHeader ();
224 if (header != null) {
225 this.setForeground (header.getForeground ());
226 this.setBackground (header.getBackground ());
227 this.setFont (header.getFont ());
228 }}this.setText ((value == null) ? "" : value.toString ());
229 this.setBorder (javax.swing.UIManager.getBorder ("TableHeader.cellBorder"));
231 }, "javax.swing.JTable,~O,~B,~B,~N,~N");
234 Clazz.defineStatics (c$,
235 "COLUMN_WIDTH_PROPERTY", "columWidth",
236 "HEADER_VALUE_PROPERTY", "headerValue",
237 "HEADER_RENDERER_PROPERTY", "headerRenderer",
238 "CELL_RENDERER_PROPERTY", "cellRenderer");