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