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