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