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