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