Jalview.isJS() --> Platform.isJS(), DBRefEntry[] --> List<DBRefEntry>
[jalview.git] / src / jalview / jbgui / GAlignFrame.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3  * Copyright (C) $$Year-Rel$$ The Jalview Authors
4  * 
5  * This file is part of Jalview.
6  * 
7  * Jalview is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License 
9  * as published by the Free Software Foundation, either version 3
10  * of the License, or (at your option) any later version.
11  *  
12  * Jalview is distributed in the hope that it will be useful, but 
13  * WITHOUT ANY WARRANTY; without even the implied warranty 
14  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15  * PURPOSE.  See the GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
19  * The Jalview Authors are detailed in the 'AUTHORS' file.
20  */
21 package jalview.jbgui;
22
23 import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
24 import jalview.api.SplitContainerI;
25 import jalview.bin.Cache;
26 import jalview.gui.JvSwingUtils;
27 import jalview.gui.Preferences;
28 import jalview.io.FileFormats;
29 import jalview.util.MessageManager;
30 import jalview.util.Platform;
31
32 import java.awt.BorderLayout;
33 import java.awt.Color;
34 import java.awt.GridLayout;
35 import java.awt.Toolkit;
36 import java.awt.event.ActionEvent;
37 import java.awt.event.ActionListener;
38 import java.awt.event.FocusAdapter;
39 import java.awt.event.FocusEvent;
40 import java.awt.event.KeyEvent;
41 import java.awt.event.MouseAdapter;
42 import java.awt.event.MouseEvent;
43 import java.util.HashMap;
44 import java.util.Map;
45
46 import javax.swing.BorderFactory;
47 import javax.swing.ButtonGroup;
48 import javax.swing.JCheckBoxMenuItem;
49 import javax.swing.JInternalFrame;
50 import javax.swing.JLabel;
51 import javax.swing.JMenu;
52 import javax.swing.JMenuBar;
53 import javax.swing.JMenuItem;
54 import javax.swing.JPanel;
55 import javax.swing.JRadioButtonMenuItem;
56 import javax.swing.JTabbedPane;
57 import javax.swing.KeyStroke;
58 import javax.swing.event.ChangeEvent;
59 import javax.swing.event.MenuEvent;
60 import javax.swing.event.MenuListener;
61
62 public class GAlignFrame extends JInternalFrame
63 {
64   protected JMenuBar alignFrameMenuBar = new JMenuBar();
65
66   protected JMenuItem closeMenuItem = new JMenuItem();
67
68   protected JMenu webService = new JMenu();
69
70   protected JMenuItem webServiceNoServices;
71
72   protected JCheckBoxMenuItem viewBoxesMenuItem = new JCheckBoxMenuItem();
73
74   protected JCheckBoxMenuItem viewTextMenuItem = new JCheckBoxMenuItem();
75
76   protected JMenu sortByAnnotScore = new JMenu();
77
78   public JLabel statusBar = new JLabel();
79
80   protected JMenu outputTextboxMenu = new JMenu();
81
82   protected JCheckBoxMenuItem annotationPanelMenuItem = new JCheckBoxMenuItem();
83
84   protected JCheckBoxMenuItem colourTextMenuItem = new JCheckBoxMenuItem();
85
86   protected JCheckBoxMenuItem showNonconservedMenuItem = new JCheckBoxMenuItem();
87
88   protected JMenuItem undoMenuItem = new JMenuItem();
89
90   protected JMenuItem redoMenuItem = new JMenuItem();
91
92   protected JCheckBoxMenuItem wrapMenuItem = new JCheckBoxMenuItem();
93
94   protected JCheckBoxMenuItem renderGapsMenuItem = new JCheckBoxMenuItem();
95
96   public JCheckBoxMenuItem showSeqFeatures = new JCheckBoxMenuItem();
97
98   JMenuItem copy = new JMenuItem();
99
100   JMenuItem cut = new JMenuItem();
101
102   JMenu pasteMenu = new JMenu();
103
104   protected JCheckBoxMenuItem seqLimits = new JCheckBoxMenuItem();
105
106   protected JCheckBoxMenuItem scaleAbove = new JCheckBoxMenuItem();
107
108   protected JCheckBoxMenuItem scaleLeft = new JCheckBoxMenuItem();
109
110   protected JCheckBoxMenuItem scaleRight = new JCheckBoxMenuItem();
111
112   protected JCheckBoxMenuItem applyToAllGroups;
113
114   protected JMenu colourMenu = new JMenu();
115
116   protected JMenuItem textColour;
117
118   protected JCheckBoxMenuItem conservationMenuItem;
119
120   protected JMenuItem modifyConservation;
121
122   protected JCheckBoxMenuItem abovePIDThreshold;
123
124   protected JMenuItem modifyPID;
125
126   protected JMenuItem annotationColour;
127
128   protected JMenu sortByTreeMenu = new JMenu();
129
130   protected JMenu sort = new JMenu();
131
132   protected JMenuItem calculateTree = new JMenuItem();
133
134   protected JCheckBoxMenuItem padGapsMenuitem = new JCheckBoxMenuItem();
135
136   protected JCheckBoxMenuItem showNpFeatsMenuitem = new JCheckBoxMenuItem();
137
138   protected JCheckBoxMenuItem showDbRefsMenuitem = new JCheckBoxMenuItem();
139
140   protected JMenuItem showTranslation = new JMenuItem();
141
142   protected JMenuItem showReverse = new JMenuItem();
143
144   protected JMenuItem showReverseComplement = new JMenuItem();
145
146   protected JMenu showProducts = new JMenu();
147
148   protected JMenuItem runGroovy = new JMenuItem();
149
150   protected JMenuItem loadVcf;
151
152   protected JCheckBoxMenuItem autoCalculate = new JCheckBoxMenuItem();
153
154   protected JCheckBoxMenuItem sortByTree = new JCheckBoxMenuItem();
155
156   protected JCheckBoxMenuItem listenToViewSelections = new JCheckBoxMenuItem();
157
158   protected JPanel statusPanel = new JPanel();
159
160   protected JMenuItem showAllSeqAnnotations = new JMenuItem();
161
162   protected JMenuItem hideAllSeqAnnotations = new JMenuItem();
163
164   protected JMenuItem showAllAlAnnotations = new JMenuItem();
165
166   protected JMenuItem hideAllAlAnnotations = new JMenuItem();
167
168   protected JCheckBoxMenuItem showComplementMenuItem = new JCheckBoxMenuItem();
169
170   protected JCheckBoxMenuItem hiddenMarkers = new JCheckBoxMenuItem();
171
172   protected JTabbedPane tabbedPane = jalview.jbgui.GDesktop.createTabbedPane();
173
174   protected JMenuItem reload = new JMenuItem();
175
176   protected JMenu formatMenu = new JMenu();
177
178   protected JCheckBoxMenuItem idRightAlign = new JCheckBoxMenuItem();
179
180   protected JCheckBoxMenuItem centreColumnLabelsMenuItem = new JCheckBoxMenuItem();
181
182   protected JCheckBoxMenuItem followHighlightMenuItem = new JCheckBoxMenuItem();
183
184   protected JMenuItem gatherViews = new JMenuItem();
185
186   protected JMenuItem expandViews = new JMenuItem();
187
188   protected JCheckBoxMenuItem showGroupConsensus = new JCheckBoxMenuItem();
189
190   protected JCheckBoxMenuItem showGroupConservation = new JCheckBoxMenuItem();
191
192   protected JCheckBoxMenuItem showConsensusHistogram = new JCheckBoxMenuItem();
193
194   protected JCheckBoxMenuItem showSequenceLogo = new JCheckBoxMenuItem();
195
196   protected JCheckBoxMenuItem normaliseSequenceLogo = new JCheckBoxMenuItem();
197
198   protected JCheckBoxMenuItem applyAutoAnnotationSettings = new JCheckBoxMenuItem();
199   
200   protected JMenuItem openFeatureSettings;
201
202   private SequenceAnnotationOrder annotationSortOrder;
203
204   private boolean showAutoCalculatedAbove = false;
205
206   private Map<KeyStroke, JMenuItem> accelerators = new HashMap<KeyStroke, JMenuItem>();
207
208   private SplitContainerI splitFrame;
209
210   public GAlignFrame()
211   {
212     try
213     {
214       jbInit();
215       setJMenuBar(alignFrameMenuBar);
216
217       // dynamically fill save as menu with available formats
218       for (String ff : FileFormats.getInstance().getWritableFormats(true))
219       {
220         JMenuItem item = new JMenuItem(ff);
221
222         item.addActionListener(new ActionListener()
223         {
224           @Override
225           public void actionPerformed(ActionEvent e)
226           {
227             outputText_actionPerformed(e.getActionCommand());
228           }
229         });
230
231         outputTextboxMenu.add(item);
232       }
233     } catch (Exception e)
234     {
235       System.err.println(e.toString());
236     }
237
238     if (Platform.allowMnemonics()) // was "not mac and not JS"
239     {
240       closeMenuItem.setMnemonic('C');
241       outputTextboxMenu.setMnemonic('T');
242       undoMenuItem.setMnemonic('Z');
243       redoMenuItem.setMnemonic('0');
244       copy.setMnemonic('C');
245       cut.setMnemonic('U');
246       pasteMenu.setMnemonic('P');
247       reload.setMnemonic('R');
248     }
249   }
250
251   private void jbInit() throws Exception
252   {
253     initColourMenu();
254
255     JMenuItem saveAs = new JMenuItem(
256             MessageManager.getString("action.save_as"));
257     ActionListener al = new ActionListener()
258     {
259       @Override
260       public void actionPerformed(ActionEvent e)
261       {
262         saveAs_actionPerformed();
263       }
264     };
265
266     // FIXME getDefaultToolkit throws an exception in Headless mode
267     KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_S,
268             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()
269                     | KeyEvent.SHIFT_MASK,
270             false);
271     addMenuActionAndAccelerator(keyStroke, saveAs, al);
272
273     closeMenuItem.setText(MessageManager.getString("action.close"));
274     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_W,
275             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
276     al = new ActionListener()
277     {
278       @Override
279       public void actionPerformed(ActionEvent e)
280       {
281         closeMenuItem_actionPerformed(false);
282       }
283     };
284     addMenuActionAndAccelerator(keyStroke, closeMenuItem, al);
285
286     JMenu editMenu = new JMenu(MessageManager.getString("action.edit"));
287     JMenu viewMenu = new JMenu(MessageManager.getString("action.view"));
288     JMenu annotationsMenu = new JMenu(
289             MessageManager.getString("action.annotations"));
290     JMenu showMenu = new JMenu(MessageManager.getString("action.show"));
291     colourMenu.setText(MessageManager.getString("action.colour"));
292     JMenu calculateMenu = new JMenu(
293             MessageManager.getString("action.calculate"));
294     webService.setText(MessageManager.getString("action.web_service"));
295     JMenuItem selectAllSequenceMenuItem = new JMenuItem(
296             MessageManager.getString("action.select_all"));
297     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_A,
298             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
299     al = new ActionListener()
300     {
301       @Override
302       public void actionPerformed(ActionEvent e)
303       {
304         selectAllSequenceMenuItem_actionPerformed(e);
305       }
306     };
307     addMenuActionAndAccelerator(keyStroke, selectAllSequenceMenuItem, al);
308
309     JMenuItem deselectAllSequenceMenuItem = new JMenuItem(
310             MessageManager.getString("action.deselect_all"));
311     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false);
312     al = new ActionListener()
313     {
314       @Override
315       public void actionPerformed(ActionEvent e)
316       {
317         deselectAllSequenceMenuItem_actionPerformed(e);
318       }
319     };
320     addMenuActionAndAccelerator(keyStroke, deselectAllSequenceMenuItem, al);
321
322     JMenuItem invertSequenceMenuItem = new JMenuItem(
323             MessageManager.getString("action.invert_sequence_selection"));
324     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_I,
325             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
326     al = new ActionListener()
327     {
328       @Override
329       public void actionPerformed(ActionEvent e)
330       {
331         invertSequenceMenuItem_actionPerformed(e);
332       }
333     };
334     addMenuActionAndAccelerator(keyStroke, invertSequenceMenuItem, al);
335
336     JMenuItem grpsFromSelection = new JMenuItem(
337             MessageManager.getString("action.make_groups_selection"));
338     grpsFromSelection.addActionListener(new ActionListener()
339     {
340       @Override
341       public void actionPerformed(ActionEvent e)
342       {
343         makeGrpsFromSelection_actionPerformed(e);
344       }
345     });
346     JMenuItem expandAlignment = new JMenuItem(
347             MessageManager.getString("action.view_flanking_regions"));
348     expandAlignment.setToolTipText(
349             MessageManager.getString("label.view_flanking_regions"));
350     expandAlignment.addActionListener(new ActionListener()
351     {
352       @Override
353       public void actionPerformed(ActionEvent e)
354       {
355         expand_newalign(e);
356       }
357     });
358     JMenuItem remove2LeftMenuItem = new JMenuItem(
359             MessageManager.getString("action.remove_left"));
360     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_L,
361             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
362     al = new ActionListener()
363     {
364       @Override
365       public void actionPerformed(ActionEvent e)
366       {
367         remove2LeftMenuItem_actionPerformed(e);
368       }
369     };
370     addMenuActionAndAccelerator(keyStroke, remove2LeftMenuItem, al);
371
372     JMenuItem remove2RightMenuItem = new JMenuItem(
373             MessageManager.getString("action.remove_right"));
374     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_R,
375             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
376     al = new ActionListener()
377     {
378       @Override
379       public void actionPerformed(ActionEvent e)
380       {
381         remove2RightMenuItem_actionPerformed(e);
382       }
383     };
384     addMenuActionAndAccelerator(keyStroke, remove2RightMenuItem, al);
385
386     JMenuItem removeGappedColumnMenuItem = new JMenuItem(
387             MessageManager.getString("action.remove_empty_columns"));
388     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_E,
389             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
390     al = new ActionListener()
391     {
392       @Override
393       public void actionPerformed(ActionEvent e)
394       {
395         removeGappedColumnMenuItem_actionPerformed(e);
396       }
397     };
398     addMenuActionAndAccelerator(keyStroke, removeGappedColumnMenuItem, al);
399
400     JMenuItem removeAllGapsMenuItem = new JMenuItem(
401             MessageManager.getString("action.remove_all_gaps"));
402     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_E,
403             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()
404                     | KeyEvent.SHIFT_MASK,
405             false);
406     al = new ActionListener()
407     {
408       @Override
409       public void actionPerformed(ActionEvent e)
410       {
411         removeAllGapsMenuItem_actionPerformed(e);
412       }
413     };
414     addMenuActionAndAccelerator(keyStroke, removeAllGapsMenuItem, al);
415
416     JMenuItem justifyLeftMenuItem = new JMenuItem(
417             MessageManager.getString("action.left_justify_alignment"));
418     justifyLeftMenuItem.addActionListener(new ActionListener()
419     {
420       @Override
421       public void actionPerformed(ActionEvent e)
422       {
423         justifyLeftMenuItem_actionPerformed(e);
424       }
425     });
426     JMenuItem justifyRightMenuItem = new JMenuItem(
427             MessageManager.getString("action.right_justify_alignment"));
428     justifyRightMenuItem.addActionListener(new ActionListener()
429     {
430       @Override
431       public void actionPerformed(ActionEvent e)
432       {
433         justifyRightMenuItem_actionPerformed(e);
434       }
435     });
436     viewBoxesMenuItem.setText(MessageManager.getString("action.boxes"));
437     viewBoxesMenuItem.setState(true);
438     viewBoxesMenuItem.addActionListener(new ActionListener()
439     {
440       @Override
441       public void actionPerformed(ActionEvent e)
442       {
443         viewBoxesMenuItem_actionPerformed(e);
444       }
445     });
446     viewTextMenuItem.setText(MessageManager.getString("action.text"));
447     viewTextMenuItem.setState(true);
448     viewTextMenuItem.addActionListener(new ActionListener()
449     {
450       @Override
451       public void actionPerformed(ActionEvent e)
452       {
453         viewTextMenuItem_actionPerformed(e);
454       }
455     });
456     showNonconservedMenuItem
457             .setText(MessageManager.getString("label.show_non_conserved"));
458     showNonconservedMenuItem.setState(false);
459     showNonconservedMenuItem.addActionListener(new ActionListener()
460     {
461       @Override
462       public void actionPerformed(ActionEvent e)
463       {
464         showUnconservedMenuItem_actionPerformed(e);
465       }
466     });
467     JMenuItem sortPairwiseMenuItem = new JMenuItem(
468             MessageManager.getString("action.by_pairwise_id"));
469     sortPairwiseMenuItem.addActionListener(new ActionListener()
470     {
471       @Override
472       public void actionPerformed(ActionEvent e)
473       {
474         sortPairwiseMenuItem_actionPerformed(e);
475       }
476     });
477     JMenuItem sortIDMenuItem = new JMenuItem(
478             MessageManager.getString("action.by_id"));
479     sortIDMenuItem.addActionListener(new ActionListener()
480     {
481       @Override
482       public void actionPerformed(ActionEvent e)
483       {
484         sortIDMenuItem_actionPerformed(e);
485       }
486     });
487     JMenuItem sortLengthMenuItem = new JMenuItem(
488             MessageManager.getString("action.by_length"));
489     sortLengthMenuItem.addActionListener(new ActionListener()
490     {
491       @Override
492       public void actionPerformed(ActionEvent e)
493       {
494         sortLengthMenuItem_actionPerformed(e);
495       }
496     });
497     JMenuItem sortGroupMenuItem = new JMenuItem(
498             MessageManager.getString("action.by_group"));
499     sortGroupMenuItem.addActionListener(new ActionListener()
500     {
501       @Override
502       public void actionPerformed(ActionEvent e)
503       {
504         sortGroupMenuItem_actionPerformed(e);
505       }
506     });
507
508     JMenuItem removeRedundancyMenuItem = new JMenuItem(
509             MessageManager.getString("action.remove_redundancy"));
510     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_D,
511             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
512     al = new ActionListener()
513     {
514       @Override
515       public void actionPerformed(ActionEvent e)
516       {
517         removeRedundancyMenuItem_actionPerformed(e);
518       }
519     };
520     addMenuActionAndAccelerator(keyStroke, removeRedundancyMenuItem, al);
521
522     JMenuItem pairwiseAlignmentMenuItem = new JMenuItem(
523             MessageManager.getString("action.pairwise_alignment"));
524     pairwiseAlignmentMenuItem.addActionListener(new ActionListener()
525     {
526       @Override
527       public void actionPerformed(ActionEvent e)
528       {
529         pairwiseAlignmentMenuItem_actionPerformed(e);
530       }
531     });
532
533     this.getContentPane().setLayout(new BorderLayout());
534     alignFrameMenuBar.setFont(new java.awt.Font("Verdana", 0, 11));
535     statusBar.setBackground(Color.white);
536     statusBar.setFont(new java.awt.Font("Verdana", 0, 11));
537     statusBar.setBorder(BorderFactory.createLineBorder(Color.black));
538     statusBar.setText(MessageManager.getString("label.status_bar"));
539     outputTextboxMenu
540             .setText(MessageManager.getString("label.out_to_textbox"));
541
542     annotationPanelMenuItem.setActionCommand("");
543     annotationPanelMenuItem
544             .setText(MessageManager.getString("label.show_annotations"));
545     annotationPanelMenuItem
546             .setState(Cache.getDefault("SHOW_ANNOTATIONS", true));
547     annotationPanelMenuItem.addActionListener(new ActionListener()
548     {
549       @Override
550       public void actionPerformed(ActionEvent e)
551       {
552         annotationPanelMenuItem_actionPerformed(e);
553       }
554     });
555     showAllAlAnnotations.setText(
556             MessageManager.getString("label.show_all_al_annotations"));
557     final boolean isAnnotationPanelShown = annotationPanelMenuItem
558             .getState();
559     showAllAlAnnotations.setEnabled(isAnnotationPanelShown);
560     showAllAlAnnotations.addActionListener(new ActionListener()
561     {
562       @Override
563       public void actionPerformed(ActionEvent e)
564       {
565         showAllAnnotations_actionPerformed(false, true);
566       }
567     });
568     hideAllAlAnnotations.setText(
569             MessageManager.getString("label.hide_all_al_annotations"));
570     hideAllAlAnnotations.setEnabled(isAnnotationPanelShown);
571     hideAllAlAnnotations.addActionListener(new ActionListener()
572     {
573       @Override
574       public void actionPerformed(ActionEvent e)
575       {
576         hideAllAnnotations_actionPerformed(false, true);
577       }
578     });
579     showAllSeqAnnotations.setText(
580             MessageManager.getString("label.show_all_seq_annotations"));
581     showAllSeqAnnotations.setEnabled(isAnnotationPanelShown);
582     showAllSeqAnnotations.addActionListener(new ActionListener()
583     {
584       @Override
585       public void actionPerformed(ActionEvent e)
586       {
587         showAllAnnotations_actionPerformed(true, false);
588       }
589     });
590     hideAllSeqAnnotations.setText(
591             MessageManager.getString("label.hide_all_seq_annotations"));
592     hideAllSeqAnnotations.setEnabled(isAnnotationPanelShown);
593     hideAllSeqAnnotations.addActionListener(new ActionListener()
594     {
595       @Override
596       public void actionPerformed(ActionEvent e)
597       {
598         hideAllAnnotations_actionPerformed(true, false);
599       }
600     });
601     SequenceAnnotationOrder sortAnnotationsBy = SequenceAnnotationOrder
602             .valueOf(Cache.getDefault(Preferences.SORT_ANNOTATIONS,
603                     SequenceAnnotationOrder.NONE.name()));
604     final JCheckBoxMenuItem sortAnnBySequence = new JCheckBoxMenuItem(
605             MessageManager.getString("label.sort_annotations_by_sequence"));
606     final JCheckBoxMenuItem sortAnnByLabel = new JCheckBoxMenuItem(
607             MessageManager.getString("label.sort_annotations_by_label"));
608
609     sortAnnBySequence.setSelected(
610             sortAnnotationsBy == SequenceAnnotationOrder.SEQUENCE_AND_LABEL);
611     sortAnnBySequence.addActionListener(new ActionListener()
612     {
613       @Override
614       public void actionPerformed(ActionEvent e)
615       {
616         boolean newState = sortAnnBySequence.getState();
617         sortAnnByLabel.setSelected(false);
618         setAnnotationSortOrder(
619                 newState ? SequenceAnnotationOrder.SEQUENCE_AND_LABEL
620                         : SequenceAnnotationOrder.NONE);
621         sortAnnotations_actionPerformed();
622       }
623     });
624     sortAnnByLabel.setSelected(
625             sortAnnotationsBy == SequenceAnnotationOrder.LABEL_AND_SEQUENCE);
626     sortAnnByLabel.addActionListener(new ActionListener()
627     {
628       @Override
629       public void actionPerformed(ActionEvent e)
630       {
631         boolean newState = sortAnnByLabel.getState();
632         sortAnnBySequence.setSelected(false);
633         setAnnotationSortOrder(
634                 newState ? SequenceAnnotationOrder.LABEL_AND_SEQUENCE
635                         : SequenceAnnotationOrder.NONE);
636         sortAnnotations_actionPerformed();
637       }
638     });
639     colourTextMenuItem = new JCheckBoxMenuItem(
640             MessageManager.getString("label.colour_text"));
641     colourTextMenuItem.addActionListener(new ActionListener()
642     {
643       @Override
644       public void actionPerformed(ActionEvent e)
645       {
646         colourTextMenuItem_actionPerformed(e);
647       }
648     });
649
650     JMenuItem htmlMenuItem = new JMenuItem(
651             MessageManager.getString("label.html"));
652     htmlMenuItem.addActionListener(new ActionListener()
653     {
654       @Override
655       public void actionPerformed(ActionEvent e)
656       {
657         htmlMenuItem_actionPerformed(e);
658       }
659     });
660
661     JMenuItem createBioJS = new JMenuItem(
662             MessageManager.getString("label.biojs_html_export"));
663     createBioJS.addActionListener(new java.awt.event.ActionListener()
664     {
665       @Override
666       public void actionPerformed(ActionEvent e)
667       {
668         bioJSMenuItem_actionPerformed(e);
669       }
670     });
671
672     JMenuItem overviewMenuItem = new JMenuItem(
673             MessageManager.getString("label.overview_window"));
674     overviewMenuItem.addActionListener(new ActionListener()
675     {
676       @Override
677       public void actionPerformed(ActionEvent e)
678       {
679         overviewMenuItem_actionPerformed(e);
680       }
681     });
682
683     undoMenuItem.setEnabled(false);
684     undoMenuItem.setText(MessageManager.getString("action.undo"));
685     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_Z,
686             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
687     al = new ActionListener()
688     {
689       @Override
690       public void actionPerformed(ActionEvent e)
691       {
692         undoMenuItem_actionPerformed(e);
693       }
694     };
695     addMenuActionAndAccelerator(keyStroke, undoMenuItem, al);
696
697     redoMenuItem.setEnabled(false);
698     redoMenuItem.setText(MessageManager.getString("action.redo"));
699     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_Y,
700             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
701     al = new ActionListener()
702     {
703       @Override
704       public void actionPerformed(ActionEvent e)
705       {
706         redoMenuItem_actionPerformed(e);
707       }
708     };
709     addMenuActionAndAccelerator(keyStroke, redoMenuItem, al);
710
711     wrapMenuItem.setText(MessageManager.getString("label.wrap"));
712     wrapMenuItem.addActionListener(new ActionListener()
713     {
714       @Override
715       public void actionPerformed(ActionEvent e)
716       {
717         wrapMenuItem_actionPerformed(e);
718       }
719     });
720
721     JMenuItem printMenuItem = new JMenuItem(
722             MessageManager.getString("action.print"));
723     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_P,
724             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
725     al = new ActionListener()
726     {
727       @Override
728       public void actionPerformed(ActionEvent e)
729       {
730         printMenuItem_actionPerformed(e);
731       }
732     };
733     addMenuActionAndAccelerator(keyStroke, printMenuItem, al);
734
735     renderGapsMenuItem
736             .setText(MessageManager.getString("action.show_gaps"));
737     renderGapsMenuItem.setState(true);
738     renderGapsMenuItem.addActionListener(new ActionListener()
739     {
740       @Override
741       public void actionPerformed(ActionEvent e)
742       {
743         renderGapsMenuItem_actionPerformed(e);
744       }
745     });
746
747     JMenuItem findMenuItem = new JMenuItem(
748             MessageManager.getString("action.find"));
749     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_F,
750             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
751     findMenuItem.setToolTipText(JvSwingUtils.wrapTooltip(true,
752             MessageManager.getString("label.find_tip")));
753     al = new ActionListener()
754     {
755       @Override
756       public void actionPerformed(ActionEvent e)
757       {
758         findMenuItem_actionPerformed(e);
759       }
760     };
761     addMenuActionAndAccelerator(keyStroke, findMenuItem, al);
762
763     showSeqFeatures.setText(
764             MessageManager.getString("label.show_sequence_features"));
765     showSeqFeatures.addActionListener(new ActionListener()
766     {
767       @Override
768       public void actionPerformed(ActionEvent actionEvent)
769       {
770         showSeqFeatures_actionPerformed(actionEvent);
771       }
772     });
773     /*
774      * showSeqFeaturesHeight.setText("Vary Sequence Feature Height");
775      * showSeqFeaturesHeight.addActionListener(new ActionListener() { public
776      * void actionPerformed(ActionEvent actionEvent) {
777      * showSeqFeaturesHeight_actionPerformed(actionEvent); } });
778      */
779     showDbRefsMenuitem
780             .setText(MessageManager.getString("label.show_database_refs"));
781     showDbRefsMenuitem.addActionListener(new ActionListener()
782     {
783
784       @Override
785       public void actionPerformed(ActionEvent e)
786       {
787         showDbRefs_actionPerformed(e);
788       }
789
790     });
791     showNpFeatsMenuitem.setText(
792             MessageManager.getString("label.show_non_positional_features"));
793     showNpFeatsMenuitem.addActionListener(new ActionListener()
794     {
795
796       @Override
797       public void actionPerformed(ActionEvent e)
798       {
799         showNpFeats_actionPerformed(e);
800       }
801
802     });
803     showGroupConservation
804             .setText(MessageManager.getString("label.group_conservation"));
805     showGroupConservation.addActionListener(new ActionListener()
806     {
807
808       @Override
809       public void actionPerformed(ActionEvent e)
810       {
811         showGroupConservation_actionPerformed(e);
812       }
813
814     });
815
816     showGroupConsensus
817             .setText(MessageManager.getString("label.group_consensus"));
818     showGroupConsensus.addActionListener(new ActionListener()
819     {
820
821       @Override
822       public void actionPerformed(ActionEvent e)
823       {
824         showGroupConsensus_actionPerformed(e);
825       }
826
827     });
828     showConsensusHistogram.setText(
829             MessageManager.getString("label.show_consensus_histogram"));
830     showConsensusHistogram.addActionListener(new ActionListener()
831     {
832
833       @Override
834       public void actionPerformed(ActionEvent e)
835       {
836         showConsensusHistogram_actionPerformed(e);
837       }
838
839     });
840     showSequenceLogo
841             .setText(MessageManager.getString("label.show_consensus_logo"));
842     showSequenceLogo.addActionListener(new ActionListener()
843     {
844
845       @Override
846       public void actionPerformed(ActionEvent e)
847       {
848         showSequenceLogo_actionPerformed(e);
849       }
850
851     });
852     normaliseSequenceLogo
853             .setText(MessageManager.getString("label.norm_consensus_logo"));
854     normaliseSequenceLogo.addActionListener(new ActionListener()
855     {
856
857       @Override
858       public void actionPerformed(ActionEvent e)
859       {
860         normaliseSequenceLogo_actionPerformed(e);
861       }
862
863     });
864     applyAutoAnnotationSettings
865             .setText(MessageManager.getString("label.apply_all_groups"));
866     applyAutoAnnotationSettings.setState(false);
867     applyAutoAnnotationSettings.setVisible(true);
868     applyAutoAnnotationSettings.addActionListener(new ActionListener()
869     {
870       @Override
871       public void actionPerformed(ActionEvent e)
872       {
873         applyAutoAnnotationSettings_actionPerformed(e);
874       }
875     });
876
877     ButtonGroup buttonGroup = new ButtonGroup();
878     final JRadioButtonMenuItem showAutoFirst = new JRadioButtonMenuItem(
879             MessageManager.getString("label.show_first"));
880     final JRadioButtonMenuItem showAutoLast = new JRadioButtonMenuItem(
881             MessageManager.getString("label.show_last"));
882     buttonGroup.add(showAutoFirst);
883     buttonGroup.add(showAutoLast);
884     final boolean autoFirst = Cache
885             .getDefault(Preferences.SHOW_AUTOCALC_ABOVE, false);
886     showAutoFirst.setSelected(autoFirst);
887     setShowAutoCalculatedAbove(autoFirst);
888     showAutoFirst.addActionListener(new ActionListener()
889     {
890       @Override
891       public void actionPerformed(ActionEvent e)
892       {
893         setShowAutoCalculatedAbove(showAutoFirst.isSelected());
894         sortAnnotations_actionPerformed();
895       }
896     });
897     showAutoLast.setSelected(!showAutoFirst.isSelected());
898     showAutoLast.addActionListener(new ActionListener()
899     {
900       @Override
901       public void actionPerformed(ActionEvent e)
902       {
903         setShowAutoCalculatedAbove(!showAutoLast.isSelected());
904         sortAnnotations_actionPerformed();
905       }
906     });
907
908     JMenuItem deleteGroups = new JMenuItem(
909             MessageManager.getString("action.undefine_groups"));
910     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_U,
911             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
912     al = new ActionListener()
913     {
914       @Override
915       public void actionPerformed(ActionEvent e)
916       {
917         deleteGroups_actionPerformed(e);
918       }
919     };
920     addMenuActionAndAccelerator(keyStroke, deleteGroups, al);
921
922     JMenuItem annotationColumn = new JMenuItem(
923             MessageManager.getString("action.select_by_annotation"));
924     annotationColumn.addActionListener(new ActionListener()
925     {
926       @Override
927       public void actionPerformed(ActionEvent e)
928       {
929         annotationColumn_actionPerformed(e);
930       }
931     });
932
933     JMenuItem createGroup = new JMenuItem(
934             MessageManager.getString("action.create_group"));
935     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G,
936             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
937     al = new ActionListener()
938     {
939       @Override
940       public void actionPerformed(ActionEvent e)
941       {
942         createGroup_actionPerformed(e);
943       }
944     };
945     addMenuActionAndAccelerator(keyStroke, createGroup, al);
946
947     JMenuItem unGroup = new JMenuItem(
948             MessageManager.getString("action.remove_group"));
949     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G,
950             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()
951                     | KeyEvent.SHIFT_MASK,
952             false);
953     al = new ActionListener()
954     {
955       @Override
956       public void actionPerformed(ActionEvent e)
957       {
958         unGroup_actionPerformed(e);
959       }
960     };
961     addMenuActionAndAccelerator(keyStroke, unGroup, al);
962
963     copy.setText(MessageManager.getString("action.copy"));
964     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_C,
965             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
966
967     al = new ActionListener()
968     {
969       @Override
970       public void actionPerformed(ActionEvent e)
971       {
972         copy_actionPerformed(e);
973       }
974     };
975     addMenuActionAndAccelerator(keyStroke, copy, al);
976
977     cut.setText(MessageManager.getString("action.cut"));
978     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_X,
979             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
980     al = new ActionListener()
981     {
982       @Override
983       public void actionPerformed(ActionEvent e)
984       {
985         cut_actionPerformed(e);
986       }
987     };
988     addMenuActionAndAccelerator(keyStroke, cut, al);
989
990     JMenuItem delete = new JMenuItem(
991             MessageManager.getString("action.delete"));
992     delete.addActionListener(new ActionListener()
993     {
994       @Override
995       public void actionPerformed(ActionEvent e)
996       {
997         delete_actionPerformed(e);
998       }
999     });
1000
1001     pasteMenu.setText(MessageManager.getString("action.paste"));
1002     JMenuItem pasteNew = new JMenuItem(
1003             MessageManager.getString("label.to_new_alignment"));
1004     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_V,
1005             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()
1006                     | KeyEvent.SHIFT_MASK,
1007             false);
1008     al = new ActionListener()
1009     {
1010       @Override
1011       public void actionPerformed(ActionEvent e)
1012       {
1013         pasteNew_actionPerformed(e);
1014       }
1015     };
1016     addMenuActionAndAccelerator(keyStroke, pasteNew, al);
1017
1018     JMenuItem pasteThis = new JMenuItem(
1019             MessageManager.getString("label.to_this_alignment"));
1020     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_V,
1021             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
1022     al = new ActionListener()
1023     {
1024       @Override
1025       public void actionPerformed(ActionEvent e)
1026       {
1027         pasteThis_actionPerformed(e);
1028       }
1029     };
1030     addMenuActionAndAccelerator(keyStroke, pasteThis, al);
1031
1032     JMenuItem createPNG = new JMenuItem("PNG");
1033     createPNG.addActionListener(new ActionListener()
1034     {
1035       @Override
1036       public void actionPerformed(ActionEvent e)
1037       {
1038         createPNG(null);
1039       }
1040     });
1041     createPNG.setActionCommand(
1042             MessageManager.getString("label.save_png_image"));
1043
1044     JMenuItem font = new JMenuItem(MessageManager.getString("action.font"));
1045     font.addActionListener(new ActionListener()
1046     {
1047       @Override
1048       public void actionPerformed(ActionEvent e)
1049       {
1050         font_actionPerformed(e);
1051       }
1052     });
1053     seqLimits.setText(
1054             MessageManager.getString("label.show_sequence_limits"));
1055     seqLimits.setState(jalview.bin.Cache.getDefault("SHOW_JVSUFFIX", true));
1056     seqLimits.addActionListener(new ActionListener()
1057     {
1058       @Override
1059       public void actionPerformed(ActionEvent e)
1060       {
1061         seqLimit_actionPerformed(e);
1062       }
1063     });
1064     JMenuItem epsFile = new JMenuItem("EPS");
1065     epsFile.addActionListener(new ActionListener()
1066     {
1067       @Override
1068       public void actionPerformed(ActionEvent e)
1069       {
1070         createEPS(null);
1071       }
1072     });
1073
1074     JMenuItem createSVG = new JMenuItem("SVG");
1075     createSVG.addActionListener(new ActionListener()
1076     {
1077       @Override
1078       public void actionPerformed(ActionEvent e)
1079       {
1080         createSVG(null);
1081       }
1082     });
1083
1084     JMenuItem loadTreeMenuItem = new JMenuItem(
1085             MessageManager.getString("label.load_associated_tree"));
1086     loadTreeMenuItem.setActionCommand(
1087             MessageManager.getString("label.load_tree_for_sequence_set"));
1088     loadTreeMenuItem.addActionListener(new ActionListener()
1089     {
1090       @Override
1091       public void actionPerformed(ActionEvent e)
1092       {
1093         loadTreeMenuItem_actionPerformed(e);
1094       }
1095     });
1096
1097     scaleAbove.setVisible(false);
1098     scaleAbove.setText(MessageManager.getString("action.scale_above"));
1099     scaleAbove.addActionListener(new ActionListener()
1100     {
1101       @Override
1102       public void actionPerformed(ActionEvent e)
1103       {
1104         scaleAbove_actionPerformed(e);
1105       }
1106     });
1107     scaleLeft.setVisible(false);
1108     scaleLeft.setSelected(true);
1109     scaleLeft.setText(MessageManager.getString("action.scale_left"));
1110     scaleLeft.addActionListener(new ActionListener()
1111     {
1112       @Override
1113       public void actionPerformed(ActionEvent e)
1114       {
1115         scaleLeft_actionPerformed(e);
1116       }
1117     });
1118     scaleRight.setVisible(false);
1119     scaleRight.setSelected(true);
1120     scaleRight.setText(MessageManager.getString("action.scale_right"));
1121     scaleRight.addActionListener(new ActionListener()
1122     {
1123       @Override
1124       public void actionPerformed(ActionEvent e)
1125       {
1126         scaleRight_actionPerformed(e);
1127       }
1128     });
1129     centreColumnLabelsMenuItem.setVisible(true);
1130     centreColumnLabelsMenuItem.setState(false);
1131     centreColumnLabelsMenuItem.setText(
1132             MessageManager.getString("label.centre_column_labels"));
1133     centreColumnLabelsMenuItem.addActionListener(new ActionListener()
1134     {
1135       @Override
1136       public void actionPerformed(ActionEvent e)
1137       {
1138         centreColumnLabels_actionPerformed(e);
1139       }
1140     });
1141     followHighlightMenuItem.setVisible(true);
1142     followHighlightMenuItem.setState(true);
1143     followHighlightMenuItem
1144             .setText(MessageManager.getString("label.automatic_scrolling"));
1145     followHighlightMenuItem.addActionListener(new ActionListener()
1146     {
1147
1148       @Override
1149       public void actionPerformed(ActionEvent e)
1150       {
1151         followHighlight_actionPerformed();
1152       }
1153
1154     });
1155
1156     sortByTreeMenu
1157             .setText(MessageManager.getString("action.by_tree_order"));
1158     sort.setText(MessageManager.getString("action.sort"));
1159     sort.addMenuListener(new MenuListener()
1160     {
1161       @Override
1162       public void menuSelected(MenuEvent e)
1163       {
1164         buildTreeSortMenu();
1165       }
1166
1167       @Override
1168       public void menuDeselected(MenuEvent e)
1169       {
1170       }
1171
1172       @Override
1173       public void menuCanceled(MenuEvent e)
1174       {
1175       }
1176     });
1177     sortByAnnotScore
1178             .setText(MessageManager.getString("label.sort_by_score"));
1179     sort.add(sortByAnnotScore);
1180     sort.addMenuListener(new javax.swing.event.MenuListener()
1181     {
1182
1183       @Override
1184       public void menuCanceled(MenuEvent e)
1185       {
1186       }
1187
1188       @Override
1189       public void menuDeselected(MenuEvent e)
1190       {
1191       }
1192
1193       @Override
1194       public void menuSelected(MenuEvent e)
1195       {
1196         buildSortByAnnotationScoresMenu();
1197       }
1198     });
1199     sortByAnnotScore.setVisible(false);
1200
1201     calculateTree
1202             .setText(MessageManager.getString("action.calculate_tree_pca"));
1203
1204     padGapsMenuitem.setText(MessageManager.getString("label.pad_gaps"));
1205     padGapsMenuitem
1206             .setState(jalview.bin.Cache.getDefault("PAD_GAPS", false));
1207     padGapsMenuitem.addActionListener(new ActionListener()
1208     {
1209       @Override
1210       public void actionPerformed(ActionEvent e)
1211       {
1212         padGapsMenuitem_actionPerformed(e);
1213       }
1214     });
1215     JMenuItem vamsasStore = new JMenuItem(
1216             MessageManager.getString("label.vamsas_store"));
1217     vamsasStore.setVisible(false);
1218     vamsasStore.addActionListener(new ActionListener()
1219     {
1220       @Override
1221       public void actionPerformed(ActionEvent e)
1222       {
1223         vamsasStore_actionPerformed(e);
1224       }
1225     });
1226     showTranslation
1227             .setText(MessageManager.getString("label.translate_cDNA"));
1228     showTranslation.addActionListener(new ActionListener()
1229     {
1230       @Override
1231       public void actionPerformed(ActionEvent e)
1232       {
1233         showTranslation_actionPerformed(e);
1234       }
1235     });
1236     showReverse.setText(MessageManager.getString("label.reverse"));
1237     showReverse.addActionListener(new ActionListener()
1238     {
1239       @Override
1240       public void actionPerformed(ActionEvent e)
1241       {
1242         showReverse_actionPerformed(false);
1243       }
1244     });
1245     showReverseComplement
1246             .setText(MessageManager.getString("label.reverse_complement"));
1247     showReverseComplement.addActionListener(new ActionListener()
1248     {
1249       @Override
1250       public void actionPerformed(ActionEvent e)
1251       {
1252         showReverse_actionPerformed(true);
1253       }
1254     });
1255
1256     JMenuItem extractScores = new JMenuItem(
1257             MessageManager.getString("label.extract_scores"));
1258     extractScores.addActionListener(new ActionListener()
1259     {
1260       @Override
1261       public void actionPerformed(ActionEvent e)
1262       {
1263         extractScores_actionPerformed(e);
1264       }
1265     });
1266     extractScores.setVisible(true);
1267     // JBPNote: TODO: make gui for regex based score extraction
1268
1269     // for show products actions see AlignFrame.canShowProducts
1270     showProducts.setText(MessageManager.getString("label.get_cross_refs"));
1271
1272     runGroovy.setText(MessageManager.getString("label.run_groovy"));
1273     runGroovy.setToolTipText(
1274             MessageManager.getString("label.run_groovy_tip"));
1275     runGroovy.addActionListener(new ActionListener()
1276     {
1277       @Override
1278       public void actionPerformed(ActionEvent e)
1279       {
1280         runGroovy_actionPerformed();
1281       }
1282     });
1283
1284     openFeatureSettings = new JMenuItem(
1285             MessageManager.getString("action.feature_settings"));
1286     openFeatureSettings.addActionListener(new ActionListener()
1287     {
1288       @Override
1289       public void actionPerformed(ActionEvent e)
1290       {
1291         featureSettings_actionPerformed(e);
1292       }
1293     });
1294
1295     /*
1296      * add sub-menu of database we can fetch from
1297      */
1298     JMenuItem fetchSequence = new JMenuItem(
1299             MessageManager.getString("label.fetch_sequences"));
1300     fetchSequence.addActionListener(new ActionListener()
1301     {
1302       @Override
1303       public void actionPerformed(ActionEvent e)
1304       {
1305         fetchSequence_actionPerformed();
1306       }
1307     });
1308
1309     JMenuItem associatedData = new JMenuItem(
1310             MessageManager.getString("label.load_features_annotations"));
1311     associatedData.addActionListener(new ActionListener()
1312     {
1313       @Override
1314       public void actionPerformed(ActionEvent e)
1315       {
1316         associatedData_actionPerformed(e);
1317       }
1318     });
1319     loadVcf = new JMenuItem(MessageManager.getString("label.load_vcf_file"));
1320     loadVcf.setToolTipText(MessageManager.getString("label.load_vcf"));
1321     loadVcf.addActionListener(new ActionListener()
1322     {
1323       @Override
1324       public void actionPerformed(ActionEvent e)
1325       {
1326         loadVcf_actionPerformed();
1327       }
1328     });
1329     autoCalculate.setText(
1330             MessageManager.getString("label.autocalculate_consensus"));
1331     autoCalculate.setState(
1332             jalview.bin.Cache.getDefault("AUTO_CALC_CONSENSUS", true));
1333     autoCalculate.addActionListener(new ActionListener()
1334     {
1335       @Override
1336       public void actionPerformed(ActionEvent e)
1337       {
1338         autoCalculate_actionPerformed(e);
1339       }
1340     });
1341     sortByTree.setText(
1342             MessageManager.getString("label.sort_alignment_new_tree"));
1343     sortByTree.setToolTipText("<html>" + MessageManager.getString(
1344             "label.enable_automatically_sort_alignment_when_open_new_tree"));
1345     sortByTree
1346             .setState(jalview.bin.Cache.getDefault("SORT_BY_TREE", false));
1347     sortByTree.addActionListener(new ActionListener()
1348     {
1349       @Override
1350       public void actionPerformed(ActionEvent e)
1351       {
1352         sortByTreeOption_actionPerformed(e);
1353       }
1354     });
1355
1356     listenToViewSelections.setText(
1357             MessageManager.getString("label.listen_for_selections"));
1358     listenToViewSelections
1359             .setToolTipText("<html>" + MessageManager.getString(
1360                     "label.selections_mirror_selections_made_same_sequences_other_views"));
1361     listenToViewSelections.setState(false);
1362     listenToViewSelections.addActionListener(new ActionListener()
1363     {
1364       @Override
1365       public void actionPerformed(ActionEvent e)
1366       {
1367         listenToViewSelections_actionPerformed(e);
1368       }
1369     });
1370
1371     JMenu addSequenceMenu = new JMenu(
1372             MessageManager.getString("label.add_sequences"));
1373     JMenuItem addFromFile = new JMenuItem(
1374             MessageManager.getString("label.from_file"));
1375     addFromFile.addActionListener(new ActionListener()
1376     {
1377       @Override
1378       public void actionPerformed(ActionEvent e)
1379       {
1380         addFromFile_actionPerformed(e);
1381       }
1382     });
1383     JMenuItem addFromText = new JMenuItem(
1384             MessageManager.getString("label.from_textbox"));
1385     addFromText.addActionListener(new ActionListener()
1386     {
1387       @Override
1388       public void actionPerformed(ActionEvent e)
1389       {
1390         addFromText_actionPerformed(e);
1391       }
1392     });
1393     JMenuItem addFromURL = new JMenuItem(
1394             MessageManager.getString("label.from_url"));
1395     addFromURL.addActionListener(new ActionListener()
1396     {
1397       @Override
1398       public void actionPerformed(ActionEvent e)
1399       {
1400         addFromURL_actionPerformed(e);
1401       }
1402     });
1403     JMenuItem exportFeatures = new JMenuItem(
1404             MessageManager.getString("label.export_features"));
1405     exportFeatures.addActionListener(new ActionListener()
1406     {
1407       @Override
1408       public void actionPerformed(ActionEvent e)
1409       {
1410         exportFeatures_actionPerformed(e);
1411       }
1412     });
1413     JMenuItem exportAnnotations = new JMenuItem(
1414             MessageManager.getString("label.export_annotations"));
1415     exportAnnotations.addActionListener(new ActionListener()
1416     {
1417       @Override
1418       public void actionPerformed(ActionEvent e)
1419       {
1420         exportAnnotations_actionPerformed(e);
1421       }
1422     });
1423     statusPanel.setLayout(new GridLayout());
1424     JMenuItem showAllSeqs = new JMenuItem(
1425             MessageManager.getString("label.all_sequences"));
1426     showAllSeqs.setToolTipText(
1427             MessageManager.getString("label.toggle_sequence_visibility"));
1428     showAllSeqs.addActionListener(new ActionListener()
1429     {
1430       @Override
1431       public void actionPerformed(ActionEvent e)
1432       {
1433         showAllSeqs_actionPerformed(e);
1434       }
1435     });
1436     JMenuItem showAllColumns = new JMenuItem(
1437             MessageManager.getString("label.all_columns"));
1438     showAllColumns.setToolTipText(
1439             MessageManager.getString("label.toggle_columns_visibility"));
1440     showAllColumns.addActionListener(new ActionListener()
1441     {
1442       @Override
1443       public void actionPerformed(ActionEvent e)
1444       {
1445         showAllColumns_actionPerformed(e);
1446       }
1447     });
1448     JMenu hideMenu = new JMenu(MessageManager.getString("action.hide"));
1449     JMenuItem hideSelSequences = new JMenuItem(
1450             MessageManager.getString("label.selected_sequences"));
1451     hideSelSequences.setToolTipText(
1452             MessageManager.getString("label.toggle_sequence_visibility"));
1453     hideSelSequences.addActionListener(new ActionListener()
1454     {
1455       @Override
1456       public void actionPerformed(ActionEvent e)
1457       {
1458         hideSelSequences_actionPerformed(e);
1459       }
1460     });
1461     JMenuItem hideSelColumns = new JMenuItem(
1462             MessageManager.getString("label.selected_columns"));
1463     hideSelColumns.setToolTipText(
1464             MessageManager.getString("label.toggle_columns_visibility"));
1465     hideSelColumns.addActionListener(new ActionListener()
1466     {
1467       @Override
1468       public void actionPerformed(ActionEvent e)
1469       {
1470         hideSelColumns_actionPerformed(e);
1471       }
1472     });
1473     JMenuItem hideAllSelection = new JMenuItem(
1474             MessageManager.getString("label.selected_region"));
1475     hideAllSelection.addActionListener(new ActionListener()
1476     {
1477       @Override
1478       public void actionPerformed(ActionEvent e)
1479       {
1480         hideAllSelection_actionPerformed(e);
1481       }
1482     });
1483     // TODO: should be hidden if no selection exists.
1484     JMenuItem hideAllButSelection = new JMenuItem(
1485             MessageManager.getString("label.all_but_selected_region"));
1486     hideAllButSelection.addActionListener(new ActionListener()
1487     {
1488       @Override
1489       public void actionPerformed(ActionEvent e)
1490       {
1491         hideAllButSelection_actionPerformed(e);
1492       }
1493     });
1494     JMenuItem showAllhidden = new JMenuItem(
1495             MessageManager.getString("label.all_sequences_columns"));
1496     showAllhidden.setToolTipText(MessageManager
1497             .getString("label.toggles_visibility_hidden_selected_regions"));
1498     showAllhidden.addActionListener(new ActionListener()
1499     {
1500       @Override
1501       public void actionPerformed(ActionEvent e)
1502       {
1503         showAllhidden_actionPerformed(e);
1504       }
1505     });
1506     hiddenMarkers.setText(
1507             MessageManager.getString("action.show_hidden_markers"));
1508     hiddenMarkers.addActionListener(new ActionListener()
1509     {
1510       @Override
1511       public void actionPerformed(ActionEvent e)
1512       {
1513         hiddenMarkers_actionPerformed(e);
1514       }
1515     });
1516
1517     JMenuItem invertColSel = new JMenuItem(
1518             MessageManager.getString("action.invert_column_selection"));
1519     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_I,
1520             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()
1521                     | KeyEvent.ALT_MASK,
1522             false);
1523     al = new ActionListener()
1524     {
1525       @Override
1526       public void actionPerformed(ActionEvent e)
1527       {
1528         invertColSel_actionPerformed(e);
1529       }
1530     };
1531     addMenuActionAndAccelerator(keyStroke, invertColSel, al);
1532
1533     showComplementMenuItem.setVisible(false);
1534     showComplementMenuItem.addActionListener(new ActionListener()
1535     {
1536       @Override
1537       public void actionPerformed(ActionEvent e)
1538       {
1539         showComplement_actionPerformed(showComplementMenuItem.getState());
1540       }
1541     });
1542
1543     tabbedPane.addChangeListener(new javax.swing.event.ChangeListener()
1544     {
1545       @Override
1546       public void stateChanged(ChangeEvent evt)
1547       {
1548         JTabbedPane pane = (JTabbedPane) evt.getSource();
1549         int sel = pane.getSelectedIndex();
1550         tabSelectionChanged(sel);
1551       }
1552     });
1553     tabbedPane.addMouseListener(new MouseAdapter()
1554     {
1555       @Override
1556       public void mousePressed(MouseEvent e)
1557       {
1558         if (e.isPopupTrigger()) // Mac
1559         {
1560           tabbedPane_mousePressed(e);
1561         }
1562       }
1563
1564       @Override
1565       public void mouseReleased(MouseEvent e)
1566       {
1567         if (e.isPopupTrigger()) // Windows
1568         {
1569           tabbedPane_mousePressed(e);
1570         }
1571       }
1572     });
1573     tabbedPane.addFocusListener(new FocusAdapter()
1574     {
1575       @Override
1576       public void focusGained(FocusEvent e)
1577       {
1578         tabbedPane_focusGained(e);
1579       }
1580     });
1581
1582     JMenuItem save = new JMenuItem(MessageManager.getString("action.save"));
1583     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_S,
1584             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
1585     al = new ActionListener()
1586     {
1587       @Override
1588       public void actionPerformed(ActionEvent e)
1589       {
1590         save_actionPerformed(e);
1591       }
1592     };
1593     addMenuActionAndAccelerator(keyStroke, save, al);
1594
1595     reload.setEnabled(false);
1596     reload.setText(MessageManager.getString("action.reload"));
1597     reload.addActionListener(new ActionListener()
1598     {
1599       @Override
1600       public void actionPerformed(ActionEvent e)
1601       {
1602         reload_actionPerformed(e);
1603       }
1604     });
1605
1606     JMenuItem newView = new JMenuItem(
1607             MessageManager.getString("action.new_view"));
1608     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_T,
1609             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
1610     al = new ActionListener()
1611     {
1612       @Override
1613       public void actionPerformed(ActionEvent e)
1614       {
1615         newView_actionPerformed(e);
1616       }
1617     };
1618     addMenuActionAndAccelerator(keyStroke, newView, al);
1619
1620     tabbedPane.setToolTipText("<html><i>"
1621             + MessageManager.getString("label.rename_tab_eXpand_reGroup")
1622             + "</i></html>");
1623
1624     formatMenu.setText(MessageManager.getString("action.format"));
1625     JMenu selectMenu = new JMenu(MessageManager.getString("action.select"));
1626
1627     idRightAlign.setText(
1628             MessageManager.getString("label.right_align_sequence_id"));
1629     idRightAlign.addActionListener(new ActionListener()
1630     {
1631       @Override
1632       public void actionPerformed(ActionEvent e)
1633       {
1634         idRightAlign_actionPerformed(e);
1635       }
1636     });
1637
1638     gatherViews.setEnabled(false);
1639     gatherViews.setText(MessageManager.getString("action.gather_views"));
1640     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G, 0, false);
1641     al = new ActionListener()
1642     {
1643       @Override
1644       public void actionPerformed(ActionEvent e)
1645       {
1646         gatherViews_actionPerformed(e);
1647       }
1648     };
1649     addMenuActionAndAccelerator(keyStroke, gatherViews, al);
1650
1651     expandViews.setEnabled(false);
1652     expandViews.setText(MessageManager.getString("action.expand_views"));
1653     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_X, 0, false);
1654     al = new ActionListener()
1655     {
1656       @Override
1657       public void actionPerformed(ActionEvent e)
1658       {
1659         expandViews_actionPerformed(e);
1660       }
1661     };
1662     addMenuActionAndAccelerator(keyStroke, expandViews, al);
1663
1664     JMenuItem pageSetup = new JMenuItem(
1665             MessageManager.getString("action.page_setup"));
1666     pageSetup.addActionListener(new ActionListener()
1667     {
1668       @Override
1669       public void actionPerformed(ActionEvent e)
1670       {
1671         pageSetup_actionPerformed(e);
1672       }
1673     });
1674     JMenuItem alignmentProperties = new JMenuItem(
1675             MessageManager.getString("label.alignment_props"));
1676     alignmentProperties.addActionListener(new ActionListener()
1677     {
1678       @Override
1679       public void actionPerformed(ActionEvent actionEvent)
1680       {
1681         alignmentProperties();
1682       }
1683     });
1684     JMenuItem selectHighlighted = new JMenuItem(
1685             MessageManager.getString("action.select_highlighted_columns"));
1686     selectHighlighted.setToolTipText(
1687             MessageManager.getString("tooltip.select_highlighted_columns"));
1688     al = new ActionListener()
1689     {
1690       @Override
1691       public void actionPerformed(ActionEvent actionEvent)
1692       {
1693         selectHighlightedColumns_actionPerformed(actionEvent);
1694       }
1695     };
1696     selectHighlighted.addActionListener(al);
1697     JMenu tooltipSettingsMenu = new JMenu(
1698             MessageManager.getString("label.sequence_id_tooltip"));
1699     JMenu autoAnnMenu = new JMenu(
1700             MessageManager.getString("label.autocalculated_annotation"));
1701
1702     JMenu exportImageMenu = new JMenu(
1703             MessageManager.getString("label.export_image"));
1704     JMenu fileMenu = new JMenu(MessageManager.getString("action.file"));
1705     alignFrameMenuBar.add(fileMenu);
1706     alignFrameMenuBar.add(editMenu);
1707     alignFrameMenuBar.add(selectMenu);
1708     alignFrameMenuBar.add(viewMenu);
1709     alignFrameMenuBar.add(annotationsMenu);
1710     alignFrameMenuBar.add(formatMenu);
1711     alignFrameMenuBar.add(colourMenu);
1712     alignFrameMenuBar.add(calculateMenu);
1713     if (!Platform.isJS())
1714     {
1715       alignFrameMenuBar.add(webService);
1716     }
1717
1718     fileMenu.add(fetchSequence);
1719     fileMenu.add(addSequenceMenu);
1720     fileMenu.add(reload);
1721     fileMenu.addSeparator();
1722     fileMenu.add(vamsasStore);
1723     fileMenu.add(save);
1724     fileMenu.add(saveAs);
1725     fileMenu.add(outputTextboxMenu);
1726     fileMenu.add(pageSetup);
1727     fileMenu.add(printMenuItem);
1728     fileMenu.addSeparator();
1729     fileMenu.add(exportImageMenu);
1730     fileMenu.add(exportFeatures);
1731     fileMenu.add(exportAnnotations);
1732     fileMenu.add(loadTreeMenuItem);
1733     fileMenu.add(associatedData);
1734     if (!Platform.isJS())
1735     {
1736       fileMenu.add(loadVcf);
1737     }
1738     fileMenu.addSeparator();
1739     fileMenu.add(closeMenuItem);
1740
1741     pasteMenu.add(pasteNew);
1742     pasteMenu.add(pasteThis);
1743     editMenu.add(undoMenuItem);
1744     editMenu.add(redoMenuItem);
1745     editMenu.add(cut);
1746     editMenu.add(copy);
1747     editMenu.add(pasteMenu);
1748     editMenu.add(delete);
1749     editMenu.addSeparator();
1750     editMenu.add(remove2LeftMenuItem);
1751     editMenu.add(remove2RightMenuItem);
1752     editMenu.add(removeGappedColumnMenuItem);
1753     editMenu.add(removeAllGapsMenuItem);
1754     editMenu.add(removeRedundancyMenuItem);
1755     editMenu.addSeparator();
1756     // dont add these yet in the CVS build - they cannot be undone!
1757     // Excluded from Jalview 2.5 release - undo needs to be implemented.
1758     // editMenu.add(justifyLeftMenuItem);
1759     // editMenu.add(justifyRightMenuItem);
1760     // editMenu.addSeparator();
1761     editMenu.add(padGapsMenuitem);
1762
1763     showMenu.add(showAllColumns);
1764     showMenu.add(showAllSeqs);
1765     showMenu.add(showAllhidden);
1766     hideMenu.add(hideSelColumns);
1767     hideMenu.add(hideSelSequences);
1768     hideMenu.add(hideAllSelection);
1769     hideMenu.add(hideAllButSelection);
1770     viewMenu.add(newView);
1771     viewMenu.add(expandViews);
1772     viewMenu.add(gatherViews);
1773     viewMenu.addSeparator();
1774     viewMenu.add(showMenu);
1775     viewMenu.add(hideMenu);
1776     viewMenu.add(showComplementMenuItem);
1777     viewMenu.addSeparator();
1778     viewMenu.add(followHighlightMenuItem);
1779     viewMenu.addSeparator();
1780     viewMenu.add(showSeqFeatures);
1781     // viewMenu.add(showSeqFeaturesHeight);
1782     viewMenu.add(openFeatureSettings);
1783     tooltipSettingsMenu.add(showDbRefsMenuitem);
1784     tooltipSettingsMenu.add(showNpFeatsMenuitem);
1785     viewMenu.add(tooltipSettingsMenu);
1786     viewMenu.addSeparator();
1787     viewMenu.add(alignmentProperties);
1788     viewMenu.addSeparator();
1789     viewMenu.add(overviewMenuItem);
1790
1791     annotationsMenu.add(annotationPanelMenuItem);
1792     annotationsMenu.addSeparator();
1793     annotationsMenu.add(showAllAlAnnotations);
1794     annotationsMenu.add(hideAllAlAnnotations);
1795     annotationsMenu.addSeparator();
1796     annotationsMenu.add(showAllSeqAnnotations);
1797     annotationsMenu.add(hideAllSeqAnnotations);
1798     annotationsMenu.add(sortAnnBySequence);
1799     annotationsMenu.add(sortAnnByLabel);
1800     annotationsMenu.addSeparator();
1801     autoAnnMenu.add(showAutoFirst);
1802     autoAnnMenu.add(showAutoLast);
1803     autoAnnMenu.addSeparator();
1804     autoAnnMenu.add(applyAutoAnnotationSettings);
1805     autoAnnMenu.add(showConsensusHistogram);
1806     autoAnnMenu.add(showSequenceLogo);
1807     autoAnnMenu.add(normaliseSequenceLogo);
1808     autoAnnMenu.addSeparator();
1809     autoAnnMenu.add(showGroupConservation);
1810     autoAnnMenu.add(showGroupConsensus);
1811     annotationsMenu.add(autoAnnMenu);
1812
1813     sort.add(sortIDMenuItem);
1814     sort.add(sortLengthMenuItem);
1815     sort.add(sortGroupMenuItem);
1816     sort.add(sortPairwiseMenuItem);
1817     sort.add(sortByTreeMenu);
1818     calculateMenu.add(sort);
1819     calculateMenu.add(calculateTree);
1820     calculateMenu.addSeparator();
1821     calculateMenu.add(pairwiseAlignmentMenuItem);
1822     calculateMenu.addSeparator();
1823     calculateMenu.add(showTranslation);
1824     calculateMenu.add(showReverse);
1825     calculateMenu.add(showReverseComplement);
1826     calculateMenu.add(showProducts);
1827     calculateMenu.add(autoCalculate);
1828     calculateMenu.add(sortByTree);
1829     calculateMenu.addSeparator();
1830     calculateMenu.add(expandAlignment);
1831     calculateMenu.add(extractScores);
1832     if (!Platform.isJS())
1833     {
1834       calculateMenu.addSeparator();
1835       calculateMenu.add(runGroovy);
1836     }
1837
1838     webServiceNoServices = new JMenuItem(
1839             MessageManager.getString("label.no_services"));
1840     webService.add(webServiceNoServices);
1841     if (!Platform.isJS())
1842     {
1843       exportImageMenu.add(htmlMenuItem);
1844     }
1845     exportImageMenu.add(epsFile);
1846     exportImageMenu.add(createPNG);
1847     exportImageMenu.add(createBioJS);
1848     if (!Platform.isJS())
1849     {
1850       exportImageMenu.add(createSVG);
1851     }
1852     addSequenceMenu.add(addFromFile);
1853     addSequenceMenu.add(addFromText);
1854     addSequenceMenu.add(addFromURL);
1855     this.getContentPane().add(statusPanel, java.awt.BorderLayout.SOUTH);
1856     statusPanel.add(statusBar, null);
1857     this.getContentPane().add(tabbedPane, java.awt.BorderLayout.CENTER);
1858
1859     formatMenu.add(font);
1860     formatMenu.addSeparator();
1861     formatMenu.add(wrapMenuItem);
1862     formatMenu.add(scaleAbove);
1863     formatMenu.add(scaleLeft);
1864     formatMenu.add(scaleRight);
1865     formatMenu.add(seqLimits);
1866     formatMenu.add(idRightAlign);
1867     formatMenu.add(hiddenMarkers);
1868     formatMenu.add(viewBoxesMenuItem);
1869     formatMenu.add(viewTextMenuItem);
1870     formatMenu.add(colourTextMenuItem);
1871     formatMenu.add(renderGapsMenuItem);
1872     formatMenu.add(centreColumnLabelsMenuItem);
1873     formatMenu.add(showNonconservedMenuItem);
1874     selectMenu.add(findMenuItem);
1875     selectMenu.addSeparator();
1876     selectMenu.add(selectAllSequenceMenuItem);
1877     selectMenu.add(deselectAllSequenceMenuItem);
1878     selectMenu.add(invertSequenceMenuItem);
1879     selectMenu.add(invertColSel);
1880     selectMenu.add(createGroup);
1881     selectMenu.add(unGroup);
1882     selectMenu.add(grpsFromSelection);
1883     selectMenu.add(deleteGroups);
1884     selectMenu.add(annotationColumn);
1885     selectMenu.add(selectHighlighted);
1886     // TODO - determine if the listenToViewSelections button is needed : see bug
1887     // JAL-574
1888     // selectMenu.addSeparator();
1889     // selectMenu.add(listenToViewSelections);
1890   }
1891
1892   protected void loadVcf_actionPerformed()
1893   {
1894   }
1895
1896   /**
1897    * Constructs the entries on the Colour menu (but does not add them to the
1898    * menu).
1899    */
1900   protected void initColourMenu()
1901   {
1902     applyToAllGroups = new JCheckBoxMenuItem(
1903             MessageManager.getString("label.apply_colour_to_all_groups"));
1904     applyToAllGroups.addActionListener(new ActionListener()
1905     {
1906       @Override
1907       public void actionPerformed(ActionEvent e)
1908       {
1909         applyToAllGroups_actionPerformed(applyToAllGroups.isSelected());
1910       }
1911     });
1912
1913     textColour = new JMenuItem(
1914             MessageManager.getString("label.text_colour"));
1915     textColour.addActionListener(new ActionListener()
1916     {
1917       @Override
1918       public void actionPerformed(ActionEvent e)
1919       {
1920         textColour_actionPerformed();
1921       }
1922     });
1923
1924     conservationMenuItem = new JCheckBoxMenuItem(
1925             MessageManager.getString("action.by_conservation"));
1926     conservationMenuItem.addActionListener(new ActionListener()
1927     {
1928       @Override
1929       public void actionPerformed(ActionEvent e)
1930       {
1931         conservationMenuItem_actionPerformed(
1932                 conservationMenuItem.isSelected());
1933       }
1934     });
1935
1936     abovePIDThreshold = new JCheckBoxMenuItem(
1937             MessageManager.getString("label.above_identity_threshold"));
1938     abovePIDThreshold.addActionListener(new ActionListener()
1939     {
1940       @Override
1941       public void actionPerformed(ActionEvent e)
1942       {
1943         abovePIDThreshold_actionPerformed(abovePIDThreshold.isSelected());
1944       }
1945     });
1946     modifyPID = new JMenuItem(
1947             MessageManager.getString("label.modify_identity_threshold"));
1948     modifyPID.addActionListener(new ActionListener()
1949     {
1950       @Override
1951       public void actionPerformed(ActionEvent e)
1952       {
1953         modifyPID_actionPerformed();
1954       }
1955     });
1956     modifyConservation = new JMenuItem(MessageManager
1957             .getString("label.modify_conservation_threshold"));
1958     modifyConservation.addActionListener(new ActionListener()
1959     {
1960       @Override
1961       public void actionPerformed(ActionEvent e)
1962       {
1963         modifyConservation_actionPerformed();
1964       }
1965     });
1966
1967     annotationColour = new JMenuItem(
1968             MessageManager.getString("action.by_annotation"));
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(String formatName)
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()
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(ActionEvent e)
2465   {
2466
2467   }
2468
2469   public void featureSettings_actionPerformed(ActionEvent e)
2470   {
2471
2472   }
2473
2474   public void fetchSequence_actionPerformed()
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 }