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