Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / swingjs / j2s / javax / swing / table / TableColumn.js
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 () {
4 this.modelIndex = 0;
5 this.identifier = null;
6 this.width = 0;
7 this.minWidth = 0;
8 this.preferredWidth = 0;
9 this.maxWidth = 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$, 
20 function () {
21 this.construct (0);
22 });
23 Clazz.makeConstructor (c$, 
24 function (modelIndex) {
25 this.construct (modelIndex, 75, null, null);
26 }, "~N");
27 Clazz.makeConstructor (c$, 
28 function (modelIndex, width) {
29 this.construct (modelIndex, width, null, null);
30 }, "~N,~N");
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);
47 }}, "~S,~O,~O");
48 Clazz.defineMethod (c$, "firePropertyChange", 
49  function (propertyName, oldValue, newValue) {
50 if (oldValue != newValue) {
51 this.firePropertyChange (propertyName,  new Integer (oldValue),  new Integer (newValue));
52 }}, "~S,~N,~N");
53 Clazz.defineMethod (c$, "firePropertyChange", 
54  function (propertyName, oldValue, newValue) {
55 if (oldValue != newValue) {
56 this.firePropertyChange (propertyName, Boolean.$valueOf (oldValue), Boolean.$valueOf (newValue));
57 }}, "~S,~B,~B");
58 Clazz.defineMethod (c$, "setModelIndex", 
59 function (modelIndex) {
60 var old = this.modelIndex;
61 this.modelIndex = modelIndex;
62 this.firePropertyChange ("modelIndex", old, modelIndex);
63 }, "~N");
64 Clazz.defineMethod (c$, "getModelIndex", 
65 function () {
66 return this.modelIndex;
67 });
68 Clazz.defineMethod (c$, "setIdentifier", 
69 function (identifier) {
70 var old = this.identifier;
71 this.identifier = identifier;
72 this.firePropertyChange ("identifier", old, identifier);
73 }, "~O");
74 Clazz.defineMethod (c$, "getIdentifier", 
75 function () {
76 return (this.identifier != null) ? this.identifier : this.getHeaderValue ();
77 });
78 Clazz.defineMethod (c$, "setHeaderValue", 
79 function (headerValue) {
80 var old = this.headerValue;
81 this.headerValue = headerValue;
82 this.firePropertyChange ("headerValue", old, headerValue);
83 }, "~O");
84 Clazz.defineMethod (c$, "getHeaderValue", 
85 function () {
86 return this.headerValue;
87 });
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", 
95 function () {
96 return this.headerRenderer;
97 });
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", 
105 function () {
106 return this.cellRenderer;
107 });
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", 
115 function () {
116 return this.cellEditor;
117 });
118 Clazz.defineMethod (c$, "setWidth", 
119 function (width) {
120 var old = this.width;
121 this.width = Math.min (Math.max (width, this.minWidth), this.maxWidth);
122 this.firePropertyChange ("width", old, this.width);
123 }, "~N");
124 Clazz.defineMethod (c$, "getWidth", 
125 function () {
126 return this.width;
127 });
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);
133 }, "~N");
134 Clazz.defineMethod (c$, "getPreferredWidth", 
135 function () {
136 return this.preferredWidth;
137 });
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);
147 }, "~N");
148 Clazz.defineMethod (c$, "getMinWidth", 
149 function () {
150 return this.minWidth;
151 });
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);
161 }, "~N");
162 Clazz.defineMethod (c$, "getMaxWidth", 
163 function () {
164 return this.maxWidth;
165 });
166 Clazz.defineMethod (c$, "setResizable", 
167 function (isResizable) {
168 var old = this.isResizable;
169 this.isResizable = isResizable;
170 this.firePropertyChange ("isResizable", old, this.isResizable);
171 }, "~B");
172 Clazz.defineMethod (c$, "getResizable", 
173 function () {
174 return this.isResizable;
175 });
176 Clazz.defineMethod (c$, "sizeWidthToFit", 
177 function () {
178 if (this.headerRenderer == null) {
179 return;
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 ());
185 });
186 Clazz.defineMethod (c$, "disableResizedPosting", 
187 function () {
188 this.resizedPostingDisableCount++;
189 });
190 Clazz.defineMethod (c$, "enableResizedPosting", 
191 function () {
192 this.resizedPostingDisableCount--;
193 });
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", 
206 function () {
207 if (this.changeSupport == null) {
208 return  new Array (0);
209 }return this.changeSupport.getPropertyChangeListeners ();
210 });
211 Clazz.defineMethod (c$, "createDefaultHeaderRenderer", 
212 function () {
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);
215 return label;
216 });
217 c$.$TableColumn$1$ = function () {
218 Clazz.pu$h(self.c$);
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) {
222 if (table != null) {
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"));
230 return this;
231 }, "javax.swing.JTable,~O,~B,~B,~N,~N");
232 c$ = Clazz.p0p ();
233 };
234 Clazz.defineStatics (c$,
235 "COLUMN_WIDTH_PROPERTY", "columWidth",
236 "HEADER_VALUE_PROPERTY", "headerValue",
237 "HEADER_RENDERER_PROPERTY", "headerRenderer",
238 "CELL_RENDERER_PROPERTY", "cellRenderer");
239 });