JAL-3253 preliminary static fixes for JavaScript
[jalview.git] / src / jalview / jbgui / GAlignFrame.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3  * Copyright (C) $$Year-Rel$$ The Jalview Authors
4  * 
5  * This file is part of Jalview.
6  * 
7  * Jalview is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License 
9  * as published by the Free Software Foundation, either version 3
10  * of the License, or (at your option) any later version.
11  *  
12  * Jalview is distributed in the hope that it will be useful, but 
13  * WITHOUT ANY WARRANTY; without even the implied warranty 
14  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15  * PURPOSE.  See the GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
19  * The Jalview Authors are detailed in the 'AUTHORS' file.
20  */
21 package jalview.jbgui;
22
23 import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
24 import jalview.analysis.GeneticCodeI;
25 import jalview.analysis.GeneticCodes;
26 import jalview.api.SplitContainerI;
27 import jalview.bin.Cache;
28 import jalview.gui.JvSwingUtils;
29 import jalview.gui.Preferences;
30 import jalview.io.FileFormats;
31 import jalview.schemes.ResidueColourScheme;
32 import jalview.util.MessageManager;
33 import jalview.util.Platform;
34
35 import java.awt.BorderLayout;
36 import java.awt.Color;
37 import java.awt.GridLayout;
38 import java.awt.Toolkit;
39 import java.awt.event.ActionEvent;
40 import java.awt.event.ActionListener;
41 import java.awt.event.FocusAdapter;
42 import java.awt.event.FocusEvent;
43 import java.awt.event.KeyEvent;
44 import java.awt.event.MouseAdapter;
45 import java.awt.event.MouseEvent;
46 import java.util.HashMap;
47 import java.util.Map;
48
49 import javax.swing.BorderFactory;
50 import javax.swing.ButtonGroup;
51 import javax.swing.JCheckBoxMenuItem;
52 import javax.swing.JInternalFrame;
53 import javax.swing.JLabel;
54 import javax.swing.JMenu;
55 import javax.swing.JMenuBar;
56 import javax.swing.JMenuItem;
57 import javax.swing.JPanel;
58 import javax.swing.JRadioButtonMenuItem;
59 import javax.swing.JTabbedPane;
60 import javax.swing.KeyStroke;
61 import javax.swing.event.ChangeEvent;
62 import javax.swing.event.MenuEvent;
63 import javax.swing.event.MenuListener;
64
65 @SuppressWarnings("serial")
66 public class GAlignFrame extends JInternalFrame
67 {
68   protected JMenuBar alignFrameMenuBar = new JMenuBar();
69
70   protected JMenuItem closeMenuItem = new JMenuItem();
71
72   public JMenu webService = new JMenu();// BH 2019 was protected, but not
73                                         // sufficient for AlignFrame thread run
74
75   public JMenuItem webServiceNoServices;// BH 2019 was protected, but not
76                                         // sufficient for AlignFrame thread run
77
78   protected JCheckBoxMenuItem viewBoxesMenuItem = new JCheckBoxMenuItem();
79
80   protected JCheckBoxMenuItem viewTextMenuItem = new JCheckBoxMenuItem();
81
82   protected JMenu sortByAnnotScore = new JMenu();
83
84   public JLabel statusBar = new JLabel(); // BH 2019 was protected, but not
85                                           // sufficient for
86                                           // AlignFrame.printWriter
87
88   protected JMenu outputTextboxMenu = new JMenu();
89
90   protected JCheckBoxMenuItem annotationPanelMenuItem = new JCheckBoxMenuItem();
91
92   protected JCheckBoxMenuItem colourTextMenuItem = new JCheckBoxMenuItem();
93
94   protected JCheckBoxMenuItem showNonconservedMenuItem = new JCheckBoxMenuItem();
95
96   protected JMenuItem undoMenuItem = new JMenuItem();
97
98   protected JMenuItem redoMenuItem = new JMenuItem();
99
100   protected JCheckBoxMenuItem wrapMenuItem = new JCheckBoxMenuItem();
101
102   protected JCheckBoxMenuItem renderGapsMenuItem = new JCheckBoxMenuItem();
103
104   public JCheckBoxMenuItem showSeqFeatures = new JCheckBoxMenuItem();
105
106   JMenuItem copy = new JMenuItem();
107
108   JMenuItem cut = new JMenuItem();
109
110   JMenu pasteMenu = new JMenu();
111
112   protected JCheckBoxMenuItem seqLimits = new JCheckBoxMenuItem();
113
114   protected JCheckBoxMenuItem scaleAbove = new JCheckBoxMenuItem();
115
116   protected JCheckBoxMenuItem scaleLeft = new JCheckBoxMenuItem();
117
118   protected JCheckBoxMenuItem scaleRight = new JCheckBoxMenuItem();
119
120   protected JCheckBoxMenuItem applyToAllGroups;
121
122   protected JMenu colourMenu = new JMenu();
123
124   protected JMenuItem textColour;
125
126   protected JCheckBoxMenuItem conservationMenuItem;
127
128   protected JMenuItem modifyConservation;
129
130   protected JCheckBoxMenuItem abovePIDThreshold;
131
132   protected JMenuItem modifyPID;
133
134   protected JRadioButtonMenuItem annotationColour;
135
136   protected JMenu sortByTreeMenu = new JMenu();
137
138   protected JMenu sort = new JMenu();
139
140   protected JMenuItem calculateTree = new JMenuItem();
141
142   protected JCheckBoxMenuItem padGapsMenuitem = new JCheckBoxMenuItem();
143
144   protected JCheckBoxMenuItem showNpFeatsMenuitem = new JCheckBoxMenuItem();
145
146   protected JCheckBoxMenuItem showDbRefsMenuitem = new JCheckBoxMenuItem();
147
148   protected JMenu showTranslation = new JMenu();
149
150   protected JMenuItem showReverse = new JMenuItem();
151
152   protected JMenuItem showReverseComplement = new JMenuItem();
153
154   protected JMenu showProducts = new JMenu();
155
156   protected JMenuItem runGroovy = new JMenuItem();
157
158   protected JMenuItem loadVcf;
159
160   protected JCheckBoxMenuItem autoCalculate = new JCheckBoxMenuItem();
161
162   protected JCheckBoxMenuItem sortByTree = new JCheckBoxMenuItem();
163
164   protected JCheckBoxMenuItem listenToViewSelections = new JCheckBoxMenuItem();
165
166   protected JPanel statusPanel = new JPanel();
167
168   protected JMenuItem showAllSeqAnnotations = new JMenuItem();
169
170   protected JMenuItem hideAllSeqAnnotations = new JMenuItem();
171
172   protected JMenuItem showAllAlAnnotations = new JMenuItem();
173
174   protected JMenuItem hideAllAlAnnotations = new JMenuItem();
175
176   protected JCheckBoxMenuItem showComplementMenuItem = new JCheckBoxMenuItem();
177
178   protected JCheckBoxMenuItem hiddenMarkers = new JCheckBoxMenuItem();
179
180   protected JTabbedPane tabbedPane = new JTabbedPane();
181
182   protected JMenuItem reload = new JMenuItem();
183
184   protected JMenu formatMenu = new JMenu();
185
186   protected JCheckBoxMenuItem idRightAlign = new JCheckBoxMenuItem();
187
188   protected JCheckBoxMenuItem centreColumnLabelsMenuItem = new JCheckBoxMenuItem();
189
190   protected JCheckBoxMenuItem followHighlightMenuItem = new JCheckBoxMenuItem();
191
192   protected JMenuItem gatherViews = new JMenuItem();
193
194   protected JMenuItem expandViews = new JMenuItem();
195
196   protected JCheckBoxMenuItem showGroupConsensus = new JCheckBoxMenuItem();
197
198   protected JCheckBoxMenuItem showGroupConservation = new JCheckBoxMenuItem();
199
200   protected JCheckBoxMenuItem showConsensusHistogram = new JCheckBoxMenuItem();
201
202   protected JCheckBoxMenuItem showSequenceLogo = new JCheckBoxMenuItem();
203
204   protected JCheckBoxMenuItem normaliseSequenceLogo = new JCheckBoxMenuItem();
205
206   protected JCheckBoxMenuItem applyAutoAnnotationSettings = new JCheckBoxMenuItem();
207
208   protected JMenuItem openFeatureSettings;
209
210   private SequenceAnnotationOrder annotationSortOrder;
211
212   private boolean showAutoCalculatedAbove = false;
213
214   private Map<KeyStroke, JMenuItem> accelerators = new HashMap<>();
215
216   private SplitContainerI splitFrame;
217
218   public GAlignFrame()
219   {
220     try
221     {
222
223       // for Web-page embedding using id=align-frame-div
224       setName("jalview-alignment");
225
226       jbInit();
227       setJMenuBar(alignFrameMenuBar);
228
229       // dynamically fill save as menu with available formats
230       for (String ff : FileFormats.getInstance().getWritableFormats(true))
231       {
232         JMenuItem item = new JMenuItem(ff);
233
234         item.addActionListener(new ActionListener()
235         {
236           @Override
237           public void actionPerformed(ActionEvent e)
238           {
239             outputText_actionPerformed(e.getActionCommand());
240           }
241         });
242
243         outputTextboxMenu.add(item);
244       }
245     } catch (Exception e)
246     {
247       System.err.println(e.toString());
248     }
249
250     if (Platform.allowMnemonics()) // was "not mac and not JS"
251     {
252       closeMenuItem.setMnemonic('C');
253       outputTextboxMenu.setMnemonic('T');
254       undoMenuItem.setMnemonic('Z');
255       redoMenuItem.setMnemonic('0');
256       copy.setMnemonic('C');
257       cut.setMnemonic('U');
258       pasteMenu.setMnemonic('P');
259       reload.setMnemonic('R');
260     }
261   }
262
263   private void jbInit() throws Exception
264   {
265     initColourMenu();
266
267     JMenuItem saveAs = new JMenuItem(
268             MessageManager.getString("action.save_as"));
269     ActionListener al = new ActionListener()
270     {
271       @Override
272       public void actionPerformed(ActionEvent e)
273       {
274         saveAs_actionPerformed();
275       }
276     };
277
278     // FIXME getDefaultToolkit throws an exception in Headless mode
279     KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_S,
280             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()
281                     | KeyEvent.SHIFT_MASK,
282             false);
283     addMenuActionAndAccelerator(keyStroke, saveAs, al);
284
285     closeMenuItem.setText(MessageManager.getString("action.close"));
286     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_W,
287             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
288     al = new ActionListener()
289     {
290       @Override
291       public void actionPerformed(ActionEvent e)
292       {
293         closeMenuItem_actionPerformed(false);
294       }
295     };
296     addMenuActionAndAccelerator(keyStroke, closeMenuItem, al);
297
298     JMenu editMenu = new JMenu(MessageManager.getString("action.edit"));
299     JMenu viewMenu = new JMenu(MessageManager.getString("action.view"));
300     JMenu annotationsMenu = new JMenu(
301             MessageManager.getString("action.annotations"));
302     JMenu showMenu = new JMenu(MessageManager.getString("action.show"));
303     colourMenu.setText(MessageManager.getString("action.colour"));
304     JMenu calculateMenu = new JMenu(
305             MessageManager.getString("action.calculate"));
306     webService.setText(MessageManager.getString("action.web_service"));
307     JMenuItem selectAllSequenceMenuItem = new JMenuItem(
308             MessageManager.getString("action.select_all"));
309     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_A,
310             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
311     al = new ActionListener()
312     {
313       @Override
314       public void actionPerformed(ActionEvent e)
315       {
316         selectAllSequenceMenuItem_actionPerformed(e);
317       }
318     };
319     addMenuActionAndAccelerator(keyStroke, selectAllSequenceMenuItem, al);
320
321     JMenuItem deselectAllSequenceMenuItem = new JMenuItem(
322             MessageManager.getString("action.deselect_all"));
323     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false);
324     al = new ActionListener()
325     {
326       @Override
327       public void actionPerformed(ActionEvent e)
328       {
329         deselectAllSequenceMenuItem_actionPerformed(e);
330       }
331     };
332     addMenuActionAndAccelerator(keyStroke, deselectAllSequenceMenuItem, al);
333
334     JMenuItem invertSequenceMenuItem = new JMenuItem(
335             MessageManager.getString("action.invert_sequence_selection"));
336     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_I,
337             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
338     al = new ActionListener()
339     {
340       @Override
341       public void actionPerformed(ActionEvent e)
342       {
343         invertSequenceMenuItem_actionPerformed(e);
344       }
345     };
346     addMenuActionAndAccelerator(keyStroke, invertSequenceMenuItem, al);
347
348     JMenuItem grpsFromSelection = new JMenuItem(
349             MessageManager.getString("action.make_groups_selection"));
350     grpsFromSelection.addActionListener(new ActionListener()
351     {
352       @Override
353       public void actionPerformed(ActionEvent e)
354       {
355         makeGrpsFromSelection_actionPerformed(e);
356       }
357     });
358     JMenuItem expandAlignment = new JMenuItem(
359             MessageManager.getString("action.view_flanking_regions"));
360     expandAlignment.setToolTipText(
361             MessageManager.getString("label.view_flanking_regions"));
362     expandAlignment.addActionListener(new ActionListener()
363     {
364       @Override
365       public void actionPerformed(ActionEvent e)
366       {
367         expand_newalign(e);
368       }
369     });
370     JMenuItem remove2LeftMenuItem = new JMenuItem(
371             MessageManager.getString("action.remove_left"));
372     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_L,
373             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
374     al = new ActionListener()
375     {
376       @Override
377       public void actionPerformed(ActionEvent e)
378       {
379         remove2LeftMenuItem_actionPerformed(e);
380       }
381     };
382     addMenuActionAndAccelerator(keyStroke, remove2LeftMenuItem, al);
383
384     JMenuItem remove2RightMenuItem = new JMenuItem(
385             MessageManager.getString("action.remove_right"));
386     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_R,
387             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
388     al = new ActionListener()
389     {
390       @Override
391       public void actionPerformed(ActionEvent e)
392       {
393         remove2RightMenuItem_actionPerformed(e);
394       }
395     };
396     addMenuActionAndAccelerator(keyStroke, remove2RightMenuItem, al);
397
398     JMenuItem removeGappedColumnMenuItem = new JMenuItem(
399             MessageManager.getString("action.remove_empty_columns"));
400     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_E,
401             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
402     al = new ActionListener()
403     {
404       @Override
405       public void actionPerformed(ActionEvent e)
406       {
407         removeGappedColumnMenuItem_actionPerformed(e);
408       }
409     };
410     addMenuActionAndAccelerator(keyStroke, removeGappedColumnMenuItem, al);
411
412     JMenuItem removeAllGapsMenuItem = new JMenuItem(
413             MessageManager.getString("action.remove_all_gaps"));
414     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_E,
415             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()
416                     | KeyEvent.SHIFT_MASK,
417             false);
418     al = new ActionListener()
419     {
420       @Override
421       public void actionPerformed(ActionEvent e)
422       {
423         removeAllGapsMenuItem_actionPerformed(e);
424       }
425     };
426     addMenuActionAndAccelerator(keyStroke, removeAllGapsMenuItem, al);
427
428     JMenuItem justifyLeftMenuItem = new JMenuItem(
429             MessageManager.getString("action.left_justify_alignment"));
430     justifyLeftMenuItem.addActionListener(new ActionListener()
431     {
432       @Override
433       public void actionPerformed(ActionEvent e)
434       {
435         justifyLeftMenuItem_actionPerformed(e);
436       }
437     });
438     JMenuItem justifyRightMenuItem = new JMenuItem(
439             MessageManager.getString("action.right_justify_alignment"));
440     justifyRightMenuItem.addActionListener(new ActionListener()
441     {
442       @Override
443       public void actionPerformed(ActionEvent e)
444       {
445         justifyRightMenuItem_actionPerformed(e);
446       }
447     });
448     viewBoxesMenuItem.setText(MessageManager.getString("action.boxes"));
449     viewBoxesMenuItem.setState(true);
450     viewBoxesMenuItem.addActionListener(new ActionListener()
451     {
452       @Override
453       public void actionPerformed(ActionEvent e)
454       {
455         viewBoxesMenuItem_actionPerformed(e);
456       }
457     });
458     viewTextMenuItem.setText(MessageManager.getString("action.text"));
459     viewTextMenuItem.setState(true);
460     viewTextMenuItem.addActionListener(new ActionListener()
461     {
462       @Override
463       public void actionPerformed(ActionEvent e)
464       {
465         viewTextMenuItem_actionPerformed(e);
466       }
467     });
468     showNonconservedMenuItem
469             .setText(MessageManager.getString("label.show_non_conserved"));
470     showNonconservedMenuItem.setState(false);
471     showNonconservedMenuItem.addActionListener(new ActionListener()
472     {
473       @Override
474       public void actionPerformed(ActionEvent e)
475       {
476         showUnconservedMenuItem_actionPerformed(e);
477       }
478     });
479     JMenuItem sortPairwiseMenuItem = new JMenuItem(
480             MessageManager.getString("action.by_pairwise_id"));
481     sortPairwiseMenuItem.addActionListener(new ActionListener()
482     {
483       @Override
484       public void actionPerformed(ActionEvent e)
485       {
486         sortPairwiseMenuItem_actionPerformed(e);
487       }
488     });
489     JMenuItem sortIDMenuItem = new JMenuItem(
490             MessageManager.getString("action.by_id"));
491     sortIDMenuItem.addActionListener(new ActionListener()
492     {
493       @Override
494       public void actionPerformed(ActionEvent e)
495       {
496         sortIDMenuItem_actionPerformed(e);
497       }
498     });
499     JMenuItem sortLengthMenuItem = new JMenuItem(
500             MessageManager.getString("action.by_length"));
501     sortLengthMenuItem.addActionListener(new ActionListener()
502     {
503       @Override
504       public void actionPerformed(ActionEvent e)
505       {
506         sortLengthMenuItem_actionPerformed(e);
507       }
508     });
509     JMenuItem sortGroupMenuItem = new JMenuItem(
510             MessageManager.getString("action.by_group"));
511     sortGroupMenuItem.addActionListener(new ActionListener()
512     {
513       @Override
514       public void actionPerformed(ActionEvent e)
515       {
516         sortGroupMenuItem_actionPerformed(e);
517       }
518     });
519
520     JMenuItem removeRedundancyMenuItem = new JMenuItem(
521             MessageManager.getString("action.remove_redundancy"));
522     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_D,
523             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
524     al = new ActionListener()
525     {
526       @Override
527       public void actionPerformed(ActionEvent e)
528       {
529         removeRedundancyMenuItem_actionPerformed(e);
530       }
531     };
532     addMenuActionAndAccelerator(keyStroke, removeRedundancyMenuItem, al);
533
534     JMenuItem pairwiseAlignmentMenuItem = new JMenuItem(
535             MessageManager.getString("action.pairwise_alignment"));
536     pairwiseAlignmentMenuItem.addActionListener(new ActionListener()
537     {
538       @Override
539       public void actionPerformed(ActionEvent e)
540       {
541         pairwiseAlignmentMenuItem_actionPerformed(e);
542       }
543     });
544
545     this.getContentPane().setLayout(new BorderLayout());
546     alignFrameMenuBar.setFont(new java.awt.Font("Verdana", 0, 11));
547     statusBar.setBackground(Color.white);
548     statusBar.setFont(new java.awt.Font("Verdana", 0, 11));
549     statusBar.setBorder(BorderFactory.createLineBorder(Color.black));
550     statusBar.setText(MessageManager.getString("label.status_bar"));
551     outputTextboxMenu
552             .setText(MessageManager.getString("label.out_to_textbox"));
553
554     annotationPanelMenuItem.setActionCommand("");
555     annotationPanelMenuItem
556             .setText(MessageManager.getString("label.show_annotations"));
557     annotationPanelMenuItem
558             .setState(Cache.getDefault("SHOW_ANNOTATIONS", true));
559     annotationPanelMenuItem.addActionListener(new ActionListener()
560     {
561       @Override
562       public void actionPerformed(ActionEvent e)
563       {
564         annotationPanelMenuItem_actionPerformed(e);
565       }
566     });
567     showAllAlAnnotations.setText(
568             MessageManager.getString("label.show_all_al_annotations"));
569     final boolean isAnnotationPanelShown = annotationPanelMenuItem
570             .getState();
571     showAllAlAnnotations.setEnabled(isAnnotationPanelShown);
572     showAllAlAnnotations.addActionListener(new ActionListener()
573     {
574       @Override
575       public void actionPerformed(ActionEvent e)
576       {
577         showAllAnnotations_actionPerformed(false, true);
578       }
579     });
580     hideAllAlAnnotations.setText(
581             MessageManager.getString("label.hide_all_al_annotations"));
582     hideAllAlAnnotations.setEnabled(isAnnotationPanelShown);
583     hideAllAlAnnotations.addActionListener(new ActionListener()
584     {
585       @Override
586       public void actionPerformed(ActionEvent e)
587       {
588         hideAllAnnotations_actionPerformed(false, true);
589       }
590     });
591     showAllSeqAnnotations.setText(
592             MessageManager.getString("label.show_all_seq_annotations"));
593     showAllSeqAnnotations.setEnabled(isAnnotationPanelShown);
594     showAllSeqAnnotations.addActionListener(new ActionListener()
595     {
596       @Override
597       public void actionPerformed(ActionEvent e)
598       {
599         showAllAnnotations_actionPerformed(true, false);
600       }
601     });
602     hideAllSeqAnnotations.setText(
603             MessageManager.getString("label.hide_all_seq_annotations"));
604     hideAllSeqAnnotations.setEnabled(isAnnotationPanelShown);
605     hideAllSeqAnnotations.addActionListener(new ActionListener()
606     {
607       @Override
608       public void actionPerformed(ActionEvent e)
609       {
610         hideAllAnnotations_actionPerformed(true, false);
611       }
612     });
613     SequenceAnnotationOrder sortAnnotationsBy = SequenceAnnotationOrder
614             .valueOf(Cache.getDefault(Preferences.SORT_ANNOTATIONS,
615                     SequenceAnnotationOrder.NONE.name()));
616     final JCheckBoxMenuItem sortAnnBySequence = new JCheckBoxMenuItem(
617             MessageManager.getString("label.sort_annotations_by_sequence"));
618     final JCheckBoxMenuItem sortAnnByLabel = new JCheckBoxMenuItem(
619             MessageManager.getString("label.sort_annotations_by_label"));
620
621     sortAnnBySequence.setSelected(
622             sortAnnotationsBy == SequenceAnnotationOrder.SEQUENCE_AND_LABEL);
623     sortAnnBySequence.addActionListener(new ActionListener()
624     {
625       @Override
626       public void actionPerformed(ActionEvent e)
627       {
628         boolean newState = sortAnnBySequence.getState();
629         sortAnnByLabel.setSelected(false);
630         setAnnotationSortOrder(
631                 newState ? SequenceAnnotationOrder.SEQUENCE_AND_LABEL
632                         : SequenceAnnotationOrder.NONE);
633         sortAnnotations_actionPerformed();
634       }
635     });
636     sortAnnByLabel.setSelected(
637             sortAnnotationsBy == SequenceAnnotationOrder.LABEL_AND_SEQUENCE);
638     sortAnnByLabel.addActionListener(new ActionListener()
639     {
640       @Override
641       public void actionPerformed(ActionEvent e)
642       {
643         boolean newState = sortAnnByLabel.getState();
644         sortAnnBySequence.setSelected(false);
645         setAnnotationSortOrder(
646                 newState ? SequenceAnnotationOrder.LABEL_AND_SEQUENCE
647                         : SequenceAnnotationOrder.NONE);
648         sortAnnotations_actionPerformed();
649       }
650     });
651     colourTextMenuItem = new JCheckBoxMenuItem(
652             MessageManager.getString("label.colour_text"));
653     colourTextMenuItem.addActionListener(new ActionListener()
654     {
655       @Override
656       public void actionPerformed(ActionEvent e)
657       {
658         colourTextMenuItem_actionPerformed(e);
659       }
660     });
661
662     JMenuItem htmlMenuItem = new JMenuItem(
663             MessageManager.getString("label.html"));
664     htmlMenuItem.addActionListener(new ActionListener()
665     {
666       @Override
667       public void actionPerformed(ActionEvent e)
668       {
669         htmlMenuItem_actionPerformed(e);
670       }
671     });
672
673     JMenuItem createBioJS = new JMenuItem(
674             MessageManager.getString("label.biojs_html_export"));
675     createBioJS.addActionListener(new java.awt.event.ActionListener()
676     {
677       @Override
678       public void actionPerformed(ActionEvent e)
679       {
680         bioJSMenuItem_actionPerformed(e);
681       }
682     });
683
684     JMenuItem overviewMenuItem = new JMenuItem(
685             MessageManager.getString("label.overview_window"));
686     overviewMenuItem.addActionListener(new ActionListener()
687     {
688       @Override
689       public void actionPerformed(ActionEvent e)
690       {
691         overviewMenuItem_actionPerformed(e);
692       }
693     });
694
695     undoMenuItem.setEnabled(false);
696     undoMenuItem.setText(MessageManager.getString("action.undo"));
697     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_Z,
698             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
699     al = new ActionListener()
700     {
701       @Override
702       public void actionPerformed(ActionEvent e)
703       {
704         undoMenuItem_actionPerformed(e);
705       }
706     };
707     addMenuActionAndAccelerator(keyStroke, undoMenuItem, al);
708
709     redoMenuItem.setEnabled(false);
710     redoMenuItem.setText(MessageManager.getString("action.redo"));
711     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_Y,
712             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
713     al = new ActionListener()
714     {
715       @Override
716       public void actionPerformed(ActionEvent e)
717       {
718         redoMenuItem_actionPerformed(e);
719       }
720     };
721     addMenuActionAndAccelerator(keyStroke, redoMenuItem, al);
722
723     wrapMenuItem.setText(MessageManager.getString("label.wrap"));
724     wrapMenuItem.addActionListener(new ActionListener()
725     {
726       @Override
727       public void actionPerformed(ActionEvent e)
728       {
729         wrapMenuItem_actionPerformed(e);
730       }
731     });
732
733     JMenuItem printMenuItem = new JMenuItem(
734             MessageManager.getString("action.print"));
735     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_P,
736             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
737     al = new ActionListener()
738     {
739       @Override
740       public void actionPerformed(ActionEvent e)
741       {
742         printMenuItem_actionPerformed(e);
743       }
744     };
745     addMenuActionAndAccelerator(keyStroke, printMenuItem, al);
746
747     renderGapsMenuItem
748             .setText(MessageManager.getString("action.show_gaps"));
749     renderGapsMenuItem.setState(true);
750     renderGapsMenuItem.addActionListener(new ActionListener()
751     {
752       @Override
753       public void actionPerformed(ActionEvent e)
754       {
755         renderGapsMenuItem_actionPerformed(e);
756       }
757     });
758
759     JMenuItem findMenuItem = new JMenuItem(
760             MessageManager.getString("action.find"));
761     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_F,
762             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
763     findMenuItem.setToolTipText(JvSwingUtils.wrapTooltip(true,
764             MessageManager.getString("label.find_tip")));
765     al = new ActionListener()
766     {
767       @Override
768       public void actionPerformed(ActionEvent e)
769       {
770         findMenuItem_actionPerformed(e);
771       }
772     };
773     addMenuActionAndAccelerator(keyStroke, findMenuItem, al);
774
775     showSeqFeatures.setText(
776             MessageManager.getString("label.show_sequence_features"));
777     showSeqFeatures.addActionListener(new ActionListener()
778     {
779       @Override
780       public void actionPerformed(ActionEvent actionEvent)
781       {
782         showSeqFeatures_actionPerformed(actionEvent);
783       }
784     });
785     /*
786      * showSeqFeaturesHeight.setText("Vary Sequence Feature Height");
787      * showSeqFeaturesHeight.addActionListener(new ActionListener() { public
788      * void actionPerformed(ActionEvent actionEvent) {
789      * showSeqFeaturesHeight_actionPerformed(actionEvent); } });
790      */
791     showDbRefsMenuitem
792             .setText(MessageManager.getString("label.show_database_refs"));
793     showDbRefsMenuitem.addActionListener(new ActionListener()
794     {
795
796       @Override
797       public void actionPerformed(ActionEvent e)
798       {
799         showDbRefs_actionPerformed(e);
800       }
801
802     });
803     showNpFeatsMenuitem.setText(
804             MessageManager.getString("label.show_non_positional_features"));
805     showNpFeatsMenuitem.addActionListener(new ActionListener()
806     {
807
808       @Override
809       public void actionPerformed(ActionEvent e)
810       {
811         showNpFeats_actionPerformed(e);
812       }
813
814     });
815     showGroupConservation
816             .setText(MessageManager.getString("label.group_conservation"));
817     showGroupConservation.addActionListener(new ActionListener()
818     {
819
820       @Override
821       public void actionPerformed(ActionEvent e)
822       {
823         showGroupConservation_actionPerformed(e);
824       }
825
826     });
827
828     showGroupConsensus
829             .setText(MessageManager.getString("label.group_consensus"));
830     showGroupConsensus.addActionListener(new ActionListener()
831     {
832
833       @Override
834       public void actionPerformed(ActionEvent e)
835       {
836         showGroupConsensus_actionPerformed(e);
837       }
838
839     });
840     showConsensusHistogram.setText(
841             MessageManager.getString("label.show_consensus_histogram"));
842     showConsensusHistogram.addActionListener(new ActionListener()
843     {
844
845       @Override
846       public void actionPerformed(ActionEvent e)
847       {
848         showConsensusHistogram_actionPerformed(e);
849       }
850
851     });
852     showSequenceLogo
853             .setText(MessageManager.getString("label.show_consensus_logo"));
854     showSequenceLogo.addActionListener(new ActionListener()
855     {
856
857       @Override
858       public void actionPerformed(ActionEvent e)
859       {
860         showSequenceLogo_actionPerformed(e);
861       }
862
863     });
864     normaliseSequenceLogo
865             .setText(MessageManager.getString("label.norm_consensus_logo"));
866     normaliseSequenceLogo.addActionListener(new ActionListener()
867     {
868
869       @Override
870       public void actionPerformed(ActionEvent e)
871       {
872         normaliseSequenceLogo_actionPerformed(e);
873       }
874
875     });
876     applyAutoAnnotationSettings
877             .setText(MessageManager.getString("label.apply_all_groups"));
878     applyAutoAnnotationSettings.setState(false);
879     applyAutoAnnotationSettings.setVisible(true);
880     applyAutoAnnotationSettings.addActionListener(new ActionListener()
881     {
882       @Override
883       public void actionPerformed(ActionEvent e)
884       {
885         applyAutoAnnotationSettings_actionPerformed(e);
886       }
887     });
888
889     ButtonGroup buttonGroup = new ButtonGroup();
890     final JRadioButtonMenuItem showAutoFirst = new JRadioButtonMenuItem(
891             MessageManager.getString("label.show_first"));
892     final JRadioButtonMenuItem showAutoLast = new JRadioButtonMenuItem(
893             MessageManager.getString("label.show_last"));
894     buttonGroup.add(showAutoFirst);
895     buttonGroup.add(showAutoLast);
896     final boolean autoFirst = Cache
897             .getDefault(Preferences.SHOW_AUTOCALC_ABOVE, false);
898     showAutoFirst.setSelected(autoFirst);
899     setShowAutoCalculatedAbove(autoFirst);
900     showAutoFirst.addActionListener(new ActionListener()
901     {
902       @Override
903       public void actionPerformed(ActionEvent e)
904       {
905         setShowAutoCalculatedAbove(showAutoFirst.isSelected());
906         sortAnnotations_actionPerformed();
907       }
908     });
909     showAutoLast.setSelected(!showAutoFirst.isSelected());
910     showAutoLast.addActionListener(new ActionListener()
911     {
912       @Override
913       public void actionPerformed(ActionEvent e)
914       {
915         setShowAutoCalculatedAbove(!showAutoLast.isSelected());
916         sortAnnotations_actionPerformed();
917       }
918     });
919
920     JMenuItem deleteGroups = new JMenuItem(
921             MessageManager.getString("action.undefine_groups"));
922     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_U,
923             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
924     al = new ActionListener()
925     {
926       @Override
927       public void actionPerformed(ActionEvent e)
928       {
929         deleteGroups_actionPerformed(e);
930       }
931     };
932     addMenuActionAndAccelerator(keyStroke, deleteGroups, al);
933
934     JMenuItem annotationColumn = new JMenuItem(
935             MessageManager.getString("action.select_by_annotation"));
936     annotationColumn.addActionListener(new ActionListener()
937     {
938       @Override
939       public void actionPerformed(ActionEvent e)
940       {
941         annotationColumn_actionPerformed(e);
942       }
943     });
944
945     JMenuItem createGroup = new JMenuItem(
946             MessageManager.getString("action.create_group"));
947     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G,
948             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
949     al = new ActionListener()
950     {
951       @Override
952       public void actionPerformed(ActionEvent e)
953       {
954         createGroup_actionPerformed(e);
955       }
956     };
957     addMenuActionAndAccelerator(keyStroke, createGroup, al);
958
959     JMenuItem unGroup = new JMenuItem(
960             MessageManager.getString("action.remove_group"));
961     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G,
962             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()
963                     | KeyEvent.SHIFT_MASK,
964             false);
965     al = new ActionListener()
966     {
967       @Override
968       public void actionPerformed(ActionEvent e)
969       {
970         unGroup_actionPerformed(e);
971       }
972     };
973     addMenuActionAndAccelerator(keyStroke, unGroup, al);
974
975     copy.setText(MessageManager.getString("action.copy"));
976     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_C,
977             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
978
979     al = new ActionListener()
980     {
981       @Override
982       public void actionPerformed(ActionEvent e)
983       {
984         copy_actionPerformed();
985       }
986     };
987     addMenuActionAndAccelerator(keyStroke, copy, al);
988
989     cut.setText(MessageManager.getString("action.cut"));
990     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_X,
991             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
992     al = new ActionListener()
993     {
994       @Override
995       public void actionPerformed(ActionEvent e)
996       {
997         cut_actionPerformed();
998       }
999     };
1000     addMenuActionAndAccelerator(keyStroke, cut, al);
1001
1002     JMenuItem delete = new JMenuItem(
1003             MessageManager.getString("action.delete"));
1004     delete.addActionListener(new ActionListener()
1005     {
1006       @Override
1007       public void actionPerformed(ActionEvent e)
1008       {
1009         delete_actionPerformed();
1010       }
1011     });
1012
1013     pasteMenu.setText(MessageManager.getString("action.paste"));
1014     JMenuItem pasteNew = new JMenuItem(
1015             MessageManager.getString("label.to_new_alignment"));
1016     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_V,
1017             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()
1018                     | KeyEvent.SHIFT_MASK,
1019             false);
1020     al = new ActionListener()
1021     {
1022       @Override
1023       public void actionPerformed(ActionEvent e)
1024       {
1025         pasteNew_actionPerformed(e);
1026       }
1027     };
1028     addMenuActionAndAccelerator(keyStroke, pasteNew, al);
1029
1030     JMenuItem pasteThis = new JMenuItem(
1031             MessageManager.getString("label.to_this_alignment"));
1032     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_V,
1033             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
1034     al = new ActionListener()
1035     {
1036       @Override
1037       public void actionPerformed(ActionEvent e)
1038       {
1039         pasteThis_actionPerformed(e);
1040       }
1041     };
1042     addMenuActionAndAccelerator(keyStroke, pasteThis, al);
1043
1044     JMenuItem createPNG = new JMenuItem("PNG");
1045     createPNG.addActionListener(new ActionListener()
1046     {
1047       @Override
1048       public void actionPerformed(ActionEvent e)
1049       {
1050         createPNG(null);
1051       }
1052     });
1053     createPNG.setActionCommand(
1054             MessageManager.getString("label.save_png_image"));
1055
1056     JMenuItem font = new JMenuItem(MessageManager.getString("action.font"));
1057     font.addActionListener(new ActionListener()
1058     {
1059       @Override
1060       public void actionPerformed(ActionEvent e)
1061       {
1062         font_actionPerformed(e);
1063       }
1064     });
1065     seqLimits.setText(
1066             MessageManager.getString("label.show_sequence_limits"));
1067     seqLimits.setState(jalview.bin.Cache.getDefault("SHOW_JVSUFFIX", true));
1068     seqLimits.addActionListener(new ActionListener()
1069     {
1070       @Override
1071       public void actionPerformed(ActionEvent e)
1072       {
1073         seqLimit_actionPerformed(e);
1074       }
1075     });
1076     JMenuItem epsFile = new JMenuItem("EPS");
1077     epsFile.addActionListener(new ActionListener()
1078     {
1079       @Override
1080       public void actionPerformed(ActionEvent e)
1081       {
1082         createEPS(null);
1083       }
1084     });
1085
1086     JMenuItem createSVG = new JMenuItem("SVG");
1087     createSVG.addActionListener(new ActionListener()
1088     {
1089       @Override
1090       public void actionPerformed(ActionEvent e)
1091       {
1092         createSVG(null);
1093       }
1094     });
1095
1096     JMenuItem loadTreeMenuItem = new JMenuItem(
1097             MessageManager.getString("label.load_associated_tree"));
1098     loadTreeMenuItem.setActionCommand(
1099             MessageManager.getString("label.load_tree_for_sequence_set"));
1100     loadTreeMenuItem.addActionListener(new ActionListener()
1101     {
1102       @Override
1103       public void actionPerformed(ActionEvent e)
1104       {
1105         loadTreeMenuItem_actionPerformed(e);
1106       }
1107     });
1108
1109     scaleAbove.setVisible(false);
1110     scaleAbove.setText(MessageManager.getString("action.scale_above"));
1111     scaleAbove.addActionListener(new ActionListener()
1112     {
1113       @Override
1114       public void actionPerformed(ActionEvent e)
1115       {
1116         scaleAbove_actionPerformed(e);
1117       }
1118     });
1119     scaleLeft.setVisible(false);
1120     scaleLeft.setSelected(true);
1121     scaleLeft.setText(MessageManager.getString("action.scale_left"));
1122     scaleLeft.addActionListener(new ActionListener()
1123     {
1124       @Override
1125       public void actionPerformed(ActionEvent e)
1126       {
1127         scaleLeft_actionPerformed(e);
1128       }
1129     });
1130     scaleRight.setVisible(false);
1131     scaleRight.setSelected(true);
1132     scaleRight.setText(MessageManager.getString("action.scale_right"));
1133     scaleRight.addActionListener(new ActionListener()
1134     {
1135       @Override
1136       public void actionPerformed(ActionEvent e)
1137       {
1138         scaleRight_actionPerformed(e);
1139       }
1140     });
1141     centreColumnLabelsMenuItem.setVisible(true);
1142     centreColumnLabelsMenuItem.setState(false);
1143     centreColumnLabelsMenuItem.setText(
1144             MessageManager.getString("label.centre_column_labels"));
1145     centreColumnLabelsMenuItem.addActionListener(new ActionListener()
1146     {
1147       @Override
1148       public void actionPerformed(ActionEvent e)
1149       {
1150         centreColumnLabels_actionPerformed(e);
1151       }
1152     });
1153     followHighlightMenuItem.setVisible(true);
1154     followHighlightMenuItem.setState(true);
1155     followHighlightMenuItem
1156             .setText(MessageManager.getString("label.automatic_scrolling"));
1157     followHighlightMenuItem.addActionListener(new ActionListener()
1158     {
1159
1160       @Override
1161       public void actionPerformed(ActionEvent e)
1162       {
1163         followHighlight_actionPerformed();
1164       }
1165
1166     });
1167
1168     sortByTreeMenu
1169             .setText(MessageManager.getString("action.by_tree_order"));
1170     sort.setText(MessageManager.getString("action.sort"));
1171     sort.addMenuListener(new MenuListener()
1172     {
1173       @Override
1174       public void menuSelected(MenuEvent e)
1175       {
1176         buildTreeSortMenu();
1177       }
1178
1179       @Override
1180       public void menuDeselected(MenuEvent e)
1181       {
1182       }
1183
1184       @Override
1185       public void menuCanceled(MenuEvent e)
1186       {
1187       }
1188     });
1189     sortByAnnotScore
1190             .setText(MessageManager.getString("label.sort_by_score"));
1191     sort.add(sortByAnnotScore);
1192     sort.addMenuListener(new javax.swing.event.MenuListener()
1193     {
1194
1195       @Override
1196       public void menuCanceled(MenuEvent e)
1197       {
1198       }
1199
1200       @Override
1201       public void menuDeselected(MenuEvent e)
1202       {
1203       }
1204
1205       @Override
1206       public void menuSelected(MenuEvent e)
1207       {
1208         buildSortByAnnotationScoresMenu();
1209       }
1210     });
1211     sortByAnnotScore.setVisible(false);
1212
1213     calculateTree
1214             .setText(MessageManager.getString("action.calculate_tree_pca"));
1215
1216     padGapsMenuitem.setText(MessageManager.getString("label.pad_gaps"));
1217     padGapsMenuitem
1218             .setState(jalview.bin.Cache.getDefault("PAD_GAPS", false));
1219     padGapsMenuitem.addActionListener(new ActionListener()
1220     {
1221       @Override
1222       public void actionPerformed(ActionEvent e)
1223       {
1224         padGapsMenuitem_actionPerformed(e);
1225       }
1226     });
1227     JMenuItem vamsasStore = new JMenuItem(
1228             MessageManager.getString("label.vamsas_store"));
1229     vamsasStore.setVisible(false);
1230     vamsasStore.addActionListener(new ActionListener()
1231     {
1232       @Override
1233       public void actionPerformed(ActionEvent e)
1234       {
1235         vamsasStore_actionPerformed(e);
1236       }
1237     });
1238
1239     /*
1240      * Translate as cDNA with sub-menu of translation tables
1241      */
1242     showTranslation
1243             .setText(MessageManager.getString("label.translate_cDNA"));
1244     boolean first = true;
1245     for (final GeneticCodeI table : GeneticCodes.getCodeTables())
1246     {
1247       JMenuItem item = new JMenuItem(table.getId() + " " + table.getName());
1248       showTranslation.add(item);
1249       item.addActionListener(new ActionListener()
1250       {
1251         @Override
1252         public void actionPerformed(ActionEvent e)
1253         {
1254           showTranslation_actionPerformed(table);
1255         }
1256       });
1257       if (first)
1258       {
1259         showTranslation.addSeparator();
1260       }
1261       first = false;
1262     }
1263
1264     showReverse.setText(MessageManager.getString("label.reverse"));
1265     showReverse.addActionListener(new ActionListener()
1266     {
1267       @Override
1268       public void actionPerformed(ActionEvent e)
1269       {
1270         showReverse_actionPerformed(false);
1271       }
1272     });
1273     showReverseComplement
1274             .setText(MessageManager.getString("label.reverse_complement"));
1275     showReverseComplement.addActionListener(new ActionListener()
1276     {
1277       @Override
1278       public void actionPerformed(ActionEvent e)
1279       {
1280         showReverse_actionPerformed(true);
1281       }
1282     });
1283
1284     JMenuItem extractScores = new JMenuItem(
1285             MessageManager.getString("label.extract_scores"));
1286     extractScores.addActionListener(new ActionListener()
1287     {
1288       @Override
1289       public void actionPerformed(ActionEvent e)
1290       {
1291         extractScores_actionPerformed(e);
1292       }
1293     });
1294     extractScores.setVisible(true);
1295     // JBPNote: TODO: make gui for regex based score extraction
1296
1297     // for show products actions see AlignFrame.canShowProducts
1298     showProducts.setText(MessageManager.getString("label.get_cross_refs"));
1299
1300     runGroovy.setText(MessageManager.getString("label.run_groovy"));
1301     runGroovy.setToolTipText(
1302             MessageManager.getString("label.run_groovy_tip"));
1303     runGroovy.addActionListener(new ActionListener()
1304     {
1305       @Override
1306       public void actionPerformed(ActionEvent e)
1307       {
1308         runGroovy_actionPerformed();
1309       }
1310     });
1311
1312     openFeatureSettings = new JMenuItem(
1313             MessageManager.getString("action.feature_settings"));
1314     openFeatureSettings.addActionListener(new ActionListener()
1315     {
1316       @Override
1317       public void actionPerformed(ActionEvent e)
1318       {
1319         featureSettings_actionPerformed(e);
1320       }
1321     });
1322
1323     /*
1324      * add sub-menu of database we can fetch from
1325      */
1326     JMenuItem fetchSequence = new JMenuItem(
1327             MessageManager.getString("label.fetch_sequences"));
1328     fetchSequence.addActionListener(new ActionListener()
1329     {
1330       @Override
1331       public void actionPerformed(ActionEvent e)
1332       {
1333         fetchSequence_actionPerformed();
1334       }
1335     });
1336
1337     JMenuItem associatedData = new JMenuItem(
1338             MessageManager.getString("label.load_features_annotations"));
1339     associatedData.addActionListener(new ActionListener()
1340     {
1341       @Override
1342       public void actionPerformed(ActionEvent e)
1343       {
1344         associatedData_actionPerformed(e);
1345       }
1346     });
1347     loadVcf = new JMenuItem(
1348             MessageManager.getString("label.load_vcf_file"));
1349     loadVcf.setToolTipText(MessageManager.getString("label.load_vcf"));
1350     loadVcf.addActionListener(new ActionListener()
1351     {
1352       @Override
1353       public void actionPerformed(ActionEvent e)
1354       {
1355         loadVcf_actionPerformed();
1356       }
1357     });
1358     autoCalculate.setText(
1359             MessageManager.getString("label.autocalculate_consensus"));
1360     autoCalculate.setState(
1361             jalview.bin.Cache.getDefault("AUTO_CALC_CONSENSUS", true));
1362     autoCalculate.addActionListener(new ActionListener()
1363     {
1364       @Override
1365       public void actionPerformed(ActionEvent e)
1366       {
1367         autoCalculate_actionPerformed(e);
1368       }
1369     });
1370     sortByTree.setText(
1371             MessageManager.getString("label.sort_alignment_new_tree"));
1372     sortByTree.setToolTipText("<html>" + MessageManager.getString(
1373             "label.enable_automatically_sort_alignment_when_open_new_tree"));
1374     sortByTree
1375             .setState(jalview.bin.Cache.getDefault("SORT_BY_TREE", false));
1376     sortByTree.addActionListener(new ActionListener()
1377     {
1378       @Override
1379       public void actionPerformed(ActionEvent e)
1380       {
1381         sortByTreeOption_actionPerformed(e);
1382       }
1383     });
1384
1385     listenToViewSelections.setText(
1386             MessageManager.getString("label.listen_for_selections"));
1387     listenToViewSelections
1388             .setToolTipText("<html>" + MessageManager.getString(
1389                     "label.selections_mirror_selections_made_same_sequences_other_views"));
1390     listenToViewSelections.setState(false);
1391     listenToViewSelections.addActionListener(new ActionListener()
1392     {
1393       @Override
1394       public void actionPerformed(ActionEvent e)
1395       {
1396         listenToViewSelections_actionPerformed(e);
1397       }
1398     });
1399
1400     JMenu addSequenceMenu = new JMenu(
1401             MessageManager.getString("label.add_sequences"));
1402     JMenuItem addFromFile = new JMenuItem(
1403             MessageManager.getString("label.from_file"));
1404     addFromFile.addActionListener(new ActionListener()
1405     {
1406       @Override
1407       public void actionPerformed(ActionEvent e)
1408       {
1409         addFromFile_actionPerformed(e);
1410       }
1411     });
1412     JMenuItem addFromText = new JMenuItem(
1413             MessageManager.getString("label.from_textbox"));
1414     addFromText.addActionListener(new ActionListener()
1415     {
1416       @Override
1417       public void actionPerformed(ActionEvent e)
1418       {
1419         addFromText_actionPerformed(e);
1420       }
1421     });
1422     JMenuItem addFromURL = new JMenuItem(
1423             MessageManager.getString("label.from_url"));
1424     addFromURL.addActionListener(new ActionListener()
1425     {
1426       @Override
1427       public void actionPerformed(ActionEvent e)
1428       {
1429         addFromURL_actionPerformed(e);
1430       }
1431     });
1432     JMenuItem exportFeatures = new JMenuItem(
1433             MessageManager.getString("label.export_features"));
1434     exportFeatures.addActionListener(new ActionListener()
1435     {
1436       @Override
1437       public void actionPerformed(ActionEvent e)
1438       {
1439         exportFeatures_actionPerformed(e);
1440       }
1441     });
1442     JMenuItem exportAnnotations = new JMenuItem(
1443             MessageManager.getString("label.export_annotations"));
1444     exportAnnotations.addActionListener(new ActionListener()
1445     {
1446       @Override
1447       public void actionPerformed(ActionEvent e)
1448       {
1449         exportAnnotations_actionPerformed(e);
1450       }
1451     });
1452     statusPanel.setLayout(new GridLayout());
1453     JMenuItem showAllSeqs = new JMenuItem(
1454             MessageManager.getString("label.all_sequences"));
1455     showAllSeqs.setToolTipText(
1456             MessageManager.getString("label.toggle_sequence_visibility"));
1457     showAllSeqs.addActionListener(new ActionListener()
1458     {
1459       @Override
1460       public void actionPerformed(ActionEvent e)
1461       {
1462         showAllSeqs_actionPerformed(e);
1463       }
1464     });
1465     JMenuItem showAllColumns = new JMenuItem(
1466             MessageManager.getString("label.all_columns"));
1467     showAllColumns.setToolTipText(
1468             MessageManager.getString("label.toggle_columns_visibility"));
1469     showAllColumns.addActionListener(new ActionListener()
1470     {
1471       @Override
1472       public void actionPerformed(ActionEvent e)
1473       {
1474         showAllColumns_actionPerformed(e);
1475       }
1476     });
1477     JMenu hideMenu = new JMenu(MessageManager.getString("action.hide"));
1478     JMenuItem hideSelSequences = new JMenuItem(
1479             MessageManager.getString("label.selected_sequences"));
1480     hideSelSequences.setToolTipText(
1481             MessageManager.getString("label.toggle_sequence_visibility"));
1482     hideSelSequences.addActionListener(new ActionListener()
1483     {
1484       @Override
1485       public void actionPerformed(ActionEvent e)
1486       {
1487         hideSelSequences_actionPerformed(e);
1488       }
1489     });
1490     JMenuItem hideSelColumns = new JMenuItem(
1491             MessageManager.getString("label.selected_columns"));
1492     hideSelColumns.setToolTipText(
1493             MessageManager.getString("label.toggle_columns_visibility"));
1494     hideSelColumns.addActionListener(new ActionListener()
1495     {
1496       @Override
1497       public void actionPerformed(ActionEvent e)
1498       {
1499         hideSelColumns_actionPerformed(e);
1500       }
1501     });
1502     JMenuItem hideAllSelection = new JMenuItem(
1503             MessageManager.getString("label.selected_region"));
1504     hideAllSelection.addActionListener(new ActionListener()
1505     {
1506       @Override
1507       public void actionPerformed(ActionEvent e)
1508       {
1509         hideAllSelection_actionPerformed(e);
1510       }
1511     });
1512     // TODO: should be hidden if no selection exists.
1513     JMenuItem hideAllButSelection = new JMenuItem(
1514             MessageManager.getString("label.all_but_selected_region"));
1515     hideAllButSelection.addActionListener(new ActionListener()
1516     {
1517       @Override
1518       public void actionPerformed(ActionEvent e)
1519       {
1520         hideAllButSelection_actionPerformed(e);
1521       }
1522     });
1523     JMenuItem showAllhidden = new JMenuItem(
1524             MessageManager.getString("label.all_sequences_columns"));
1525     showAllhidden.setToolTipText(MessageManager
1526             .getString("label.toggles_visibility_hidden_selected_regions"));
1527     showAllhidden.addActionListener(new ActionListener()
1528     {
1529       @Override
1530       public void actionPerformed(ActionEvent e)
1531       {
1532         showAllhidden_actionPerformed(e);
1533       }
1534     });
1535     hiddenMarkers.setText(
1536             MessageManager.getString("action.show_hidden_markers"));
1537     hiddenMarkers.addActionListener(new ActionListener()
1538     {
1539       @Override
1540       public void actionPerformed(ActionEvent e)
1541       {
1542         hiddenMarkers_actionPerformed(e);
1543       }
1544     });
1545
1546     JMenuItem invertColSel = new JMenuItem(
1547             MessageManager.getString("action.invert_column_selection"));
1548     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_I,
1549             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()
1550                     | KeyEvent.ALT_MASK,
1551             false);
1552     al = new ActionListener()
1553     {
1554       @Override
1555       public void actionPerformed(ActionEvent e)
1556       {
1557         invertColSel_actionPerformed(e);
1558       }
1559     };
1560     addMenuActionAndAccelerator(keyStroke, invertColSel, al);
1561
1562     showComplementMenuItem.setVisible(false);
1563     showComplementMenuItem.addActionListener(new ActionListener()
1564     {
1565       @Override
1566       public void actionPerformed(ActionEvent e)
1567       {
1568         showComplement_actionPerformed(showComplementMenuItem.getState());
1569       }
1570     });
1571
1572     tabbedPane.addChangeListener(new javax.swing.event.ChangeListener()
1573     {
1574       @Override
1575       public void stateChanged(ChangeEvent evt)
1576       {
1577         JTabbedPane pane = (JTabbedPane) evt.getSource();
1578         int sel = pane.getSelectedIndex();
1579         tabSelectionChanged(sel);
1580       }
1581     });
1582     tabbedPane.addMouseListener(new MouseAdapter()
1583     {
1584       @Override
1585       public void mousePressed(MouseEvent e)
1586       {
1587         if (e.isPopupTrigger()) // Mac
1588         {
1589           tabbedPane_mousePressed(e);
1590         }
1591       }
1592
1593       @Override
1594       public void mouseReleased(MouseEvent e)
1595       {
1596         if (e.isPopupTrigger()) // Windows
1597         {
1598           tabbedPane_mousePressed(e);
1599         }
1600       }
1601     });
1602     tabbedPane.addFocusListener(new FocusAdapter()
1603     {
1604       @Override
1605       public void focusGained(FocusEvent e)
1606       {
1607         tabbedPane_focusGained(e);
1608       }
1609     });
1610
1611     JMenuItem save = new JMenuItem(MessageManager.getString("action.save"));
1612     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_S,
1613             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
1614     al = new ActionListener()
1615     {
1616       @Override
1617       public void actionPerformed(ActionEvent e)
1618       {
1619         save_actionPerformed(e);
1620       }
1621     };
1622     addMenuActionAndAccelerator(keyStroke, save, al);
1623
1624     reload.setEnabled(false);
1625     reload.setText(MessageManager.getString("action.reload"));
1626     reload.addActionListener(new ActionListener()
1627     {
1628       @Override
1629       public void actionPerformed(ActionEvent e)
1630       {
1631         reload_actionPerformed(e);
1632       }
1633     });
1634
1635     JMenuItem newView = new JMenuItem(
1636             MessageManager.getString("action.new_view"));
1637     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_T,
1638             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
1639     al = new ActionListener()
1640     {
1641       @Override
1642       public void actionPerformed(ActionEvent e)
1643       {
1644         newView_actionPerformed(e);
1645       }
1646     };
1647     addMenuActionAndAccelerator(keyStroke, newView, al);
1648
1649     tabbedPane.setToolTipText("<html><i>"
1650             + MessageManager.getString("label.rename_tab_eXpand_reGroup")
1651             + "</i></html>");
1652
1653     formatMenu.setText(MessageManager.getString("action.format"));
1654     JMenu selectMenu = new JMenu(MessageManager.getString("action.select"));
1655
1656     idRightAlign.setText(
1657             MessageManager.getString("label.right_align_sequence_id"));
1658     idRightAlign.addActionListener(new ActionListener()
1659     {
1660       @Override
1661       public void actionPerformed(ActionEvent e)
1662       {
1663         idRightAlign_actionPerformed(e);
1664       }
1665     });
1666
1667     gatherViews.setEnabled(false);
1668     gatherViews.setText(MessageManager.getString("action.gather_views"));
1669     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G, 0, false);
1670     al = new ActionListener()
1671     {
1672       @Override
1673       public void actionPerformed(ActionEvent e)
1674       {
1675         gatherViews_actionPerformed(e);
1676       }
1677     };
1678     addMenuActionAndAccelerator(keyStroke, gatherViews, al);
1679
1680     expandViews.setEnabled(false);
1681     expandViews.setText(MessageManager.getString("action.expand_views"));
1682     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_X, 0, false);
1683     al = new ActionListener()
1684     {
1685       @Override
1686       public void actionPerformed(ActionEvent e)
1687       {
1688         expandViews_actionPerformed(e);
1689       }
1690     };
1691     addMenuActionAndAccelerator(keyStroke, expandViews, al);
1692
1693     JMenuItem pageSetup = new JMenuItem(
1694             MessageManager.getString("action.page_setup"));
1695     pageSetup.addActionListener(new ActionListener()
1696     {
1697       @Override
1698       public void actionPerformed(ActionEvent e)
1699       {
1700         pageSetup_actionPerformed(e);
1701       }
1702     });
1703     JMenuItem alignmentProperties = new JMenuItem(
1704             MessageManager.getString("label.alignment_props"));
1705     alignmentProperties.addActionListener(new ActionListener()
1706     {
1707       @Override
1708       public void actionPerformed(ActionEvent actionEvent)
1709       {
1710         alignmentProperties();
1711       }
1712     });
1713     JMenuItem selectHighlighted = new JMenuItem(
1714             MessageManager.getString("action.select_highlighted_columns"));
1715     selectHighlighted.setToolTipText(
1716             MessageManager.getString("tooltip.select_highlighted_columns"));
1717     al = new ActionListener()
1718     {
1719       @Override
1720       public void actionPerformed(ActionEvent actionEvent)
1721       {
1722         selectHighlightedColumns_actionPerformed(actionEvent);
1723       }
1724     };
1725     selectHighlighted.addActionListener(al);
1726     JMenu tooltipSettingsMenu = new JMenu(
1727             MessageManager.getString("label.sequence_id_tooltip"));
1728     JMenu autoAnnMenu = new JMenu(
1729             MessageManager.getString("label.autocalculated_annotation"));
1730
1731     JMenu exportImageMenu = new JMenu(
1732             MessageManager.getString("label.export_image"));
1733     JMenu fileMenu = new JMenu(MessageManager.getString("action.file"));
1734     alignFrameMenuBar.add(fileMenu);
1735     alignFrameMenuBar.add(editMenu);
1736     alignFrameMenuBar.add(selectMenu);
1737     alignFrameMenuBar.add(viewMenu);
1738     alignFrameMenuBar.add(annotationsMenu);
1739     alignFrameMenuBar.add(formatMenu);
1740     alignFrameMenuBar.add(colourMenu);
1741     alignFrameMenuBar.add(calculateMenu);
1742     if (!Platform.isJS())
1743     {
1744       alignFrameMenuBar.add(webService);
1745     }
1746
1747     fileMenu.add(fetchSequence);
1748     fileMenu.add(addSequenceMenu);
1749     fileMenu.add(reload);
1750     fileMenu.addSeparator();
1751     fileMenu.add(vamsasStore);
1752     fileMenu.add(save);
1753     fileMenu.add(saveAs);
1754     fileMenu.add(outputTextboxMenu);
1755     fileMenu.add(pageSetup);
1756     fileMenu.add(printMenuItem);
1757     fileMenu.addSeparator();
1758     fileMenu.add(exportImageMenu);
1759     fileMenu.add(exportFeatures);
1760     fileMenu.add(exportAnnotations);
1761     fileMenu.add(loadTreeMenuItem);
1762     fileMenu.add(associatedData);
1763     if (!Platform.isJS())
1764     {
1765       fileMenu.add(loadVcf);
1766     }
1767     fileMenu.addSeparator();
1768     fileMenu.add(closeMenuItem);
1769
1770     pasteMenu.add(pasteNew);
1771     pasteMenu.add(pasteThis);
1772     editMenu.add(undoMenuItem);
1773     editMenu.add(redoMenuItem);
1774     editMenu.add(cut);
1775     editMenu.add(copy);
1776     editMenu.add(pasteMenu);
1777     editMenu.add(delete);
1778     editMenu.addSeparator();
1779     editMenu.add(remove2LeftMenuItem);
1780     editMenu.add(remove2RightMenuItem);
1781     editMenu.add(removeGappedColumnMenuItem);
1782     editMenu.add(removeAllGapsMenuItem);
1783     editMenu.add(removeRedundancyMenuItem);
1784     editMenu.addSeparator();
1785     // dont add these yet in the CVS build - they cannot be undone!
1786     // Excluded from Jalview 2.5 release - undo needs to be implemented.
1787     // editMenu.add(justifyLeftMenuItem);
1788     // editMenu.add(justifyRightMenuItem);
1789     // editMenu.addSeparator();
1790     editMenu.add(padGapsMenuitem);
1791
1792     showMenu.add(showAllColumns);
1793     showMenu.add(showAllSeqs);
1794     showMenu.add(showAllhidden);
1795     hideMenu.add(hideSelColumns);
1796     hideMenu.add(hideSelSequences);
1797     hideMenu.add(hideAllSelection);
1798     hideMenu.add(hideAllButSelection);
1799     viewMenu.add(newView);
1800     viewMenu.add(expandViews);
1801     viewMenu.add(gatherViews);
1802     viewMenu.addSeparator();
1803     viewMenu.add(showMenu);
1804     viewMenu.add(hideMenu);
1805     viewMenu.add(showComplementMenuItem);
1806     viewMenu.addSeparator();
1807     viewMenu.add(followHighlightMenuItem);
1808     viewMenu.addSeparator();
1809     viewMenu.add(showSeqFeatures);
1810     // viewMenu.add(showSeqFeaturesHeight);
1811     viewMenu.add(openFeatureSettings);
1812     tooltipSettingsMenu.add(showDbRefsMenuitem);
1813     tooltipSettingsMenu.add(showNpFeatsMenuitem);
1814     viewMenu.add(tooltipSettingsMenu);
1815     viewMenu.addSeparator();
1816     viewMenu.add(alignmentProperties);
1817     viewMenu.addSeparator();
1818     viewMenu.add(overviewMenuItem);
1819
1820     annotationsMenu.add(annotationPanelMenuItem);
1821     annotationsMenu.addSeparator();
1822     annotationsMenu.add(showAllAlAnnotations);
1823     annotationsMenu.add(hideAllAlAnnotations);
1824     annotationsMenu.addSeparator();
1825     annotationsMenu.add(showAllSeqAnnotations);
1826     annotationsMenu.add(hideAllSeqAnnotations);
1827     annotationsMenu.add(sortAnnBySequence);
1828     annotationsMenu.add(sortAnnByLabel);
1829     annotationsMenu.addSeparator();
1830     autoAnnMenu.add(showAutoFirst);
1831     autoAnnMenu.add(showAutoLast);
1832     autoAnnMenu.addSeparator();
1833     autoAnnMenu.add(applyAutoAnnotationSettings);
1834     autoAnnMenu.add(showConsensusHistogram);
1835     autoAnnMenu.add(showSequenceLogo);
1836     autoAnnMenu.add(normaliseSequenceLogo);
1837     autoAnnMenu.addSeparator();
1838     autoAnnMenu.add(showGroupConservation);
1839     autoAnnMenu.add(showGroupConsensus);
1840     annotationsMenu.add(autoAnnMenu);
1841
1842     sort.add(sortIDMenuItem);
1843     sort.add(sortLengthMenuItem);
1844     sort.add(sortGroupMenuItem);
1845     sort.add(sortPairwiseMenuItem);
1846     sort.add(sortByTreeMenu);
1847     calculateMenu.add(sort);
1848     calculateMenu.add(calculateTree);
1849     calculateMenu.addSeparator();
1850     calculateMenu.add(pairwiseAlignmentMenuItem);
1851     calculateMenu.addSeparator();
1852     calculateMenu.add(showTranslation);
1853     calculateMenu.add(showReverse);
1854     calculateMenu.add(showReverseComplement);
1855     calculateMenu.add(showProducts);
1856     calculateMenu.add(autoCalculate);
1857     calculateMenu.add(sortByTree);
1858     calculateMenu.addSeparator();
1859     calculateMenu.add(expandAlignment);
1860     calculateMenu.add(extractScores);
1861     if (!Platform.isJS())
1862     {
1863       calculateMenu.addSeparator();
1864       calculateMenu.add(runGroovy);
1865     }
1866
1867     webServiceNoServices = new JMenuItem(
1868             MessageManager.getString("label.no_services"));
1869     webService.add(webServiceNoServices);
1870     if (!Platform.isJS())
1871     {
1872       exportImageMenu.add(htmlMenuItem);
1873     }
1874     exportImageMenu.add(epsFile);
1875     exportImageMenu.add(createPNG);
1876     if (!Platform.isJS())
1877     {
1878       exportImageMenu.add(createBioJS);
1879       exportImageMenu.add(createSVG);
1880     }
1881     addSequenceMenu.add(addFromFile);
1882     addSequenceMenu.add(addFromText);
1883     addSequenceMenu.add(addFromURL);
1884     this.getContentPane().add(statusPanel, java.awt.BorderLayout.SOUTH);
1885     statusPanel.add(statusBar, null);
1886     this.getContentPane().add(tabbedPane, java.awt.BorderLayout.CENTER);
1887
1888     formatMenu.add(font);
1889     formatMenu.addSeparator();
1890     formatMenu.add(wrapMenuItem);
1891     formatMenu.add(scaleAbove);
1892     formatMenu.add(scaleLeft);
1893     formatMenu.add(scaleRight);
1894     formatMenu.add(seqLimits);
1895     formatMenu.add(idRightAlign);
1896     formatMenu.add(hiddenMarkers);
1897     formatMenu.add(viewBoxesMenuItem);
1898     formatMenu.add(viewTextMenuItem);
1899     formatMenu.add(colourTextMenuItem);
1900     formatMenu.add(renderGapsMenuItem);
1901     formatMenu.add(centreColumnLabelsMenuItem);
1902     formatMenu.add(showNonconservedMenuItem);
1903     selectMenu.add(findMenuItem);
1904     selectMenu.addSeparator();
1905     selectMenu.add(selectAllSequenceMenuItem);
1906     selectMenu.add(deselectAllSequenceMenuItem);
1907     selectMenu.add(invertSequenceMenuItem);
1908     selectMenu.add(invertColSel);
1909     selectMenu.add(createGroup);
1910     selectMenu.add(unGroup);
1911     selectMenu.add(grpsFromSelection);
1912     selectMenu.add(deleteGroups);
1913     selectMenu.add(annotationColumn);
1914     selectMenu.add(selectHighlighted);
1915     // TODO - determine if the listenToViewSelections button is needed : see bug
1916     // JAL-574
1917     // selectMenu.addSeparator();
1918     // selectMenu.add(listenToViewSelections);
1919   }
1920
1921   protected void loadVcf_actionPerformed()
1922   {
1923   }
1924
1925   /**
1926    * Constructs the entries on the Colour menu (but does not add them to the
1927    * menu).
1928    */
1929   protected void initColourMenu()
1930   {
1931     applyToAllGroups = new JCheckBoxMenuItem(
1932             MessageManager.getString("label.apply_colour_to_all_groups"));
1933     applyToAllGroups.addActionListener(new ActionListener()
1934     {
1935       @Override
1936       public void actionPerformed(ActionEvent e)
1937       {
1938         applyToAllGroups_actionPerformed(applyToAllGroups.isSelected());
1939       }
1940     });
1941
1942     textColour = new JMenuItem(
1943             MessageManager.getString("label.text_colour"));
1944     textColour.addActionListener(new ActionListener()
1945     {
1946       @Override
1947       public void actionPerformed(ActionEvent e)
1948       {
1949         textColour_actionPerformed();
1950       }
1951     });
1952
1953     conservationMenuItem = new JCheckBoxMenuItem(
1954             MessageManager.getString("action.by_conservation"));
1955     conservationMenuItem.addActionListener(new ActionListener()
1956     {
1957       @Override
1958       public void actionPerformed(ActionEvent e)
1959       {
1960         conservationMenuItem_actionPerformed(
1961                 conservationMenuItem.isSelected());
1962       }
1963     });
1964
1965     abovePIDThreshold = new JCheckBoxMenuItem(
1966             MessageManager.getString("label.above_identity_threshold"));
1967     abovePIDThreshold.addActionListener(new ActionListener()
1968     {
1969       @Override
1970       public void actionPerformed(ActionEvent e)
1971       {
1972         abovePIDThreshold_actionPerformed(abovePIDThreshold.isSelected());
1973       }
1974     });
1975     modifyPID = new JMenuItem(
1976             MessageManager.getString("label.modify_identity_threshold"));
1977     modifyPID.addActionListener(new ActionListener()
1978     {
1979       @Override
1980       public void actionPerformed(ActionEvent e)
1981       {
1982         modifyPID_actionPerformed();
1983       }
1984     });
1985     modifyConservation = new JMenuItem(MessageManager
1986             .getString("label.modify_conservation_threshold"));
1987     modifyConservation.addActionListener(new ActionListener()
1988     {
1989       @Override
1990       public void actionPerformed(ActionEvent e)
1991       {
1992         modifyConservation_actionPerformed();
1993       }
1994     });
1995
1996     annotationColour = new JRadioButtonMenuItem(
1997             MessageManager.getString("action.by_annotation"));
1998     annotationColour.setName(ResidueColourScheme.ANNOTATION_COLOUR);
1999     annotationColour.addActionListener(new ActionListener()
2000     {
2001       @Override
2002       public void actionPerformed(ActionEvent e)
2003       {
2004         annotationColour_actionPerformed();
2005       }
2006     });
2007   }
2008
2009   protected void selectHighlightedColumns_actionPerformed(
2010           ActionEvent actionEvent)
2011   {
2012     // TODO Auto-generated method stub
2013
2014   }
2015
2016   /**
2017    * Generate the reverse sequence (or reverse complement if the flag is true)
2018    * and add it to the alignment
2019    * 
2020    * @param complement
2021    */
2022   protected void showReverse_actionPerformed(boolean complement)
2023   {
2024   }
2025
2026   /**
2027    * Try to run script in a Groovy console, having first ensured that this
2028    * alignframe is set as currentAlignFrame in Desktop
2029    */
2030   protected void runGroovy_actionPerformed()
2031   {
2032
2033   }
2034
2035   /**
2036    * Adds the given action listener and key accelerator to the given menu item.
2037    * Also saves in a lookup table to support lookup of action by key stroke.
2038    * 
2039    * @param keyStroke
2040    * @param menuItem
2041    * @param actionListener
2042    */
2043   protected void addMenuActionAndAccelerator(KeyStroke keyStroke,
2044           JMenuItem menuItem, ActionListener actionListener)
2045   {
2046     menuItem.setAccelerator(keyStroke);
2047     accelerators.put(keyStroke, menuItem);
2048     menuItem.addActionListener(actionListener);
2049   }
2050
2051   /**
2052    * Action on clicking sort annotations by type.
2053    * 
2054    * @param sortOrder
2055    */
2056   protected void sortAnnotations_actionPerformed()
2057   {
2058   }
2059
2060   /**
2061    * Action on clicking Show all annotations.
2062    * 
2063    * @param forSequences
2064    *          update sequence-related annotations
2065    * @param forAlignment
2066    *          update non-sequence-related annotations
2067    */
2068   protected void showAllAnnotations_actionPerformed(boolean forSequences,
2069           boolean forAlignment)
2070   {
2071     setAnnotationsVisibility(true, forSequences, forAlignment);
2072   }
2073
2074   /**
2075    * Action on clicking Hide all annotations.
2076    * 
2077    * @param forSequences
2078    *          update sequence-related annotations
2079    * @param forAlignment
2080    *          update non-sequence-related annotations
2081    */
2082   protected void hideAllAnnotations_actionPerformed(boolean forSequences,
2083           boolean forAlignment)
2084   {
2085     setAnnotationsVisibility(false, forSequences, forAlignment);
2086   }
2087
2088   /**
2089    * Set the visibility of annotations to true or false. Can act on
2090    * sequence-related annotations, or alignment-related, or both.
2091    * 
2092    * @param visible
2093    * @param forSequences
2094    *          update sequence-related annotations
2095    * @param forAlignment
2096    *          update non-sequence-related annotations
2097    */
2098   protected void setAnnotationsVisibility(boolean visible,
2099           boolean forSequences, boolean forAlignment)
2100   {
2101
2102   }
2103
2104   protected void normaliseSequenceLogo_actionPerformed(ActionEvent e)
2105   {
2106     // TODO Auto-generated method stub
2107
2108   }
2109
2110   protected void listenToViewSelections_actionPerformed(ActionEvent e)
2111   {
2112     // TODO Auto-generated method stub
2113
2114   }
2115
2116   protected void showAllhidden_actionPerformed(ActionEvent e)
2117   {
2118     // TODO Auto-generated method stub
2119
2120   }
2121
2122   protected void hideAllButSelection_actionPerformed(ActionEvent e)
2123   {
2124     // TODO Auto-generated method stub
2125
2126   }
2127
2128   protected void hideAllSelection_actionPerformed(ActionEvent e)
2129   {
2130     // TODO Auto-generated method stub
2131
2132   }
2133
2134   protected void applyAutoAnnotationSettings_actionPerformed(ActionEvent e)
2135   {
2136     // TODO Auto-generated method stub
2137
2138   }
2139
2140   protected void showConsensusHistogram_actionPerformed(ActionEvent e)
2141   {
2142     // TODO Auto-generated method stub
2143
2144   }
2145
2146   protected void showSequenceLogo_actionPerformed(ActionEvent e)
2147   {
2148     // TODO Auto-generated method stub
2149
2150   }
2151
2152   protected void makeGrpsFromSelection_actionPerformed(ActionEvent e)
2153   {
2154     // TODO Auto-generated method stub
2155
2156   }
2157
2158   protected void showGroupConsensus_actionPerformed(ActionEvent e)
2159   {
2160     // TODO Auto-generated method stub
2161
2162   }
2163
2164   protected void showGroupConservation_actionPerformed(ActionEvent e)
2165   {
2166     // TODO Auto-generated method stub
2167
2168   }
2169
2170   protected void showUnconservedMenuItem_actionPerformed(ActionEvent e)
2171   {
2172     // TODO Auto-generated method stub
2173
2174   }
2175
2176   protected void justifyRightMenuItem_actionPerformed(ActionEvent e)
2177   {
2178     // TODO Auto-generated method stub
2179
2180   }
2181
2182   protected void justifyLeftMenuItem_actionPerformed(ActionEvent e)
2183   {
2184     // TODO Auto-generated method stub
2185
2186   }
2187
2188   protected void followHighlight_actionPerformed()
2189   {
2190     // TODO Auto-generated method stub
2191
2192   }
2193
2194   protected void showNpFeats_actionPerformed(ActionEvent e)
2195   {
2196     // TODO Auto-generated method stub
2197
2198   }
2199
2200   protected void showDbRefs_actionPerformed(ActionEvent e)
2201   {
2202     // TODO Auto-generated method stub
2203
2204   }
2205
2206   protected void centreColumnLabels_actionPerformed(ActionEvent e)
2207   {
2208   }
2209
2210   protected void buildSortByAnnotationScoresMenu()
2211   {
2212   }
2213
2214   protected void extractScores_actionPerformed(ActionEvent e)
2215   {
2216   }
2217
2218   protected void outputText_actionPerformed(String formatName)
2219   {
2220   }
2221
2222   public void addFromFile_actionPerformed(ActionEvent e)
2223   {
2224
2225   }
2226
2227   public void addFromText_actionPerformed(ActionEvent e)
2228   {
2229
2230   }
2231
2232   public void addFromURL_actionPerformed(ActionEvent e)
2233   {
2234
2235   }
2236
2237   public void exportFeatures_actionPerformed(ActionEvent e)
2238   {
2239
2240   }
2241
2242   public void exportAnnotations_actionPerformed(ActionEvent e)
2243   {
2244
2245   }
2246
2247   protected void htmlMenuItem_actionPerformed(ActionEvent e)
2248   {
2249   }
2250
2251   protected void bioJSMenuItem_actionPerformed(ActionEvent e)
2252   {
2253
2254   }
2255
2256   protected void closeMenuItem_actionPerformed(boolean b)
2257   {
2258   }
2259
2260   protected void redoMenuItem_actionPerformed(ActionEvent e)
2261   {
2262   }
2263
2264   protected void undoMenuItem_actionPerformed(ActionEvent e)
2265   {
2266   }
2267
2268   protected void selectAllSequenceMenuItem_actionPerformed(ActionEvent e)
2269   {
2270   }
2271
2272   protected void deselectAllSequenceMenuItem_actionPerformed(ActionEvent e)
2273   {
2274   }
2275
2276   protected void invertSequenceMenuItem_actionPerformed(ActionEvent e)
2277   {
2278   }
2279
2280   protected void remove2LeftMenuItem_actionPerformed(ActionEvent e)
2281   {
2282   }
2283
2284   protected void remove2RightMenuItem_actionPerformed(ActionEvent e)
2285   {
2286   }
2287
2288   protected void removeGappedColumnMenuItem_actionPerformed(ActionEvent e)
2289   {
2290   }
2291
2292   protected void removeAllGapsMenuItem_actionPerformed(ActionEvent e)
2293   {
2294   }
2295
2296   protected void wrapMenuItem_actionPerformed(ActionEvent e)
2297   {
2298   }
2299
2300   protected void viewBoxesMenuItem_actionPerformed(ActionEvent e)
2301   {
2302   }
2303
2304   protected void viewTextMenuItem_actionPerformed(ActionEvent e)
2305   {
2306   }
2307
2308   protected void colourTextMenuItem_actionPerformed(ActionEvent e)
2309   {
2310   }
2311
2312   protected void annotationPanelMenuItem_actionPerformed(ActionEvent e)
2313   {
2314   }
2315
2316   protected void overviewMenuItem_actionPerformed(ActionEvent e)
2317   {
2318   }
2319
2320   protected void sortPairwiseMenuItem_actionPerformed(ActionEvent e)
2321   {
2322   }
2323
2324   protected void sortIDMenuItem_actionPerformed(ActionEvent e)
2325   {
2326   }
2327
2328   protected void sortLengthMenuItem_actionPerformed(ActionEvent e)
2329   {
2330   }
2331
2332   protected void sortGroupMenuItem_actionPerformed(ActionEvent e)
2333   {
2334   }
2335
2336   protected void removeRedundancyMenuItem_actionPerformed(ActionEvent e)
2337   {
2338   }
2339
2340   protected void pairwiseAlignmentMenuItem_actionPerformed(ActionEvent e)
2341   {
2342   }
2343
2344   protected void neighbourTreeMenuItem_actionPerformed(ActionEvent e)
2345   {
2346   }
2347
2348   protected void conservationMenuItem_actionPerformed(boolean selected)
2349   {
2350   }
2351
2352   protected void printMenuItem_actionPerformed(ActionEvent e)
2353   {
2354   }
2355
2356   protected void renderGapsMenuItem_actionPerformed(ActionEvent e)
2357   {
2358   }
2359
2360   protected void findMenuItem_actionPerformed(ActionEvent e)
2361   {
2362   }
2363
2364   protected void abovePIDThreshold_actionPerformed(boolean selected)
2365   {
2366   }
2367
2368   public void showSeqFeatures_actionPerformed(ActionEvent actionEvent)
2369   {
2370   }
2371
2372   protected void deleteGroups_actionPerformed(ActionEvent e)
2373   {
2374   }
2375
2376   protected void createGroup_actionPerformed(ActionEvent e)
2377   {
2378   }
2379
2380   protected void unGroup_actionPerformed(ActionEvent e)
2381   {
2382   }
2383
2384   protected void copy_actionPerformed()
2385   {
2386   }
2387
2388   protected void cut_actionPerformed()
2389   {
2390   }
2391
2392   protected void delete_actionPerformed()
2393   {
2394   }
2395
2396   protected void pasteNew_actionPerformed(ActionEvent e)
2397   {
2398   }
2399
2400   protected void pasteThis_actionPerformed(ActionEvent e)
2401   {
2402   }
2403
2404   protected void applyToAllGroups_actionPerformed(boolean selected)
2405   {
2406   }
2407
2408   public void createPNG(java.io.File f)
2409   {
2410   }
2411
2412   protected void font_actionPerformed(ActionEvent e)
2413   {
2414   }
2415
2416   protected void seqLimit_actionPerformed(ActionEvent e)
2417   {
2418   }
2419
2420   public void seqDBRef_actionPerformed(ActionEvent e)
2421   {
2422
2423   }
2424
2425   public void createEPS(java.io.File f)
2426   {
2427   }
2428
2429   public void createSVG(java.io.File f)
2430   {
2431
2432   }
2433
2434   protected void loadTreeMenuItem_actionPerformed(ActionEvent e)
2435   {
2436
2437   }
2438
2439   /**
2440    * Template method to handle the 'load T-Coffee scores' menu event.
2441    * <p>
2442    * Subclasses override this method to provide a custom action.
2443    * 
2444    * @param event
2445    *          The raised event
2446    */
2447   protected void loadScores_actionPerformed(ActionEvent event)
2448   {
2449
2450   }
2451
2452   protected void jpred_actionPerformed(ActionEvent e)
2453   {
2454   }
2455
2456   protected void scaleAbove_actionPerformed(ActionEvent e)
2457   {
2458   }
2459
2460   protected void scaleLeft_actionPerformed(ActionEvent e)
2461   {
2462   }
2463
2464   protected void scaleRight_actionPerformed(ActionEvent e)
2465   {
2466   }
2467
2468   protected void modifyPID_actionPerformed()
2469   {
2470   }
2471
2472   protected void modifyConservation_actionPerformed()
2473   {
2474   }
2475
2476   protected void saveAs_actionPerformed()
2477   {
2478   }
2479
2480   protected void padGapsMenuitem_actionPerformed(ActionEvent e)
2481   {
2482   }
2483
2484   public void vamsasStore_actionPerformed(ActionEvent e)
2485   {
2486
2487   }
2488
2489   public void vamsasLoad_actionPerformed(ActionEvent e)
2490   {
2491
2492   }
2493
2494   public void showTranslation_actionPerformed(GeneticCodeI codeTable)
2495   {
2496
2497   }
2498
2499   public void featureSettings_actionPerformed(ActionEvent e)
2500   {
2501
2502   }
2503
2504   public void fetchSequence_actionPerformed()
2505   {
2506
2507   }
2508
2509   public void smoothFont_actionPerformed(ActionEvent e)
2510   {
2511
2512   }
2513
2514   public void annotationColour_actionPerformed()
2515   {
2516   }
2517
2518   public void annotationColumn_actionPerformed(ActionEvent e)
2519   {
2520   }
2521
2522   public void associatedData_actionPerformed(ActionEvent e)
2523   {
2524
2525   }
2526
2527   public void autoCalculate_actionPerformed(ActionEvent e)
2528   {
2529
2530   }
2531
2532   public void sortByTreeOption_actionPerformed(ActionEvent e)
2533   {
2534
2535   }
2536
2537   public void showAllSeqs_actionPerformed(ActionEvent e)
2538   {
2539
2540   }
2541
2542   public void showAllColumns_actionPerformed(ActionEvent e)
2543   {
2544
2545   }
2546
2547   public void hideSelSequences_actionPerformed(ActionEvent e)
2548   {
2549
2550   }
2551
2552   public void hideSelColumns_actionPerformed(ActionEvent e)
2553   {
2554
2555   }
2556
2557   public void hiddenMarkers_actionPerformed(ActionEvent e)
2558   {
2559
2560   }
2561
2562   public void findPdbId_actionPerformed(ActionEvent e)
2563   {
2564
2565   }
2566
2567   public void enterPdbId_actionPerformed(ActionEvent e)
2568   {
2569
2570   }
2571
2572   public void pdbFile_actionPerformed(ActionEvent e)
2573   {
2574
2575   }
2576
2577   public void invertColSel_actionPerformed(ActionEvent e)
2578   {
2579
2580   }
2581
2582   public void tabSelectionChanged(int sel)
2583   {
2584
2585   }
2586
2587   public void tabbedPane_mousePressed(MouseEvent e)
2588   {
2589
2590   }
2591
2592   public void tabbedPane_focusGained(FocusEvent e)
2593   {
2594     requestFocus();
2595   }
2596
2597   public void save_actionPerformed(ActionEvent e)
2598   {
2599
2600   }
2601
2602   public void reload_actionPerformed(ActionEvent e)
2603   {
2604
2605   }
2606
2607   public void newView_actionPerformed(ActionEvent e)
2608   {
2609
2610   }
2611
2612   public void textColour_actionPerformed()
2613   {
2614
2615   }
2616
2617   public void idRightAlign_actionPerformed(ActionEvent e)
2618   {
2619
2620   }
2621
2622   public void expandViews_actionPerformed(ActionEvent e)
2623   {
2624
2625   }
2626
2627   public void gatherViews_actionPerformed(ActionEvent e)
2628   {
2629
2630   }
2631
2632   public void buildTreeSortMenu()
2633   {
2634
2635   }
2636
2637   public void pageSetup_actionPerformed(ActionEvent e)
2638   {
2639
2640   }
2641
2642   public void alignmentProperties()
2643   {
2644
2645   }
2646
2647   protected void expand_newalign(ActionEvent e)
2648   {
2649     // TODO Auto-generated method stub
2650
2651   }
2652
2653   protected boolean isShowAutoCalculatedAbove()
2654   {
2655     return showAutoCalculatedAbove;
2656   }
2657
2658   protected void setShowAutoCalculatedAbove(boolean showAutoCalculatedAbove)
2659   {
2660     this.showAutoCalculatedAbove = showAutoCalculatedAbove;
2661   }
2662
2663   protected SequenceAnnotationOrder getAnnotationSortOrder()
2664   {
2665     return annotationSortOrder;
2666   }
2667
2668   protected void setAnnotationSortOrder(
2669           SequenceAnnotationOrder annotationSortOrder)
2670   {
2671     this.annotationSortOrder = annotationSortOrder;
2672   }
2673
2674   public Map<KeyStroke, JMenuItem> getAccelerators()
2675   {
2676     return this.accelerators;
2677   }
2678
2679   /**
2680    * Returns the selected index of the tabbed pane, or -1 if none selected
2681    * (including the case where the tabbed pane has not been made visible).
2682    * 
2683    * @return
2684    */
2685   public int getTabIndex()
2686   {
2687     return tabbedPane.getSelectedIndex();
2688   }
2689
2690   public JPanel getStatusPanel()
2691   {
2692     return statusPanel;
2693   }
2694
2695   /**
2696    * Sets a reference to the containing split frame. Also makes the 'toggle
2697    * split view' menu item visible and checked.
2698    * 
2699    * @param sf
2700    */
2701   public void setSplitFrame(SplitContainerI sf)
2702   {
2703     this.splitFrame = sf;
2704     if (sf != null)
2705     {
2706       this.showComplementMenuItem.setVisible(true);
2707       this.showComplementMenuItem.setState(true);
2708     }
2709   }
2710
2711   public SplitContainerI getSplitViewContainer()
2712   {
2713     return this.splitFrame;
2714   }
2715
2716   protected void showComplement_actionPerformed(boolean complement)
2717   {
2718   }
2719 }