1 Clazz.declarePackage ("jalview.appletgui");
2 Clazz.load (["awt2swing.Panel", "java.awt.event.ActionListener", "$.AdjustmentListener", "$.MouseListener", "awt2swing.Button", "$.Checkbox", "$.Label", "$.Scrollbar", "$.TextField", "java.awt.BorderLayout", "$.FlowLayout"], "jalview.appletgui.SliderPanel", ["awt2swing.Frame", "jalview.bin.JalviewLite", "jalview.util.MessageManager", "java.awt.Color", "$.Font", "java.awt.event.WindowAdapter"], function () {
3 c$ = Clazz.decorateAsClass (function () {
5 this.forConservation = true;
8 this.valueField = null;
12 this.applyButton = null;
13 this.undoButton = null;
14 this.flowLayout1 = null;
15 this.allGroupsCheck = null;
16 this.borderLayout1 = null;
17 this.borderLayout2 = null;
18 this.flowLayout2 = null;
19 Clazz.instantialize (this, arguments);
20 }, jalview.appletgui, "SliderPanel", awt2swing.Panel, [java.awt.event.ActionListener, java.awt.event.AdjustmentListener, java.awt.event.MouseListener]);
21 Clazz.prepareFields (c$, function () {
22 this.slider = new awt2swing.Scrollbar ();
23 this.valueField = new awt2swing.TextField ();
24 this.label = new awt2swing.Label ();
25 this.jPanel1 = new awt2swing.Panel ();
26 this.jPanel2 = new awt2swing.Panel ();
27 this.applyButton = new awt2swing.Button ();
28 this.undoButton = new awt2swing.Button ();
29 this.flowLayout1 = new java.awt.FlowLayout ();
30 this.allGroupsCheck = new awt2swing.Checkbox ();
31 this.borderLayout1 = new java.awt.BorderLayout ();
32 this.borderLayout2 = new java.awt.BorderLayout ();
33 this.flowLayout2 = new java.awt.FlowLayout ();
35 c$.setConservationSlider = Clazz.defineMethod (c$, "setConservationSlider",
36 function (ap, cs, source) {
38 if (jalview.appletgui.SliderPanel.conservationSlider == null) {
39 sp = new jalview.appletgui.SliderPanel (ap, cs.getConservationInc (), true, cs);
40 jalview.appletgui.SliderPanel.conservationSlider = new awt2swing.Frame ();
41 jalview.appletgui.SliderPanel.conservationSlider.add (sp);
43 sp = jalview.appletgui.SliderPanel.conservationSlider.getComponent (0);
45 }jalview.appletgui.SliderPanel.conservationSlider.setTitle (jalview.util.MessageManager.formatMessage ("label.conservation_colour_increment", Clazz.newArray (-1, [source])));
46 if (ap.av.getAlignment ().getGroups () != null) {
47 sp.setAllGroupsCheckEnabled (true);
49 sp.setAllGroupsCheckEnabled (false);
50 }return sp.getValue ();
51 }, "jalview.appletgui.AlignmentPanel,jalview.schemes.ColourSchemeI,~S");
52 c$.showConservationSlider = Clazz.defineMethod (c$, "showConservationSlider",
55 jalview.appletgui.SliderPanel.PIDSlider.setVisible (false);
56 jalview.appletgui.SliderPanel.PIDSlider = null;
58 if (Clazz.exceptionOf (ex, Exception)) {
63 if (!jalview.appletgui.SliderPanel.conservationSlider.isVisible ()) {
64 jalview.bin.JalviewLite.addFrame (jalview.appletgui.SliderPanel.conservationSlider, jalview.appletgui.SliderPanel.conservationSlider.getTitle (), 420, 100);
65 jalview.appletgui.SliderPanel.conservationSlider.addWindowListener (((Clazz.isClassDefined ("jalview.appletgui.SliderPanel$1") ? 0 : jalview.appletgui.SliderPanel.$SliderPanel$1$ ()), Clazz.innerTypeInstance (jalview.appletgui.SliderPanel$1, this, null)));
67 c$.setPIDSliderSource = Clazz.defineMethod (c$, "setPIDSliderSource",
68 function (ap, cs, source) {
70 if (jalview.appletgui.SliderPanel.PIDSlider == null) {
71 pid = new jalview.appletgui.SliderPanel (ap, 50, false, cs);
72 jalview.appletgui.SliderPanel.PIDSlider = new awt2swing.Frame ();
73 jalview.appletgui.SliderPanel.PIDSlider.add (pid);
75 pid = jalview.appletgui.SliderPanel.PIDSlider.getComponent (0);
77 }jalview.appletgui.SliderPanel.PIDSlider.setTitle (jalview.util.MessageManager.formatMessage ("label.percentage_identity_thereshold", Clazz.newArray (-1, [source])));
78 if (ap.av.getAlignment ().getGroups () != null) {
79 pid.setAllGroupsCheckEnabled (true);
81 pid.setAllGroupsCheckEnabled (false);
82 }return pid.getValue ();
83 }, "jalview.appletgui.AlignmentPanel,jalview.schemes.ColourSchemeI,~S");
84 c$.showPIDSlider = Clazz.defineMethod (c$, "showPIDSlider",
87 jalview.appletgui.SliderPanel.conservationSlider.setVisible (false);
88 jalview.appletgui.SliderPanel.conservationSlider = null;
90 if (Clazz.exceptionOf (ex, Exception)) {
95 if (!jalview.appletgui.SliderPanel.PIDSlider.isVisible ()) {
96 jalview.bin.JalviewLite.addFrame (jalview.appletgui.SliderPanel.PIDSlider, jalview.appletgui.SliderPanel.PIDSlider.getTitle (), 420, 100);
97 jalview.appletgui.SliderPanel.PIDSlider.addWindowListener (((Clazz.isClassDefined ("jalview.appletgui.SliderPanel$2") ? 0 : jalview.appletgui.SliderPanel.$SliderPanel$2$ ()), Clazz.innerTypeInstance (jalview.appletgui.SliderPanel$2, this, null)));
99 Clazz.makeConstructor (c$,
100 function (ap, value, forConserve, cs) {
101 Clazz.superConstructor (this, jalview.appletgui.SliderPanel, []);
105 if (Clazz.exceptionOf (e, Exception)) {
106 e.printStackTrace ();
113 this.forConservation = forConserve;
114 this.undoButton.setVisible (false);
115 this.applyButton.setVisible (false);
116 if (this.forConservation) {
117 this.label.setText (jalview.util.MessageManager.getString ("label.modify_conservation_visibility"));
118 this.slider.setMinimum (0);
119 this.slider.setMaximum (50 + this.slider.getVisibleAmount ());
120 this.slider.setUnitIncrement (1);
122 this.label.setText (jalview.util.MessageManager.getString ("label.colour_residues_above_occurence"));
123 this.slider.setMinimum (0);
124 this.slider.setMaximum (100 + this.slider.getVisibleAmount ());
125 this.slider.setBlockIncrement (1);
126 }this.slider.addAdjustmentListener (this);
127 this.slider.addMouseListener (this);
128 this.slider.setValue (value);
129 this.valueField.setText (value + "");
130 }, "jalview.appletgui.AlignmentPanel,~N,~B,jalview.schemes.ColourSchemeI");
131 Clazz.defineMethod (c$, "valueChanged",
133 if (this.cs == null) {
135 }var toChange = this.cs;
136 var allGroups = null;
137 if (this.allGroupsCheck.getState ()) {
138 allGroups = this.ap.av.getAlignment ().getGroups ().listIterator ();
139 }while (toChange != null) {
140 if (this.forConservation) {
141 toChange.setConservationInc (i);
143 toChange.setThreshold (i, this.ap.av.isIgnoreGapsConsensus ());
144 }if (allGroups != null && allGroups.hasNext ()) {
145 while ((toChange = allGroups.next ().cs) == null && allGroups.hasNext ()) {
150 this.ap.seqPanel.seqCanvas.repaint ();
152 Clazz.defineMethod (c$, "setAllGroupsCheckEnabled",
154 this.allGroupsCheck.setEnabled (b);
156 Clazz.overrideMethod (c$, "actionPerformed",
158 if (evt.getSource () === this.applyButton) {
159 this.applyButton_actionPerformed ();
160 } else if (evt.getSource () === this.undoButton) {
161 this.undoButton_actionPerformed ();
162 } else if (evt.getSource () === this.valueField) {
163 this.valueField_actionPerformed ();
164 }}, "java.awt.event.ActionEvent");
165 Clazz.overrideMethod (c$, "adjustmentValueChanged",
167 this.valueField.setText (this.slider.getValue () + "");
168 this.valueChanged (this.slider.getValue ());
169 }, "java.awt.event.AdjustmentEvent");
170 Clazz.defineMethod (c$, "valueField_actionPerformed",
173 var i = Integer.parseInt (this.valueField.getText ());
174 this.slider.setValue (i);
176 if (Clazz.exceptionOf (ex, Exception)) {
177 this.valueField.setText (this.slider.getValue () + "");
183 Clazz.defineMethod (c$, "setValue",
185 this.slider.setValue (value);
187 Clazz.defineMethod (c$, "getValue",
189 return Integer.parseInt (this.valueField.getText ());
191 Clazz.defineMethod (c$, "jbInit",
193 this.setLayout (this.borderLayout2);
194 this.slider.setBackground (java.awt.Color.white);
195 this.slider.setFont ( new java.awt.Font ("Verdana", 0, 11));
196 this.slider.setOrientation (0);
197 this.valueField.setFont ( new java.awt.Font ("Verdana", 0, 11));
198 this.valueField.setText (" ");
199 this.valueField.addActionListener (this);
200 this.valueField.setColumns (3);
201 this.label.setFont ( new java.awt.Font ("Verdana", 0, 11));
202 this.label.setText (jalview.util.MessageManager.getString ("label.set_this_label_text"));
203 this.jPanel1.setLayout (this.borderLayout1);
204 this.jPanel2.setLayout (this.flowLayout1);
205 this.applyButton.setFont ( new java.awt.Font ("Verdana", 0, 11));
206 this.applyButton.setLabel (jalview.util.MessageManager.getString ("action.apply"));
207 this.applyButton.addActionListener (this);
208 this.undoButton.setEnabled (false);
209 this.undoButton.setFont ( new java.awt.Font ("Verdana", 0, 11));
210 this.undoButton.setLabel (jalview.util.MessageManager.getString ("action.undo"));
211 this.undoButton.addActionListener (this);
212 this.allGroupsCheck.setEnabled (false);
213 this.allGroupsCheck.setFont ( new java.awt.Font ("Verdana", 0, 11));
214 this.allGroupsCheck.setLabel (jalview.util.MessageManager.getString ("action.apply_threshold_all_groups"));
215 this.allGroupsCheck.setName (jalview.util.MessageManager.getString ("action.apply_all_groups"));
216 this.setBackground (java.awt.Color.white);
217 this.setForeground (java.awt.Color.black);
218 this.jPanel2.add (this.label, null);
219 this.jPanel2.add (this.applyButton, null);
220 this.jPanel2.add (this.undoButton, null);
221 this.jPanel2.add (this.allGroupsCheck);
222 this.jPanel1.add (this.valueField, "East");
223 this.jPanel1.add (this.slider, "Center");
224 this.add (this.jPanel1, "South");
225 this.add (this.jPanel2, "Center");
227 Clazz.defineMethod (c$, "applyButton_actionPerformed",
230 Clazz.defineMethod (c$, "undoButton_actionPerformed",
233 Clazz.overrideMethod (c$, "mousePressed",
235 }, "java.awt.event.MouseEvent");
236 Clazz.overrideMethod (c$, "mouseReleased",
238 this.ap.paintAlignment (true);
239 }, "java.awt.event.MouseEvent");
240 Clazz.overrideMethod (c$, "mouseClicked",
242 }, "java.awt.event.MouseEvent");
243 Clazz.overrideMethod (c$, "mouseEntered",
245 }, "java.awt.event.MouseEvent");
246 Clazz.overrideMethod (c$, "mouseExited",
248 }, "java.awt.event.MouseEvent");
249 c$.$SliderPanel$1$ = function () {
251 c$ = Clazz.declareAnonymous (jalview.appletgui, "SliderPanel$1", java.awt.event.WindowAdapter);
252 Clazz.overrideMethod (c$, "windowClosing",
254 jalview.appletgui.SliderPanel.conservationSlider = null;
255 }, "java.awt.event.WindowEvent");
258 c$.$SliderPanel$2$ = function () {
260 c$ = Clazz.declareAnonymous (jalview.appletgui, "SliderPanel$2", java.awt.event.WindowAdapter);
261 Clazz.overrideMethod (c$, "windowClosing",
263 jalview.appletgui.SliderPanel.PIDSlider = null;
264 }, "java.awt.event.WindowEvent");
267 Clazz.defineStatics (c$,
268 "conservationSlider", null,