JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / site / j2s / jalview / appletgui / AnnotationColumnChooser.js
1 Clazz.declarePackage ("jalview.appletgui");\r
2 Clazz.load (["awt2swing.Panel", "jalview.appletgui.AnnotationRowFilter", "$.TitledPanel", "java.awt.event.ActionListener", "$.AdjustmentListener", "$.ItemListener", "$.MouseListener", "awt2swing.Checkbox", "$.Choice", "$.TextField", "java.awt.BorderLayout", "$.CardLayout"], "jalview.appletgui.AnnotationColumnChooser", ["awt2swing.Frame", "jalview.bin.JalviewLite", "jalview.datamodel.ColumnSelection", "$.GraphLine", "jalview.util.MessageManager", "jalview.viewmodel.annotationfilter.AnnotationFilterParameter", "java.awt.Color", "$.Dimension", "java.awt.event.MouseAdapter", "$.TextListener", "java.lang.Float", "java.util.Vector", "javax.swing.JPanel"], function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.annotations = null;\r
5 this.actionPanel = null;\r
6 this.thresholdPanel = null;\r
7 this.switchableViewsPanel = null;\r
8 this.switchableViewsLayout = null;\r
9 this.noGraphFilterView = null;\r
10 this.graphFilterView = null;\r
11 this.annotationComboBoxPanel = null;\r
12 this.borderLayout1 = null;\r
13 this.gBorderLayout = null;\r
14 this.ngBorderLayout = null;\r
15 this.threshold = null;\r
16 this.gStructureFilterPanel = null;\r
17 this.ngStructureFilterPanel = null;\r
18 this.currentStructureFilterPanel = null;\r
19 this.currentSearchPanel = null;\r
20 this.gSearchPanel = null;\r
21 this.ngSearchPanel = null;\r
22 this.currentFurtherActionPanel = null;\r
23 this.gFurtherActionPanel = null;\r
24 this.ngFurtherActionPanel = null;\r
25 this.actionOption = 1;\r
26 this.oldColumnSelection = null;\r
27 if (!Clazz.isClassDefined ("jalview.appletgui.AnnotationColumnChooser.FurtherActionPanel")) {\r
28 jalview.appletgui.AnnotationColumnChooser.$AnnotationColumnChooser$FurtherActionPanel$ ();\r
29 }\r
30 if (!Clazz.isClassDefined ("jalview.appletgui.AnnotationColumnChooser.StructureFilterPanel")) {\r
31 jalview.appletgui.AnnotationColumnChooser.$AnnotationColumnChooser$StructureFilterPanel$ ();\r
32 }\r
33 if (!Clazz.isClassDefined ("jalview.appletgui.AnnotationColumnChooser.SearchPanel")) {\r
34 jalview.appletgui.AnnotationColumnChooser.$AnnotationColumnChooser$SearchPanel$ ();\r
35 }\r
36 Clazz.instantialize (this, arguments);\r
37 }, jalview.appletgui, "AnnotationColumnChooser", jalview.appletgui.AnnotationRowFilter, [java.awt.event.ActionListener, java.awt.event.AdjustmentListener, java.awt.event.ItemListener, java.awt.event.MouseListener]);\r
38 Clazz.prepareFields (c$, function () {\r
39 this.annotations =  new awt2swing.Choice ();\r
40 this.actionPanel =  new awt2swing.Panel ();\r
41 this.thresholdPanel =  new jalview.appletgui.TitledPanel ();\r
42 this.switchableViewsPanel =  new awt2swing.Panel ( new java.awt.CardLayout ());\r
43 this.switchableViewsLayout = (this.switchableViewsPanel.getLayout ());\r
44 this.noGraphFilterView =  new awt2swing.Panel ();\r
45 this.graphFilterView =  new awt2swing.Panel ();\r
46 this.annotationComboBoxPanel =  new awt2swing.Panel ();\r
47 this.borderLayout1 =  new java.awt.BorderLayout ();\r
48 this.gBorderLayout =  new java.awt.BorderLayout ();\r
49 this.ngBorderLayout =  new java.awt.BorderLayout ();\r
50 this.threshold =  new awt2swing.Choice ();\r
51 });\r
52 Clazz.makeConstructor (c$, \r
53 function () {\r
54 Clazz.superConstructor (this, jalview.appletgui.AnnotationColumnChooser, []);\r
55 try {\r
56 this.jbInit ();\r
57 } catch (ex) {\r
58 if (Clazz.exceptionOf (ex, Exception)) {\r
59 ex.printStackTrace ();\r
60 } else {\r
61 throw ex;\r
62 }\r
63 }\r
64 });\r
65 Clazz.makeConstructor (c$, \r
66 function (av, ap) {\r
67 Clazz.superConstructor (this, jalview.appletgui.AnnotationColumnChooser, [av, ap]);\r
68 this.frame =  new awt2swing.Frame ();\r
69 this.frame.add (this);\r
70 jalview.bin.JalviewLite.addFrame (this.frame, jalview.util.MessageManager.getString ("label.select_by_annotation"), 520, 215);\r
71 this.slider.addAdjustmentListener (this);\r
72 this.slider.addMouseListener (this);\r
73 if (av.getAlignment ().getAlignmentAnnotation () == null) {\r
74 return;\r
75 }this.setOldColumnSelection (av.getColumnSelection ());\r
76 this.adjusting = true;\r
77 var list =  new java.util.Vector ();\r
78 var index = 1;\r
79 for (var i = 0; i < av.getAlignment ().getAlignmentAnnotation ().length; i++) {\r
80 var label = av.getAlignment ().getAlignmentAnnotation ()[i].label;\r
81 if (!list.contains (label)) {\r
82 list.addElement (label);\r
83 } else {\r
84 list.addElement (label + "_" + (index++));\r
85 }}\r
86 for (var i = 0; i < list.size (); i++) {\r
87 this.annotations.addItem (list.elementAt (i).toString ());\r
88 }\r
89 this.populateThresholdComboBox (this.threshold);\r
90 if (av.getAnnotationColumnSelectionState () != null) {\r
91 this.currentSearchPanel = av.getAnnotationColumnSelectionState ().getCurrentSearchPanel ();\r
92 this.currentStructureFilterPanel = av.getAnnotationColumnSelectionState ().getCurrentStructureFilterPanel ();\r
93 this.annotations.select (new Integer (av.getAnnotationColumnSelectionState ().getAnnotations ().getSelectedIndex ()));\r
94 this.threshold.select (new Integer (av.getAnnotationColumnSelectionState ().getThreshold ().getSelectedIndex ()));\r
95 this.actionOption = av.getAnnotationColumnSelectionState ().getActionOption ();\r
96 }try {\r
97 this.jbInit ();\r
98 } catch (ex) {\r
99 if (Clazz.exceptionOf (ex, Exception)) {\r
100 } else {\r
101 throw ex;\r
102 }\r
103 }\r
104 this.adjusting = false;\r
105 this.updateView ();\r
106 this.frame.invalidate ();\r
107 this.frame.pack ();\r
108 }, "jalview.appletgui.AlignViewport,jalview.appletgui.AlignmentPanel");\r
109 Clazz.defineMethod (c$, "jbInit", \r
110  function () {\r
111 this.ok.setLabel (jalview.util.MessageManager.getString ("action.ok"));\r
112 this.cancel.setLabel (jalview.util.MessageManager.getString ("action.cancel"));\r
113 this.thresholdValue.setEnabled (false);\r
114 this.thresholdValue.setColumns (7);\r
115 this.ok.addActionListener (this);\r
116 this.cancel.addActionListener (this);\r
117 this.annotations.addItemListener (this);\r
118 this.thresholdValue.addActionListener (this);\r
119 this.threshold.addItemListener (this);\r
120 this.slider.setBackground (java.awt.Color.white);\r
121 this.slider.setEnabled (false);\r
122 this.slider.setPreferredSize ( new java.awt.Dimension (100, 32));\r
123 this.thresholdPanel.setBackground (java.awt.Color.white);\r
124 this.actionPanel.setBackground (java.awt.Color.white);\r
125 this.graphFilterView.setLayout (this.gBorderLayout);\r
126 this.graphFilterView.setBackground (java.awt.Color.white);\r
127 this.noGraphFilterView.setLayout (this.ngBorderLayout);\r
128 this.noGraphFilterView.setBackground (java.awt.Color.white);\r
129 this.annotationComboBoxPanel.setBackground (java.awt.Color.white);\r
130 this.gSearchPanel = Clazz.innerTypeInstance (jalview.appletgui.AnnotationColumnChooser.SearchPanel, this, null, this);\r
131 this.ngSearchPanel = Clazz.innerTypeInstance (jalview.appletgui.AnnotationColumnChooser.SearchPanel, this, null, this);\r
132 this.gFurtherActionPanel = Clazz.innerTypeInstance (jalview.appletgui.AnnotationColumnChooser.FurtherActionPanel, this, null, this);\r
133 this.ngFurtherActionPanel = Clazz.innerTypeInstance (jalview.appletgui.AnnotationColumnChooser.FurtherActionPanel, this, null, this);\r
134 this.gStructureFilterPanel = Clazz.innerTypeInstance (jalview.appletgui.AnnotationColumnChooser.StructureFilterPanel, this, null, this);\r
135 this.ngStructureFilterPanel = Clazz.innerTypeInstance (jalview.appletgui.AnnotationColumnChooser.StructureFilterPanel, this, null, this);\r
136 this.thresholdPanel.setTitle ("Threshold Filter");\r
137 this.thresholdPanel.add (this.getThreshold ());\r
138 this.thresholdPanel.add (this.slider);\r
139 this.thresholdPanel.add (this.thresholdValue);\r
140 this.actionPanel.add (this.ok);\r
141 this.actionPanel.add (this.cancel);\r
142 var staticPanel =  new javax.swing.JPanel ();\r
143 staticPanel.setLayout ( new java.awt.BorderLayout ());\r
144 staticPanel.setBackground (java.awt.Color.white);\r
145 staticPanel.add (this.gSearchPanel, "North");\r
146 staticPanel.add (this.gStructureFilterPanel, "South");\r
147 this.graphFilterView.add (staticPanel, "North");\r
148 this.graphFilterView.add (this.thresholdPanel, "Center");\r
149 this.graphFilterView.add (this.gFurtherActionPanel, "South");\r
150 this.noGraphFilterView.add (this.ngSearchPanel, "First");\r
151 this.noGraphFilterView.add (this.ngStructureFilterPanel, "Center");\r
152 this.noGraphFilterView.add (this.ngFurtherActionPanel, "Center");\r
153 this.annotationComboBoxPanel.add (this.getAnnotations ());\r
154 this.switchableViewsPanel.add (this.noGraphFilterView, jalview.appletgui.AnnotationColumnChooser.NO_GRAPH_VIEW);\r
155 this.switchableViewsPanel.add (this.graphFilterView, jalview.appletgui.AnnotationColumnChooser.GRAPH_VIEW);\r
156 this.setLayout (this.borderLayout1);\r
157 this.add (this.annotationComboBoxPanel, "First");\r
158 this.add (this.switchableViewsPanel, "Center");\r
159 this.add (this.actionPanel, "South");\r
160 this.selectedAnnotationChanged ();\r
161 this.validate ();\r
162 });\r
163 Clazz.overrideMethod (c$, "reset", \r
164 function () {\r
165 if (this.getOldColumnSelection () != null) {\r
166 this.av.getColumnSelection ().clear ();\r
167 if (this.av.getAnnotationColumnSelectionState () != null) {\r
168 var oldSelection = this.av.getAnnotationColumnSelectionState ().getOldColumnSelection ();\r
169 if (oldSelection != null && oldSelection.getHiddenColumns () != null && !oldSelection.getHiddenColumns ().isEmpty ()) {\r
170 for (var itr = oldSelection.getHiddenColumns ().iterator (); itr.hasNext (); ) {\r
171 var positions = itr.next ();\r
172 this.av.hideColumns (positions[0], positions[1]);\r
173 }\r
174 }this.av.setColumnSelection (oldSelection);\r
175 }this.ap.paintAlignment (true);\r
176 }});\r
177 Clazz.overrideMethod (c$, "adjustmentValueChanged", \r
178 function (evt) {\r
179 if (!this.adjusting) {\r
180 this.thresholdValue.setText ((this.slider.getValue () / 1000) + "");\r
181 this.valueChanged (!this.sliderDragging);\r
182 }}, "java.awt.event.AdjustmentEvent");\r
183 Clazz.defineMethod (c$, "addSliderMouseListeners", \r
184 function () {\r
185 this.slider.addMouseListener (((Clazz.isClassDefined ("jalview.appletgui.AnnotationColumnChooser$1") ? 0 : jalview.appletgui.AnnotationColumnChooser.$AnnotationColumnChooser$1$ ()), Clazz.innerTypeInstance (jalview.appletgui.AnnotationColumnChooser$1, this, null)));\r
186 });\r
187 Clazz.overrideMethod (c$, "valueChanged", \r
188 function (updateAllAnnotation) {\r
189 if (this.slider.isEnabled ()) {\r
190 this.getCurrentAnnotation ().threshold.value = this.slider.getValue () / 1000;\r
191 this.updateView ();\r
192 this.ap.paintAlignment (false);\r
193 }}, "~B");\r
194 Clazz.defineMethod (c$, "getThreshold", \r
195 function () {\r
196 return this.threshold;\r
197 });\r
198 Clazz.defineMethod (c$, "setThreshold", \r
199 function (threshold) {\r
200 this.threshold = threshold;\r
201 }, "awt2swing.Choice");\r
202 Clazz.defineMethod (c$, "getAnnotations", \r
203 function () {\r
204 return this.annotations;\r
205 });\r
206 Clazz.defineMethod (c$, "setAnnotations", \r
207 function (annotations) {\r
208 this.annotations = annotations;\r
209 }, "awt2swing.Choice");\r
210 Clazz.overrideMethod (c$, "updateView", \r
211 function () {\r
212 if (this.adjusting) {\r
213 return;\r
214 }var filterParams =  new jalview.viewmodel.annotationfilter.AnnotationFilterParameter ();\r
215 this.setCurrentAnnotation (this.av.getAlignment ().getAlignmentAnnotation ()[this.getAnnotations ().getSelectedIndex ()]);\r
216 var selectedThresholdItem = this.getSelectedThresholdItem (this.getThreshold ().getSelectedIndex ());\r
217 this.slider.setEnabled (true);\r
218 this.thresholdValue.setEnabled (true);\r
219 if (selectedThresholdItem == -1) {\r
220 this.slider.setEnabled (false);\r
221 this.thresholdValue.setEnabled (false);\r
222 this.thresholdValue.setText ("");\r
223 } else if (selectedThresholdItem != -1) {\r
224 if (this.getCurrentAnnotation ().threshold == null) {\r
225 this.getCurrentAnnotation ().setThreshold ( new jalview.datamodel.GraphLine ((this.getCurrentAnnotation ().graphMax - this.getCurrentAnnotation ().graphMin) / 2, "Threshold", java.awt.Color.black));\r
226 }this.adjusting = true;\r
227 var range = this.getCurrentAnnotation ().graphMax * 1000 - this.getCurrentAnnotation ().graphMin * 1000;\r
228 this.slider.setMinimum (Clazz.floatToInt (this.getCurrentAnnotation ().graphMin * 1000));\r
229 this.slider.setMaximum (Clazz.floatToInt (this.getCurrentAnnotation ().graphMax * 1000));\r
230 this.slider.setValue (Clazz.floatToInt (this.getCurrentAnnotation ().threshold.value * 1000));\r
231 this.thresholdValue.setText (this.getCurrentAnnotation ().threshold.value + "");\r
232 this.slider.setEnabled (true);\r
233 this.thresholdValue.setEnabled (true);\r
234 this.adjusting = false;\r
235 filterParams.setThresholdType (jalview.viewmodel.annotationfilter.AnnotationFilterParameter.ThresholdType.NO_THRESHOLD);\r
236 if (this.getCurrentAnnotation ().graph != 0) {\r
237 filterParams.setThresholdValue (this.getCurrentAnnotation ().threshold.value);\r
238 if (selectedThresholdItem == 1) {\r
239 filterParams.setThresholdType (jalview.viewmodel.annotationfilter.AnnotationFilterParameter.ThresholdType.ABOVE_THRESHOLD);\r
240 } else if (selectedThresholdItem == 0) {\r
241 filterParams.setThresholdType (jalview.viewmodel.annotationfilter.AnnotationFilterParameter.ThresholdType.BELOW_THRESHOLD);\r
242 }}}if (this.currentStructureFilterPanel != null) {\r
243 if (this.currentStructureFilterPanel.alphaHelix.getState ()) {\r
244 filterParams.setFilterAlphaHelix (true);\r
245 }if (this.currentStructureFilterPanel.betaStrand.getState ()) {\r
246 filterParams.setFilterBetaSheet (true);\r
247 }if (this.currentStructureFilterPanel.turn.getState ()) {\r
248 filterParams.setFilterTurn (true);\r
249 }}if (this.currentSearchPanel != null) {\r
250 if (!this.currentSearchPanel.searchBox.getText ().isEmpty ()) {\r
251 this.currentSearchPanel.description.setEnabled (true);\r
252 this.currentSearchPanel.displayName.setEnabled (true);\r
253 filterParams.setRegexString (this.currentSearchPanel.searchBox.getText ());\r
254 if (this.currentSearchPanel.displayName.getState ()) {\r
255 filterParams.addRegexSearchField (jalview.viewmodel.annotationfilter.AnnotationFilterParameter.SearchableAnnotationField.DISPLAY_STRING);\r
256 }if (this.currentSearchPanel.description.getState ()) {\r
257 filterParams.addRegexSearchField (jalview.viewmodel.annotationfilter.AnnotationFilterParameter.SearchableAnnotationField.DESCRIPTION);\r
258 }} else {\r
259 this.currentSearchPanel.description.setEnabled (false);\r
260 this.currentSearchPanel.displayName.setEnabled (false);\r
261 }}this.av.getColumnSelection ().filterAnnotations (this.getCurrentAnnotation ().annotations, filterParams);\r
262 this.av.showAllHiddenColumns ();\r
263 if (this.getActionOption () == jalview.appletgui.AnnotationColumnChooser.ACTION_OPTION_HIDE) {\r
264 this.av.hideSelectedColumns ();\r
265 }filterParams = null;\r
266 this.av.setAnnotationColumnSelectionState (this);\r
267 this.ap.paintAlignment (true);\r
268 });\r
269 Clazz.defineMethod (c$, "getOldColumnSelection", \r
270 function () {\r
271 return this.oldColumnSelection;\r
272 });\r
273 Clazz.defineMethod (c$, "setOldColumnSelection", \r
274 function (currentColumnSelection) {\r
275 if (currentColumnSelection != null) {\r
276 this.oldColumnSelection =  new jalview.datamodel.ColumnSelection (currentColumnSelection);\r
277 }}, "jalview.datamodel.ColumnSelection");\r
278 Clazz.defineMethod (c$, "getCurrentFutherActionPanel", \r
279 function () {\r
280 return this.currentFurtherActionPanel;\r
281 });\r
282 Clazz.defineMethod (c$, "setCurrentFutherActionPanel", \r
283 function (currentFutherActionPanel) {\r
284 this.currentFurtherActionPanel = currentFutherActionPanel;\r
285 }, "jalview.appletgui.AnnotationColumnChooser.FurtherActionPanel");\r
286 Clazz.defineMethod (c$, "getCurrentSearchPanel", \r
287 function () {\r
288 return this.currentSearchPanel;\r
289 });\r
290 Clazz.defineMethod (c$, "setCurrentSearchPanel", \r
291 function (currentSearchPanel) {\r
292 this.currentSearchPanel = currentSearchPanel;\r
293 }, "jalview.appletgui.AnnotationColumnChooser.SearchPanel");\r
294 Clazz.defineMethod (c$, "getActionOption", \r
295 function () {\r
296 return this.actionOption;\r
297 });\r
298 Clazz.defineMethod (c$, "setActionOption", \r
299 function (actionOption) {\r
300 this.actionOption = actionOption;\r
301 }, "~N");\r
302 Clazz.defineMethod (c$, "getCurrentStructureFilterPanel", \r
303 function () {\r
304 return this.currentStructureFilterPanel;\r
305 });\r
306 Clazz.defineMethod (c$, "setCurrentStructureFilterPanel", \r
307 function (currentStructureFilterPanel) {\r
308 this.currentStructureFilterPanel = currentStructureFilterPanel;\r
309 }, "jalview.appletgui.AnnotationColumnChooser.StructureFilterPanel");\r
310 Clazz.overrideMethod (c$, "itemStateChanged", \r
311 function (e) {\r
312 if (e.getSource () === this.annotations) {\r
313 this.selectedAnnotationChanged ();\r
314 } else if (e.getSource () === this.threshold) {\r
315 this.threshold_actionPerformed (null);\r
316 }}, "java.awt.event.ItemEvent");\r
317 Clazz.defineMethod (c$, "selectedAnnotationChanged", \r
318 function () {\r
319 var currentView = jalview.appletgui.AnnotationColumnChooser.NO_GRAPH_VIEW;\r
320 if (this.av.getAlignment ().getAlignmentAnnotation ()[this.getAnnotations ().getSelectedIndex ()].graph != 0) {\r
321 currentView = jalview.appletgui.AnnotationColumnChooser.GRAPH_VIEW;\r
322 }this.gSearchPanel.syncState ();\r
323 this.gFurtherActionPanel.syncState ();\r
324 this.gStructureFilterPanel.syncState ();\r
325 this.ngSearchPanel.syncState ();\r
326 this.ngFurtherActionPanel.syncState ();\r
327 this.ngStructureFilterPanel.syncState ();\r
328 this.switchableViewsLayout.show (this.switchableViewsPanel, currentView);\r
329 this.updateView ();\r
330 });\r
331 Clazz.overrideMethod (c$, "actionPerformed", \r
332 function (evt) {\r
333 if (evt.getSource () === this.thresholdValue) {\r
334 try {\r
335 var f =  new Float (this.thresholdValue.getText ()).floatValue ();\r
336 this.slider.setValue (Clazz.floatToInt (f * 1000));\r
337 this.adjustmentValueChanged (null);\r
338 } catch (ex) {\r
339 if (Clazz.exceptionOf (ex, NumberFormatException)) {\r
340 } else {\r
341 throw ex;\r
342 }\r
343 }\r
344 } else if (evt.getSource () === this.ok) {\r
345 this.ok_actionPerformed (null);\r
346 } else if (evt.getSource () === this.cancel) {\r
347 this.cancel_actionPerformed (null);\r
348 } else if (evt.getSource () === this.thresholdValue) {\r
349 this.thresholdValue_actionPerformed (null);\r
350 } else {\r
351 this.updateView ();\r
352 }}, "java.awt.event.ActionEvent");\r
353 Clazz.overrideMethod (c$, "mouseClicked", \r
354 function (e) {\r
355 }, "java.awt.event.MouseEvent");\r
356 Clazz.overrideMethod (c$, "mousePressed", \r
357 function (e) {\r
358 if (e.getSource () === this.slider) {\r
359 this.updateView ();\r
360 }}, "java.awt.event.MouseEvent");\r
361 Clazz.overrideMethod (c$, "mouseReleased", \r
362 function (e) {\r
363 if (e.getSource () === this.slider) {\r
364 this.updateView ();\r
365 }}, "java.awt.event.MouseEvent");\r
366 Clazz.overrideMethod (c$, "mouseEntered", \r
367 function (e) {\r
368 if (e.getSource () === this.slider) {\r
369 this.updateView ();\r
370 }}, "java.awt.event.MouseEvent");\r
371 Clazz.overrideMethod (c$, "mouseExited", \r
372 function (e) {\r
373 if (e.getSource () === this.slider) {\r
374 this.updateView ();\r
375 }}, "java.awt.event.MouseEvent");\r
376 c$.$AnnotationColumnChooser$FurtherActionPanel$ = function () {\r
377 Clazz.pu$h(self.c$);\r
378 c$ = Clazz.decorateAsClass (function () {\r
379 Clazz.prepareCallback (this, arguments);\r
380 this.aColChooser = null;\r
381 this.furtherAction = null;\r
382 Clazz.instantialize (this, arguments);\r
383 }, jalview.appletgui.AnnotationColumnChooser, "FurtherActionPanel", awt2swing.Panel, java.awt.event.ItemListener);\r
384 Clazz.prepareFields (c$, function () {\r
385 this.furtherAction =  new awt2swing.Choice ();\r
386 });\r
387 Clazz.makeConstructor (c$, \r
388 function (a) {\r
389 Clazz.superConstructor (this, jalview.appletgui.AnnotationColumnChooser.FurtherActionPanel, []);\r
390 this.aColChooser = a;\r
391 this.furtherAction.addItem ("Select");\r
392 this.furtherAction.addItem ("Hide");\r
393 this.furtherAction.addItemListener (this);\r
394 this.syncState ();\r
395 this.add (this.furtherAction);\r
396 }, "jalview.appletgui.AnnotationColumnChooser");\r
397 Clazz.defineMethod (c$, "syncState", \r
398 function () {\r
399 if (this.aColChooser.getActionOption () == jalview.appletgui.AnnotationColumnChooser.ACTION_OPTION_HIDE) {\r
400 this.furtherAction.select ("Hide");\r
401 } else {\r
402 this.furtherAction.select ("Select");\r
403 }});\r
404 Clazz.overrideMethod (c$, "itemStateChanged", \r
405 function (a) {\r
406 this.aColChooser.setCurrentFutherActionPanel (this);\r
407 if (this.furtherAction.getSelectedItem ().toString ().equalsIgnoreCase ("Select")) {\r
408 this.b$["jalview.appletgui.AnnotationColumnChooser"].setActionOption (1);\r
409 this.b$["jalview.appletgui.AnnotationColumnChooser"].updateView ();\r
410 } else {\r
411 this.b$["jalview.appletgui.AnnotationColumnChooser"].setActionOption (jalview.appletgui.AnnotationColumnChooser.ACTION_OPTION_HIDE);\r
412 this.b$["jalview.appletgui.AnnotationColumnChooser"].updateView ();\r
413 }}, "java.awt.event.ItemEvent");\r
414 c$ = Clazz.p0p ();\r
415 };\r
416 c$.$AnnotationColumnChooser$StructureFilterPanel$ = function () {\r
417 Clazz.pu$h(self.c$);\r
418 c$ = Clazz.decorateAsClass (function () {\r
419 Clazz.prepareCallback (this, arguments);\r
420 this.aColChooser = null;\r
421 this.alphaHelix = null;\r
422 this.betaStrand = null;\r
423 this.turn = null;\r
424 this.all = null;\r
425 Clazz.instantialize (this, arguments);\r
426 }, jalview.appletgui.AnnotationColumnChooser, "StructureFilterPanel", jalview.appletgui.TitledPanel, java.awt.event.ItemListener);\r
427 Clazz.prepareFields (c$, function () {\r
428 this.alphaHelix =  new awt2swing.Checkbox ();\r
429 this.betaStrand =  new awt2swing.Checkbox ();\r
430 this.turn =  new awt2swing.Checkbox ();\r
431 this.all =  new awt2swing.Checkbox ();\r
432 });\r
433 Clazz.makeConstructor (c$, \r
434 function (a) {\r
435 Clazz.superConstructor (this, jalview.appletgui.AnnotationColumnChooser.StructureFilterPanel, []);\r
436 this.aColChooser = a;\r
437 this.alphaHelix.setLabel (jalview.util.MessageManager.getString ("label.alpha_helix"));\r
438 this.alphaHelix.setBackground (java.awt.Color.white);\r
439 this.alphaHelix.addItemListener (this);\r
440 this.betaStrand.setLabel (jalview.util.MessageManager.getString ("label.beta_strand"));\r
441 this.betaStrand.setBackground (java.awt.Color.white);\r
442 this.betaStrand.addItemListener (this);\r
443 this.turn.setLabel (jalview.util.MessageManager.getString ("label.turn"));\r
444 this.turn.setBackground (java.awt.Color.white);\r
445 this.turn.addItemListener (this);\r
446 this.all.setLabel (jalview.util.MessageManager.getString ("label.select_all"));\r
447 this.all.setBackground (java.awt.Color.white);\r
448 this.all.addItemListener (this);\r
449 this.setBackground (java.awt.Color.white);\r
450 this.setTitle ("Structure Filter");\r
451 this.add (this.all);\r
452 this.add (this.alphaHelix);\r
453 this.add (this.betaStrand);\r
454 this.add (this.turn);\r
455 }, "jalview.appletgui.AnnotationColumnChooser");\r
456 Clazz.defineMethod (c$, "alphaHelix_actionPerformed", \r
457 function () {\r
458 this.updateSelectAllState ();\r
459 this.aColChooser.setCurrentStructureFilterPanel (this);\r
460 this.aColChooser.updateView ();\r
461 });\r
462 Clazz.defineMethod (c$, "betaStrand_actionPerformed", \r
463 function () {\r
464 this.updateSelectAllState ();\r
465 this.aColChooser.setCurrentStructureFilterPanel (this);\r
466 this.aColChooser.updateView ();\r
467 });\r
468 Clazz.defineMethod (c$, "turn_actionPerformed", \r
469 function () {\r
470 this.updateSelectAllState ();\r
471 this.aColChooser.setCurrentStructureFilterPanel (this);\r
472 this.aColChooser.updateView ();\r
473 });\r
474 Clazz.defineMethod (c$, "all_actionPerformed", \r
475 function () {\r
476 if (this.all.getState ()) {\r
477 this.alphaHelix.setState (true);\r
478 this.betaStrand.setState (true);\r
479 this.turn.setState (true);\r
480 } else {\r
481 this.alphaHelix.setState (false);\r
482 this.betaStrand.setState (false);\r
483 this.turn.setState (false);\r
484 }this.aColChooser.setCurrentStructureFilterPanel (this);\r
485 this.aColChooser.updateView ();\r
486 });\r
487 Clazz.defineMethod (c$, "updateSelectAllState", \r
488 function () {\r
489 if (this.alphaHelix.getState () && this.betaStrand.getState () && this.turn.getState ()) {\r
490 this.all.setState (true);\r
491 } else {\r
492 this.all.setState (false);\r
493 }});\r
494 Clazz.defineMethod (c$, "syncState", \r
495 function () {\r
496 var a = this.aColChooser.getCurrentStructureFilterPanel ();\r
497 if (a != null) {\r
498 this.alphaHelix.setState (a.alphaHelix.getState ());\r
499 this.betaStrand.setState (a.betaStrand.getState ());\r
500 this.turn.setState (a.turn.getState ());\r
501 if (a.all.getState ()) {\r
502 this.all.setState (true);\r
503 this.alphaHelix.setState (true);\r
504 this.betaStrand.setState (true);\r
505 this.turn.setState (true);\r
506 }}});\r
507 Clazz.overrideMethod (c$, "itemStateChanged", \r
508 function (a) {\r
509 if (a.getSource () === this.alphaHelix) {\r
510 this.alphaHelix_actionPerformed ();\r
511 } else if (a.getSource () === this.betaStrand) {\r
512 this.betaStrand_actionPerformed ();\r
513 } else if (a.getSource () === this.turn) {\r
514 this.turn_actionPerformed ();\r
515 } else if (a.getSource () === this.all) {\r
516 this.all_actionPerformed ();\r
517 }}, "java.awt.event.ItemEvent");\r
518 c$ = Clazz.p0p ();\r
519 };\r
520 c$.$AnnotationColumnChooser$SearchPanel$ = function () {\r
521 Clazz.pu$h(self.c$);\r
522 c$ = Clazz.decorateAsClass (function () {\r
523 Clazz.prepareCallback (this, arguments);\r
524 this.aColChooser = null;\r
525 this.displayName = null;\r
526 this.description = null;\r
527 this.searchBox = null;\r
528 Clazz.instantialize (this, arguments);\r
529 }, jalview.appletgui.AnnotationColumnChooser, "SearchPanel", jalview.appletgui.TitledPanel, java.awt.event.ItemListener);\r
530 Clazz.prepareFields (c$, function () {\r
531 this.displayName =  new awt2swing.Checkbox ();\r
532 this.description =  new awt2swing.Checkbox ();\r
533 this.searchBox =  new awt2swing.TextField (10);\r
534 });\r
535 Clazz.makeConstructor (c$, \r
536 function (a) {\r
537 Clazz.superConstructor (this, jalview.appletgui.AnnotationColumnChooser.SearchPanel, []);\r
538 this.aColChooser = a;\r
539 this.searchBox.addTextListener (((Clazz.isClassDefined ("jalview.appletgui.AnnotationColumnChooser$SearchPanel$1") ? 0 : jalview.appletgui.AnnotationColumnChooser.SearchPanel.$AnnotationColumnChooser$SearchPanel$1$ ()), Clazz.innerTypeInstance (jalview.appletgui.AnnotationColumnChooser$SearchPanel$1, this, null)));\r
540 this.displayName.setLabel (jalview.util.MessageManager.getString ("label.display_name"));\r
541 this.displayName.setEnabled (false);\r
542 this.displayName.addItemListener (this);\r
543 this.description.setLabel (jalview.util.MessageManager.getString ("label.description"));\r
544 this.description.setEnabled (false);\r
545 this.description.addItemListener (this);\r
546 this.setTitle ("Search Filter");\r
547 this.syncState ();\r
548 this.add (this.searchBox);\r
549 this.add (this.displayName);\r
550 this.add (this.description);\r
551 }, "jalview.appletgui.AnnotationColumnChooser");\r
552 Clazz.defineMethod (c$, "displayNameCheckboxAction", \r
553 function () {\r
554 this.aColChooser.setCurrentSearchPanel (this);\r
555 this.aColChooser.updateView ();\r
556 });\r
557 Clazz.defineMethod (c$, "discriptionCheckboxAction", \r
558 function () {\r
559 this.aColChooser.setCurrentSearchPanel (this);\r
560 this.aColChooser.updateView ();\r
561 });\r
562 Clazz.defineMethod (c$, "searchStringAction", \r
563 function () {\r
564 this.aColChooser.setCurrentSearchPanel (this);\r
565 this.aColChooser.updateView ();\r
566 });\r
567 Clazz.defineMethod (c$, "syncState", \r
568 function () {\r
569 var a = this.aColChooser.getCurrentSearchPanel ();\r
570 if (a != null) {\r
571 this.description.setEnabled (a.description.isEnabled ());\r
572 this.description.setState (a.description.getState ());\r
573 this.displayName.setEnabled (a.displayName.isEnabled ());\r
574 this.displayName.setState (a.displayName.getState ());\r
575 this.searchBox.setText (a.searchBox.getText ());\r
576 }});\r
577 Clazz.overrideMethod (c$, "itemStateChanged", \r
578 function (a) {\r
579 if (a.getSource () === this.displayName) {\r
580 this.displayNameCheckboxAction ();\r
581 } else if (a.getSource () === this.description) {\r
582 this.discriptionCheckboxAction ();\r
583 }}, "java.awt.event.ItemEvent");\r
584 c$.$AnnotationColumnChooser$SearchPanel$1$ = function () {\r
585 Clazz.pu$h(self.c$);\r
586 c$ = Clazz.declareAnonymous (jalview.appletgui, "AnnotationColumnChooser$SearchPanel$1", null, java.awt.event.TextListener);\r
587 Clazz.overrideMethod (c$, "textValueChanged", \r
588 function (a) {\r
589 this.b$["jalview.appletgui.AnnotationColumnChooser.SearchPanel"].searchStringAction ();\r
590 }, "java.awt.event.TextEvent");\r
591 c$ = Clazz.p0p ();\r
592 };\r
593 c$ = Clazz.p0p ();\r
594 };\r
595 c$.$AnnotationColumnChooser$1$ = function () {\r
596 Clazz.pu$h(self.c$);\r
597 c$ = Clazz.declareAnonymous (jalview.appletgui, "AnnotationColumnChooser$1", java.awt.event.MouseAdapter);\r
598 Clazz.defineMethod (c$, "mousePressed", \r
599 function (e) {\r
600 this.b$["jalview.appletgui.AnnotationColumnChooser"].sliderDragging = true;\r
601 Clazz.superCall (this, jalview.appletgui.AnnotationColumnChooser$1, "mousePressed", [e]);\r
602 }, "java.awt.event.MouseEvent");\r
603 Clazz.defineMethod (c$, "mouseDragged", \r
604 function (e) {\r
605 this.b$["jalview.appletgui.AnnotationColumnChooser"].sliderDragging = true;\r
606 Clazz.superCall (this, jalview.appletgui.AnnotationColumnChooser$1, "mouseDragged", [e]);\r
607 }, "java.awt.event.MouseEvent");\r
608 Clazz.overrideMethod (c$, "mouseReleased", \r
609 function (evt) {\r
610 if (this.b$["jalview.appletgui.AnnotationColumnChooser"].sliderDragging) {\r
611 this.b$["jalview.appletgui.AnnotationColumnChooser"].sliderDragging = false;\r
612 this.b$["jalview.appletgui.AnnotationColumnChooser"].valueChanged (true);\r
613 }this.b$["jalview.appletgui.AnnotationColumnChooser"].ap.paintAlignment (true);\r
614 }, "java.awt.event.MouseEvent");\r
615 c$ = Clazz.p0p ();\r
616 };\r
617 Clazz.defineStatics (c$,\r
618 "ACTION_OPTION_SELECT", 1,\r
619 "ACTION_OPTION_HIDE", 2,\r
620 "NO_GRAPH_VIEW", "0",\r
621 "GRAPH_VIEW", "1");\r
622 });\r