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