Merge remote-tracking branch 'origin/features/JAL-2620alternativeCodeTables' into...
[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.util.MessageManager;
32 import jalview.util.Platform;
33
34 import java.awt.BorderLayout;
35 import java.awt.Color;
36 import java.awt.GridLayout;
37 import java.awt.Toolkit;
38 import java.awt.event.ActionEvent;
39 import java.awt.event.ActionListener;
40 import java.awt.event.FocusAdapter;
41 import java.awt.event.FocusEvent;
42 import java.awt.event.KeyEvent;
43 import java.awt.event.MouseAdapter;
44 import java.awt.event.MouseEvent;
45 import java.util.HashMap;
46 import java.util.Map;
47
48 import javax.swing.BorderFactory;
49 import javax.swing.ButtonGroup;
50 import javax.swing.JCheckBoxMenuItem;
51 import javax.swing.JInternalFrame;
52 import javax.swing.JLabel;
53 import javax.swing.JMenu;
54 import javax.swing.JMenuBar;
55 import javax.swing.JMenuItem;
56 import javax.swing.JPanel;
57 import javax.swing.JRadioButtonMenuItem;
58 import javax.swing.JTabbedPane;
59 import javax.swing.KeyStroke;
60 import javax.swing.event.ChangeEvent;
61 import javax.swing.event.MenuEvent;
62 import javax.swing.event.MenuListener;
63
64 public class GAlignFrame extends JInternalFrame
65 {
66   protected JMenuBar alignFrameMenuBar = new JMenuBar();
67
68   protected JMenuItem closeMenuItem = new JMenuItem();
69
70   protected JMenu webService = new JMenu();
71
72   protected JMenuItem webServiceNoServices;
73
74   protected JCheckBoxMenuItem viewBoxesMenuItem = new JCheckBoxMenuItem();
75
76   protected JCheckBoxMenuItem viewTextMenuItem = new JCheckBoxMenuItem();
77
78   protected JMenu sortByAnnotScore = new JMenu();
79
80   protected JLabel statusBar = new JLabel();
81
82   protected JMenu outputTextboxMenu = new JMenu();
83
84   protected JCheckBoxMenuItem annotationPanelMenuItem = new JCheckBoxMenuItem();
85
86   protected JCheckBoxMenuItem colourTextMenuItem = new JCheckBoxMenuItem();
87
88   protected JCheckBoxMenuItem showNonconservedMenuItem = new JCheckBoxMenuItem();
89
90   protected JMenuItem undoMenuItem = new JMenuItem();
91
92   protected JMenuItem redoMenuItem = new JMenuItem();
93
94   protected JCheckBoxMenuItem wrapMenuItem = new JCheckBoxMenuItem();
95
96   protected JCheckBoxMenuItem renderGapsMenuItem = new JCheckBoxMenuItem();
97
98   public JCheckBoxMenuItem showSeqFeatures = new JCheckBoxMenuItem();
99
100   JMenuItem copy = new JMenuItem();
101
102   JMenuItem cut = new JMenuItem();
103
104   JMenu pasteMenu = new JMenu();
105
106   protected JCheckBoxMenuItem seqLimits = new JCheckBoxMenuItem();
107
108   protected JCheckBoxMenuItem scaleAbove = new JCheckBoxMenuItem();
109
110   protected JCheckBoxMenuItem scaleLeft = new JCheckBoxMenuItem();
111
112   protected JCheckBoxMenuItem scaleRight = new JCheckBoxMenuItem();
113
114   protected JCheckBoxMenuItem applyToAllGroups;
115
116   protected JMenu colourMenu = new JMenu();
117
118   protected JMenuItem textColour;
119
120   protected JCheckBoxMenuItem conservationMenuItem;
121
122   protected JMenuItem modifyConservation;
123
124   protected JCheckBoxMenuItem abovePIDThreshold;
125
126   protected JMenuItem modifyPID;
127
128   protected JMenuItem annotationColour;
129
130   protected JMenu sortByTreeMenu = new JMenu();
131
132   protected JMenu sort = new JMenu();
133
134   protected JMenuItem calculateTree = new JMenuItem();
135
136   protected JCheckBoxMenuItem padGapsMenuitem = new JCheckBoxMenuItem();
137
138   protected JCheckBoxMenuItem showNpFeatsMenuitem = new JCheckBoxMenuItem();
139
140   protected JCheckBoxMenuItem showDbRefsMenuitem = new JCheckBoxMenuItem();
141
142   protected JMenu showTranslation = new JMenu();
143
144   protected JMenuItem showReverse = new JMenuItem();
145
146   protected JMenuItem showReverseComplement = new JMenuItem();
147
148   protected JMenu showProducts = new JMenu();
149
150   protected JMenuItem runGroovy = new JMenuItem();
151
152   protected JMenuItem loadVcf;
153
154   protected JCheckBoxMenuItem autoCalculate = new JCheckBoxMenuItem();
155
156   protected JCheckBoxMenuItem sortByTree = new JCheckBoxMenuItem();
157
158   protected JCheckBoxMenuItem listenToViewSelections = new JCheckBoxMenuItem();
159
160   protected JPanel statusPanel = new JPanel();
161
162   protected JMenuItem showAllSeqAnnotations = new JMenuItem();
163
164   protected JMenuItem hideAllSeqAnnotations = new JMenuItem();
165
166   protected JMenuItem showAllAlAnnotations = new JMenuItem();
167
168   protected JMenuItem hideAllAlAnnotations = new JMenuItem();
169
170   protected JCheckBoxMenuItem showComplementMenuItem = new JCheckBoxMenuItem();
171
172   protected JCheckBoxMenuItem hiddenMarkers = new JCheckBoxMenuItem();
173
174   protected JTabbedPane tabbedPane = new JTabbedPane();
175
176   protected JMenuItem reload = new JMenuItem();
177
178   protected JMenu formatMenu = new JMenu();
179
180   protected JCheckBoxMenuItem idRightAlign = new JCheckBoxMenuItem();
181
182   protected JCheckBoxMenuItem centreColumnLabelsMenuItem = new JCheckBoxMenuItem();
183
184   protected JCheckBoxMenuItem followHighlightMenuItem = new JCheckBoxMenuItem();
185
186   protected JMenuItem gatherViews = new JMenuItem();
187
188   protected JMenuItem expandViews = new JMenuItem();
189
190   protected JCheckBoxMenuItem showGroupConsensus = new JCheckBoxMenuItem();
191
192   protected JCheckBoxMenuItem showGroupConservation = new JCheckBoxMenuItem();
193
194   protected JCheckBoxMenuItem showConsensusHistogram = new JCheckBoxMenuItem();
195
196   protected JCheckBoxMenuItem showSequenceLogo = new JCheckBoxMenuItem();
197
198   protected JCheckBoxMenuItem normaliseSequenceLogo = new JCheckBoxMenuItem();
199
200   protected JCheckBoxMenuItem applyAutoAnnotationSettings = new JCheckBoxMenuItem();
201
202   private SequenceAnnotationOrder annotationSortOrder;
203
204   private boolean showAutoCalculatedAbove = false;
205
206   private Map<KeyStroke, JMenuItem> accelerators = new HashMap<>();
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);
228           }
229         });
230
231         outputTextboxMenu.add(item);
232       }
233     } catch (Exception e)
234     {
235       System.err.println(e.toString());
236     }
237
238     if (!Platform.isAMac())
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(e);
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
1227     /*
1228      * Translate as cDNA with sub-menu of translation tables
1229      */
1230     showTranslation.setText(MessageManager
1231             .getString("label.translate_cDNA"));
1232     boolean first = true;
1233     for (final GeneticCodeI table : GeneticCodes.getInstance()
1234             .getCodeTables())
1235     {
1236       JMenuItem item = new JMenuItem(table.getId() + " " + table.getName());
1237       showTranslation.add(item);
1238       item.addActionListener(new ActionListener()
1239       {
1240         @Override
1241         public void actionPerformed(ActionEvent e)
1242         {
1243           showTranslation_actionPerformed(table);
1244         }
1245       });
1246       if (first)
1247       {
1248         showTranslation.addSeparator();
1249       }
1250       first = false;
1251     }
1252
1253     showReverse.setText(MessageManager.getString("label.reverse"));
1254     showReverse.addActionListener(new ActionListener()
1255     {
1256       @Override
1257       public void actionPerformed(ActionEvent e)
1258       {
1259         showReverse_actionPerformed(false);
1260       }
1261     });
1262     showReverseComplement
1263             .setText(MessageManager.getString("label.reverse_complement"));
1264     showReverseComplement.addActionListener(new ActionListener()
1265     {
1266       @Override
1267       public void actionPerformed(ActionEvent e)
1268       {
1269         showReverse_actionPerformed(true);
1270       }
1271     });
1272
1273     JMenuItem extractScores = new JMenuItem(
1274             MessageManager.getString("label.extract_scores"));
1275     extractScores.addActionListener(new ActionListener()
1276     {
1277       @Override
1278       public void actionPerformed(ActionEvent e)
1279       {
1280         extractScores_actionPerformed(e);
1281       }
1282     });
1283     extractScores.setVisible(true);
1284     // JBPNote: TODO: make gui for regex based score extraction
1285
1286     // for show products actions see AlignFrame.canShowProducts
1287     showProducts.setText(MessageManager.getString("label.get_cross_refs"));
1288
1289     runGroovy.setText(MessageManager.getString("label.run_groovy"));
1290     runGroovy.setToolTipText(
1291             MessageManager.getString("label.run_groovy_tip"));
1292     runGroovy.addActionListener(new ActionListener()
1293     {
1294       @Override
1295       public void actionPerformed(ActionEvent e)
1296       {
1297         runGroovy_actionPerformed();
1298       }
1299     });
1300
1301     JMenuItem openFeatureSettings = new JMenuItem(
1302             MessageManager.getString("action.feature_settings"));
1303     openFeatureSettings.addActionListener(new ActionListener()
1304     {
1305       @Override
1306       public void actionPerformed(ActionEvent e)
1307       {
1308         featureSettings_actionPerformed(e);
1309       }
1310     });
1311     JMenuItem fetchSequence = new JMenuItem(
1312             MessageManager.getString("label.fetch_sequences"));
1313     fetchSequence.addActionListener(new ActionListener()
1314     {
1315       @Override
1316       public void actionPerformed(ActionEvent e)
1317       {
1318         fetchSequence_actionPerformed(e);
1319       }
1320     });
1321
1322     JMenuItem associatedData = new JMenuItem(
1323             MessageManager.getString("label.load_features_annotations"));
1324     associatedData.addActionListener(new ActionListener()
1325     {
1326       @Override
1327       public void actionPerformed(ActionEvent e)
1328       {
1329         associatedData_actionPerformed(e);
1330       }
1331     });
1332     loadVcf = new JMenuItem(MessageManager.getString("label.load_vcf_file"));
1333     loadVcf.setToolTipText(MessageManager.getString("label.load_vcf"));
1334     loadVcf.addActionListener(new ActionListener()
1335     {
1336       @Override
1337       public void actionPerformed(ActionEvent e)
1338       {
1339         loadVcf_actionPerformed();
1340       }
1341     });
1342     autoCalculate.setText(
1343             MessageManager.getString("label.autocalculate_consensus"));
1344     autoCalculate.setState(
1345             jalview.bin.Cache.getDefault("AUTO_CALC_CONSENSUS", true));
1346     autoCalculate.addActionListener(new ActionListener()
1347     {
1348       @Override
1349       public void actionPerformed(ActionEvent e)
1350       {
1351         autoCalculate_actionPerformed(e);
1352       }
1353     });
1354     sortByTree.setText(
1355             MessageManager.getString("label.sort_alignment_new_tree"));
1356     sortByTree.setToolTipText("<html>" + MessageManager.getString(
1357             "label.enable_automatically_sort_alignment_when_open_new_tree"));
1358     sortByTree
1359             .setState(jalview.bin.Cache.getDefault("SORT_BY_TREE", false));
1360     sortByTree.addActionListener(new ActionListener()
1361     {
1362       @Override
1363       public void actionPerformed(ActionEvent e)
1364       {
1365         sortByTreeOption_actionPerformed(e);
1366       }
1367     });
1368
1369     listenToViewSelections.setText(
1370             MessageManager.getString("label.listen_for_selections"));
1371     listenToViewSelections
1372             .setToolTipText("<html>" + MessageManager.getString(
1373                     "label.selections_mirror_selections_made_same_sequences_other_views"));
1374     listenToViewSelections.setState(false);
1375     listenToViewSelections.addActionListener(new ActionListener()
1376     {
1377       @Override
1378       public void actionPerformed(ActionEvent e)
1379       {
1380         listenToViewSelections_actionPerformed(e);
1381       }
1382     });
1383
1384     JMenu addSequenceMenu = new JMenu(
1385             MessageManager.getString("label.add_sequences"));
1386     JMenuItem addFromFile = new JMenuItem(
1387             MessageManager.getString("label.from_file"));
1388     addFromFile.addActionListener(new ActionListener()
1389     {
1390       @Override
1391       public void actionPerformed(ActionEvent e)
1392       {
1393         addFromFile_actionPerformed(e);
1394       }
1395     });
1396     JMenuItem addFromText = new JMenuItem(
1397             MessageManager.getString("label.from_textbox"));
1398     addFromText.addActionListener(new ActionListener()
1399     {
1400       @Override
1401       public void actionPerformed(ActionEvent e)
1402       {
1403         addFromText_actionPerformed(e);
1404       }
1405     });
1406     JMenuItem addFromURL = new JMenuItem(
1407             MessageManager.getString("label.from_url"));
1408     addFromURL.addActionListener(new ActionListener()
1409     {
1410       @Override
1411       public void actionPerformed(ActionEvent e)
1412       {
1413         addFromURL_actionPerformed(e);
1414       }
1415     });
1416     JMenuItem exportFeatures = new JMenuItem(
1417             MessageManager.getString("label.export_features"));
1418     exportFeatures.addActionListener(new ActionListener()
1419     {
1420       @Override
1421       public void actionPerformed(ActionEvent e)
1422       {
1423         exportFeatures_actionPerformed(e);
1424       }
1425     });
1426     JMenuItem exportAnnotations = new JMenuItem(
1427             MessageManager.getString("label.export_annotations"));
1428     exportAnnotations.addActionListener(new ActionListener()
1429     {
1430       @Override
1431       public void actionPerformed(ActionEvent e)
1432       {
1433         exportAnnotations_actionPerformed(e);
1434       }
1435     });
1436     statusPanel.setLayout(new GridLayout());
1437     JMenuItem showAllSeqs = new JMenuItem(
1438             MessageManager.getString("label.all_sequences"));
1439     showAllSeqs.setToolTipText(
1440             MessageManager.getString("label.toggle_sequence_visibility"));
1441     showAllSeqs.addActionListener(new ActionListener()
1442     {
1443       @Override
1444       public void actionPerformed(ActionEvent e)
1445       {
1446         showAllSeqs_actionPerformed(e);
1447       }
1448     });
1449     JMenuItem showAllColumns = new JMenuItem(
1450             MessageManager.getString("label.all_columns"));
1451     showAllColumns.setToolTipText(
1452             MessageManager.getString("label.toggle_columns_visibility"));
1453     showAllColumns.addActionListener(new ActionListener()
1454     {
1455       @Override
1456       public void actionPerformed(ActionEvent e)
1457       {
1458         showAllColumns_actionPerformed(e);
1459       }
1460     });
1461     JMenu hideMenu = new JMenu(MessageManager.getString("action.hide"));
1462     JMenuItem hideSelSequences = new JMenuItem(
1463             MessageManager.getString("label.selected_sequences"));
1464     hideSelSequences.setToolTipText(
1465             MessageManager.getString("label.toggle_sequence_visibility"));
1466     hideSelSequences.addActionListener(new ActionListener()
1467     {
1468       @Override
1469       public void actionPerformed(ActionEvent e)
1470       {
1471         hideSelSequences_actionPerformed(e);
1472       }
1473     });
1474     JMenuItem hideSelColumns = new JMenuItem(
1475             MessageManager.getString("label.selected_columns"));
1476     hideSelColumns.setToolTipText(
1477             MessageManager.getString("label.toggle_columns_visibility"));
1478     hideSelColumns.addActionListener(new ActionListener()
1479     {
1480       @Override
1481       public void actionPerformed(ActionEvent e)
1482       {
1483         hideSelColumns_actionPerformed(e);
1484       }
1485     });
1486     JMenuItem hideAllSelection = new JMenuItem(
1487             MessageManager.getString("label.selected_region"));
1488     hideAllSelection.addActionListener(new ActionListener()
1489     {
1490       @Override
1491       public void actionPerformed(ActionEvent e)
1492       {
1493         hideAllSelection_actionPerformed(e);
1494       }
1495     });
1496     // TODO: should be hidden if no selection exists.
1497     JMenuItem hideAllButSelection = new JMenuItem(
1498             MessageManager.getString("label.all_but_selected_region"));
1499     hideAllButSelection.addActionListener(new ActionListener()
1500     {
1501       @Override
1502       public void actionPerformed(ActionEvent e)
1503       {
1504         hideAllButSelection_actionPerformed(e);
1505       }
1506     });
1507     JMenuItem showAllhidden = new JMenuItem(
1508             MessageManager.getString("label.all_sequences_columns"));
1509     showAllhidden.setToolTipText(MessageManager
1510             .getString("label.toggles_visibility_hidden_selected_regions"));
1511     showAllhidden.addActionListener(new ActionListener()
1512     {
1513       @Override
1514       public void actionPerformed(ActionEvent e)
1515       {
1516         showAllhidden_actionPerformed(e);
1517       }
1518     });
1519     hiddenMarkers.setText(
1520             MessageManager.getString("action.show_hidden_markers"));
1521     hiddenMarkers.addActionListener(new ActionListener()
1522     {
1523       @Override
1524       public void actionPerformed(ActionEvent e)
1525       {
1526         hiddenMarkers_actionPerformed(e);
1527       }
1528     });
1529
1530     JMenuItem invertColSel = new JMenuItem(
1531             MessageManager.getString("action.invert_column_selection"));
1532     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_I,
1533             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()
1534                     | KeyEvent.ALT_MASK,
1535             false);
1536     al = new ActionListener()
1537     {
1538       @Override
1539       public void actionPerformed(ActionEvent e)
1540       {
1541         invertColSel_actionPerformed(e);
1542       }
1543     };
1544     addMenuActionAndAccelerator(keyStroke, invertColSel, al);
1545
1546     showComplementMenuItem.setVisible(false);
1547     showComplementMenuItem.addActionListener(new ActionListener()
1548     {
1549       @Override
1550       public void actionPerformed(ActionEvent e)
1551       {
1552         showComplement_actionPerformed(showComplementMenuItem.getState());
1553       }
1554     });
1555
1556     tabbedPane.addChangeListener(new javax.swing.event.ChangeListener()
1557     {
1558       @Override
1559       public void stateChanged(ChangeEvent evt)
1560       {
1561         JTabbedPane pane = (JTabbedPane) evt.getSource();
1562         int sel = pane.getSelectedIndex();
1563         tabSelectionChanged(sel);
1564       }
1565     });
1566     tabbedPane.addMouseListener(new MouseAdapter()
1567     {
1568       @Override
1569       public void mousePressed(MouseEvent e)
1570       {
1571         if (e.isPopupTrigger()) // Mac
1572         {
1573           tabbedPane_mousePressed(e);
1574         }
1575       }
1576
1577       @Override
1578       public void mouseReleased(MouseEvent e)
1579       {
1580         if (e.isPopupTrigger()) // Windows
1581         {
1582           tabbedPane_mousePressed(e);
1583         }
1584       }
1585     });
1586     tabbedPane.addFocusListener(new FocusAdapter()
1587     {
1588       @Override
1589       public void focusGained(FocusEvent e)
1590       {
1591         tabbedPane_focusGained(e);
1592       }
1593     });
1594
1595     JMenuItem save = new JMenuItem(MessageManager.getString("action.save"));
1596     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_S,
1597             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
1598     al = new ActionListener()
1599     {
1600       @Override
1601       public void actionPerformed(ActionEvent e)
1602       {
1603         save_actionPerformed(e);
1604       }
1605     };
1606     addMenuActionAndAccelerator(keyStroke, save, al);
1607
1608     reload.setEnabled(false);
1609     reload.setText(MessageManager.getString("action.reload"));
1610     reload.addActionListener(new ActionListener()
1611     {
1612       @Override
1613       public void actionPerformed(ActionEvent e)
1614       {
1615         reload_actionPerformed(e);
1616       }
1617     });
1618
1619     JMenuItem newView = new JMenuItem(
1620             MessageManager.getString("action.new_view"));
1621     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_T,
1622             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
1623     al = new ActionListener()
1624     {
1625       @Override
1626       public void actionPerformed(ActionEvent e)
1627       {
1628         newView_actionPerformed(e);
1629       }
1630     };
1631     addMenuActionAndAccelerator(keyStroke, newView, al);
1632
1633     tabbedPane.setToolTipText("<html><i>"
1634             + MessageManager.getString("label.rename_tab_eXpand_reGroup")
1635             + "</i></html>");
1636
1637     formatMenu.setText(MessageManager.getString("action.format"));
1638     JMenu selectMenu = new JMenu(MessageManager.getString("action.select"));
1639
1640     idRightAlign.setText(
1641             MessageManager.getString("label.right_align_sequence_id"));
1642     idRightAlign.addActionListener(new ActionListener()
1643     {
1644       @Override
1645       public void actionPerformed(ActionEvent e)
1646       {
1647         idRightAlign_actionPerformed(e);
1648       }
1649     });
1650
1651     gatherViews.setEnabled(false);
1652     gatherViews.setText(MessageManager.getString("action.gather_views"));
1653     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G, 0, false);
1654     al = new ActionListener()
1655     {
1656       @Override
1657       public void actionPerformed(ActionEvent e)
1658       {
1659         gatherViews_actionPerformed(e);
1660       }
1661     };
1662     addMenuActionAndAccelerator(keyStroke, gatherViews, al);
1663
1664     expandViews.setEnabled(false);
1665     expandViews.setText(MessageManager.getString("action.expand_views"));
1666     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_X, 0, false);
1667     al = new ActionListener()
1668     {
1669       @Override
1670       public void actionPerformed(ActionEvent e)
1671       {
1672         expandViews_actionPerformed(e);
1673       }
1674     };
1675     addMenuActionAndAccelerator(keyStroke, expandViews, al);
1676
1677     JMenuItem pageSetup = new JMenuItem(
1678             MessageManager.getString("action.page_setup"));
1679     pageSetup.addActionListener(new ActionListener()
1680     {
1681       @Override
1682       public void actionPerformed(ActionEvent e)
1683       {
1684         pageSetup_actionPerformed(e);
1685       }
1686     });
1687     JMenuItem alignmentProperties = new JMenuItem(
1688             MessageManager.getString("label.alignment_props"));
1689     alignmentProperties.addActionListener(new ActionListener()
1690     {
1691       @Override
1692       public void actionPerformed(ActionEvent actionEvent)
1693       {
1694         alignmentProperties();
1695       }
1696     });
1697     JMenuItem selectHighlighted = new JMenuItem(
1698             MessageManager.getString("action.select_highlighted_columns"));
1699     selectHighlighted.setToolTipText(
1700             MessageManager.getString("tooltip.select_highlighted_columns"));
1701     al = new ActionListener()
1702     {
1703       @Override
1704       public void actionPerformed(ActionEvent actionEvent)
1705       {
1706         selectHighlightedColumns_actionPerformed(actionEvent);
1707       }
1708     };
1709     selectHighlighted.addActionListener(al);
1710     JMenu tooltipSettingsMenu = new JMenu(
1711             MessageManager.getString("label.sequence_id_tooltip"));
1712     JMenu autoAnnMenu = new JMenu(
1713             MessageManager.getString("label.autocalculated_annotation"));
1714
1715     JMenu exportImageMenu = new JMenu(
1716             MessageManager.getString("label.export_image"));
1717     JMenu fileMenu = new JMenu(MessageManager.getString("action.file"));
1718     alignFrameMenuBar.add(fileMenu);
1719     alignFrameMenuBar.add(editMenu);
1720     alignFrameMenuBar.add(selectMenu);
1721     alignFrameMenuBar.add(viewMenu);
1722     alignFrameMenuBar.add(annotationsMenu);
1723     alignFrameMenuBar.add(formatMenu);
1724     alignFrameMenuBar.add(colourMenu);
1725     alignFrameMenuBar.add(calculateMenu);
1726     alignFrameMenuBar.add(webService);
1727
1728     fileMenu.add(fetchSequence);
1729     fileMenu.add(addSequenceMenu);
1730     fileMenu.add(reload);
1731     fileMenu.addSeparator();
1732     fileMenu.add(vamsasStore);
1733     fileMenu.add(save);
1734     fileMenu.add(saveAs);
1735     fileMenu.add(outputTextboxMenu);
1736     fileMenu.add(pageSetup);
1737     fileMenu.add(printMenuItem);
1738     fileMenu.addSeparator();
1739     fileMenu.add(exportImageMenu);
1740     fileMenu.add(exportFeatures);
1741     fileMenu.add(exportAnnotations);
1742     fileMenu.add(loadTreeMenuItem);
1743     fileMenu.add(associatedData);
1744     fileMenu.add(loadVcf);
1745     fileMenu.addSeparator();
1746     fileMenu.add(closeMenuItem);
1747
1748     pasteMenu.add(pasteNew);
1749     pasteMenu.add(pasteThis);
1750     editMenu.add(undoMenuItem);
1751     editMenu.add(redoMenuItem);
1752     editMenu.add(cut);
1753     editMenu.add(copy);
1754     editMenu.add(pasteMenu);
1755     editMenu.add(delete);
1756     editMenu.addSeparator();
1757     editMenu.add(remove2LeftMenuItem);
1758     editMenu.add(remove2RightMenuItem);
1759     editMenu.add(removeGappedColumnMenuItem);
1760     editMenu.add(removeAllGapsMenuItem);
1761     editMenu.add(removeRedundancyMenuItem);
1762     editMenu.addSeparator();
1763     // dont add these yet in the CVS build - they cannot be undone!
1764     // Excluded from Jalview 2.5 release - undo needs to be implemented.
1765     // editMenu.add(justifyLeftMenuItem);
1766     // editMenu.add(justifyRightMenuItem);
1767     // editMenu.addSeparator();
1768     editMenu.add(padGapsMenuitem);
1769
1770     showMenu.add(showAllColumns);
1771     showMenu.add(showAllSeqs);
1772     showMenu.add(showAllhidden);
1773     hideMenu.add(hideSelColumns);
1774     hideMenu.add(hideSelSequences);
1775     hideMenu.add(hideAllSelection);
1776     hideMenu.add(hideAllButSelection);
1777     viewMenu.add(newView);
1778     viewMenu.add(expandViews);
1779     viewMenu.add(gatherViews);
1780     viewMenu.addSeparator();
1781     viewMenu.add(showMenu);
1782     viewMenu.add(hideMenu);
1783     viewMenu.add(showComplementMenuItem);
1784     viewMenu.addSeparator();
1785     viewMenu.add(followHighlightMenuItem);
1786     viewMenu.addSeparator();
1787     viewMenu.add(showSeqFeatures);
1788     // viewMenu.add(showSeqFeaturesHeight);
1789     viewMenu.add(openFeatureSettings);
1790     tooltipSettingsMenu.add(showDbRefsMenuitem);
1791     tooltipSettingsMenu.add(showNpFeatsMenuitem);
1792     viewMenu.add(tooltipSettingsMenu);
1793     viewMenu.addSeparator();
1794     viewMenu.add(alignmentProperties);
1795     viewMenu.addSeparator();
1796     viewMenu.add(overviewMenuItem);
1797
1798     annotationsMenu.add(annotationPanelMenuItem);
1799     annotationsMenu.addSeparator();
1800     annotationsMenu.add(showAllAlAnnotations);
1801     annotationsMenu.add(hideAllAlAnnotations);
1802     annotationsMenu.addSeparator();
1803     annotationsMenu.add(showAllSeqAnnotations);
1804     annotationsMenu.add(hideAllSeqAnnotations);
1805     annotationsMenu.add(sortAnnBySequence);
1806     annotationsMenu.add(sortAnnByLabel);
1807     annotationsMenu.addSeparator();
1808     autoAnnMenu.add(showAutoFirst);
1809     autoAnnMenu.add(showAutoLast);
1810     autoAnnMenu.addSeparator();
1811     autoAnnMenu.add(applyAutoAnnotationSettings);
1812     autoAnnMenu.add(showConsensusHistogram);
1813     autoAnnMenu.add(showSequenceLogo);
1814     autoAnnMenu.add(normaliseSequenceLogo);
1815     autoAnnMenu.addSeparator();
1816     autoAnnMenu.add(showGroupConservation);
1817     autoAnnMenu.add(showGroupConsensus);
1818     annotationsMenu.add(autoAnnMenu);
1819
1820     sort.add(sortIDMenuItem);
1821     sort.add(sortLengthMenuItem);
1822     sort.add(sortGroupMenuItem);
1823     sort.add(sortPairwiseMenuItem);
1824     sort.add(sortByTreeMenu);
1825     calculateMenu.add(sort);
1826     calculateMenu.add(calculateTree);
1827     calculateMenu.addSeparator();
1828     calculateMenu.add(pairwiseAlignmentMenuItem);
1829     calculateMenu.addSeparator();
1830     calculateMenu.add(showTranslation);
1831     calculateMenu.add(showReverse);
1832     calculateMenu.add(showReverseComplement);
1833     calculateMenu.add(showProducts);
1834     calculateMenu.add(autoCalculate);
1835     calculateMenu.add(sortByTree);
1836     calculateMenu.addSeparator();
1837     calculateMenu.add(expandAlignment);
1838     calculateMenu.add(extractScores);
1839     calculateMenu.addSeparator();
1840     calculateMenu.add(runGroovy);
1841
1842     webServiceNoServices = new JMenuItem(
1843             MessageManager.getString("label.no_services"));
1844     webService.add(webServiceNoServices);
1845     exportImageMenu.add(htmlMenuItem);
1846     exportImageMenu.add(epsFile);
1847     exportImageMenu.add(createPNG);
1848     exportImageMenu.add(createBioJS);
1849     exportImageMenu.add(createSVG);
1850     addSequenceMenu.add(addFromFile);
1851     addSequenceMenu.add(addFromText);
1852     addSequenceMenu.add(addFromURL);
1853     this.getContentPane().add(statusPanel, java.awt.BorderLayout.SOUTH);
1854     statusPanel.add(statusBar, null);
1855     this.getContentPane().add(tabbedPane, java.awt.BorderLayout.CENTER);
1856
1857     formatMenu.add(font);
1858     formatMenu.addSeparator();
1859     formatMenu.add(wrapMenuItem);
1860     formatMenu.add(scaleAbove);
1861     formatMenu.add(scaleLeft);
1862     formatMenu.add(scaleRight);
1863     formatMenu.add(seqLimits);
1864     formatMenu.add(idRightAlign);
1865     formatMenu.add(hiddenMarkers);
1866     formatMenu.add(viewBoxesMenuItem);
1867     formatMenu.add(viewTextMenuItem);
1868     formatMenu.add(colourTextMenuItem);
1869     formatMenu.add(renderGapsMenuItem);
1870     formatMenu.add(centreColumnLabelsMenuItem);
1871     formatMenu.add(showNonconservedMenuItem);
1872     selectMenu.add(findMenuItem);
1873     selectMenu.addSeparator();
1874     selectMenu.add(selectAllSequenceMenuItem);
1875     selectMenu.add(deselectAllSequenceMenuItem);
1876     selectMenu.add(invertSequenceMenuItem);
1877     selectMenu.add(invertColSel);
1878     selectMenu.add(createGroup);
1879     selectMenu.add(unGroup);
1880     selectMenu.add(grpsFromSelection);
1881     selectMenu.add(deleteGroups);
1882     selectMenu.add(annotationColumn);
1883     selectMenu.add(selectHighlighted);
1884     // TODO - determine if the listenToViewSelections button is needed : see bug
1885     // JAL-574
1886     // selectMenu.addSeparator();
1887     // selectMenu.add(listenToViewSelections);
1888   }
1889
1890   protected void loadVcf_actionPerformed()
1891   {
1892   }
1893
1894   /**
1895    * Constructs the entries on the Colour menu (but does not add them to the
1896    * menu).
1897    */
1898   protected void initColourMenu()
1899   {
1900     applyToAllGroups = new JCheckBoxMenuItem(
1901             MessageManager.getString("label.apply_colour_to_all_groups"));
1902     applyToAllGroups.addActionListener(new ActionListener()
1903     {
1904       @Override
1905       public void actionPerformed(ActionEvent e)
1906       {
1907         applyToAllGroups_actionPerformed(applyToAllGroups.isSelected());
1908       }
1909     });
1910
1911     textColour = new JMenuItem(
1912             MessageManager.getString("label.text_colour"));
1913     textColour.addActionListener(new ActionListener()
1914     {
1915       @Override
1916       public void actionPerformed(ActionEvent e)
1917       {
1918         textColour_actionPerformed();
1919       }
1920     });
1921
1922     conservationMenuItem = new JCheckBoxMenuItem(
1923             MessageManager.getString("action.by_conservation"));
1924     conservationMenuItem.addActionListener(new ActionListener()
1925     {
1926       @Override
1927       public void actionPerformed(ActionEvent e)
1928       {
1929         conservationMenuItem_actionPerformed(
1930                 conservationMenuItem.isSelected());
1931       }
1932     });
1933
1934     abovePIDThreshold = new JCheckBoxMenuItem(
1935             MessageManager.getString("label.above_identity_threshold"));
1936     abovePIDThreshold.addActionListener(new ActionListener()
1937     {
1938       @Override
1939       public void actionPerformed(ActionEvent e)
1940       {
1941         abovePIDThreshold_actionPerformed(abovePIDThreshold.isSelected());
1942       }
1943     });
1944     modifyPID = new JMenuItem(
1945             MessageManager.getString("label.modify_identity_threshold"));
1946     modifyPID.addActionListener(new ActionListener()
1947     {
1948       @Override
1949       public void actionPerformed(ActionEvent e)
1950       {
1951         modifyPID_actionPerformed();
1952       }
1953     });
1954     modifyConservation = new JMenuItem(MessageManager
1955             .getString("label.modify_conservation_threshold"));
1956     modifyConservation.addActionListener(new ActionListener()
1957     {
1958       @Override
1959       public void actionPerformed(ActionEvent e)
1960       {
1961         modifyConservation_actionPerformed();
1962       }
1963     });
1964
1965     annotationColour = new JMenuItem(
1966             MessageManager.getString("action.by_annotation"));
1967     annotationColour.addActionListener(new ActionListener()
1968     {
1969       @Override
1970       public void actionPerformed(ActionEvent e)
1971       {
1972         annotationColour_actionPerformed();
1973       }
1974     });
1975   }
1976
1977   protected void selectHighlightedColumns_actionPerformed(
1978           ActionEvent actionEvent)
1979   {
1980     // TODO Auto-generated method stub
1981
1982   }
1983
1984   /**
1985    * Generate the reverse sequence (or reverse complement if the flag is true)
1986    * and add it to the alignment
1987    * 
1988    * @param complement
1989    */
1990   protected void showReverse_actionPerformed(boolean complement)
1991   {
1992   }
1993
1994   /**
1995    * Try to run script in a Groovy console, having first ensured that this
1996    * alignframe is set as currentAlignFrame in Desktop
1997    */
1998   protected void runGroovy_actionPerformed()
1999   {
2000
2001   }
2002
2003   /**
2004    * Adds the given action listener and key accelerator to the given menu item.
2005    * Also saves in a lookup table to support lookup of action by key stroke.
2006    * 
2007    * @param keyStroke
2008    * @param menuItem
2009    * @param actionListener
2010    */
2011   protected void addMenuActionAndAccelerator(KeyStroke keyStroke,
2012           JMenuItem menuItem, ActionListener actionListener)
2013   {
2014     menuItem.setAccelerator(keyStroke);
2015     accelerators.put(keyStroke, menuItem);
2016     menuItem.addActionListener(actionListener);
2017   }
2018
2019   /**
2020    * Action on clicking sort annotations by type.
2021    * 
2022    * @param sortOrder
2023    */
2024   protected void sortAnnotations_actionPerformed()
2025   {
2026   }
2027
2028   /**
2029    * Action on clicking Show all annotations.
2030    * 
2031    * @param forSequences
2032    *          update sequence-related annotations
2033    * @param forAlignment
2034    *          update non-sequence-related annotations
2035    */
2036   protected void showAllAnnotations_actionPerformed(boolean forSequences,
2037           boolean forAlignment)
2038   {
2039     setAnnotationsVisibility(true, forSequences, forAlignment);
2040   }
2041
2042   /**
2043    * Action on clicking Hide all annotations.
2044    * 
2045    * @param forSequences
2046    *          update sequence-related annotations
2047    * @param forAlignment
2048    *          update non-sequence-related annotations
2049    */
2050   protected void hideAllAnnotations_actionPerformed(boolean forSequences,
2051           boolean forAlignment)
2052   {
2053     setAnnotationsVisibility(false, forSequences, forAlignment);
2054   }
2055
2056   /**
2057    * Set the visibility of annotations to true or false. Can act on
2058    * sequence-related annotations, or alignment-related, or both.
2059    * 
2060    * @param visible
2061    * @param forSequences
2062    *          update sequence-related annotations
2063    * @param forAlignment
2064    *          update non-sequence-related annotations
2065    */
2066   protected void setAnnotationsVisibility(boolean visible,
2067           boolean forSequences, boolean forAlignment)
2068   {
2069
2070   }
2071
2072   protected void normaliseSequenceLogo_actionPerformed(ActionEvent e)
2073   {
2074     // TODO Auto-generated method stub
2075
2076   }
2077
2078   protected void listenToViewSelections_actionPerformed(ActionEvent e)
2079   {
2080     // TODO Auto-generated method stub
2081
2082   }
2083
2084   protected void showAllhidden_actionPerformed(ActionEvent e)
2085   {
2086     // TODO Auto-generated method stub
2087
2088   }
2089
2090   protected void hideAllButSelection_actionPerformed(ActionEvent e)
2091   {
2092     // TODO Auto-generated method stub
2093
2094   }
2095
2096   protected void hideAllSelection_actionPerformed(ActionEvent e)
2097   {
2098     // TODO Auto-generated method stub
2099
2100   }
2101
2102   protected void applyAutoAnnotationSettings_actionPerformed(ActionEvent e)
2103   {
2104     // TODO Auto-generated method stub
2105
2106   }
2107
2108   protected void showConsensusHistogram_actionPerformed(ActionEvent e)
2109   {
2110     // TODO Auto-generated method stub
2111
2112   }
2113
2114   protected void showSequenceLogo_actionPerformed(ActionEvent e)
2115   {
2116     // TODO Auto-generated method stub
2117
2118   }
2119
2120   protected void makeGrpsFromSelection_actionPerformed(ActionEvent e)
2121   {
2122     // TODO Auto-generated method stub
2123
2124   }
2125
2126   protected void showGroupConsensus_actionPerformed(ActionEvent e)
2127   {
2128     // TODO Auto-generated method stub
2129
2130   }
2131
2132   protected void showGroupConservation_actionPerformed(ActionEvent e)
2133   {
2134     // TODO Auto-generated method stub
2135
2136   }
2137
2138   protected void showUnconservedMenuItem_actionPerformed(ActionEvent e)
2139   {
2140     // TODO Auto-generated method stub
2141
2142   }
2143
2144   protected void justifyRightMenuItem_actionPerformed(ActionEvent e)
2145   {
2146     // TODO Auto-generated method stub
2147
2148   }
2149
2150   protected void justifyLeftMenuItem_actionPerformed(ActionEvent e)
2151   {
2152     // TODO Auto-generated method stub
2153
2154   }
2155
2156   protected void followHighlight_actionPerformed()
2157   {
2158     // TODO Auto-generated method stub
2159
2160   }
2161
2162   protected void showNpFeats_actionPerformed(ActionEvent e)
2163   {
2164     // TODO Auto-generated method stub
2165
2166   }
2167
2168   protected void showDbRefs_actionPerformed(ActionEvent e)
2169   {
2170     // TODO Auto-generated method stub
2171
2172   }
2173
2174   protected void centreColumnLabels_actionPerformed(ActionEvent e)
2175   {
2176   }
2177
2178   protected void buildSortByAnnotationScoresMenu()
2179   {
2180   }
2181
2182   protected void extractScores_actionPerformed(ActionEvent e)
2183   {
2184   }
2185
2186   protected void outputText_actionPerformed(ActionEvent e)
2187   {
2188   }
2189
2190   public void addFromFile_actionPerformed(ActionEvent e)
2191   {
2192
2193   }
2194
2195   public void addFromText_actionPerformed(ActionEvent e)
2196   {
2197
2198   }
2199
2200   public void addFromURL_actionPerformed(ActionEvent e)
2201   {
2202
2203   }
2204
2205   public void exportFeatures_actionPerformed(ActionEvent e)
2206   {
2207
2208   }
2209
2210   public void exportAnnotations_actionPerformed(ActionEvent e)
2211   {
2212
2213   }
2214
2215   protected void htmlMenuItem_actionPerformed(ActionEvent e)
2216   {
2217   }
2218
2219   protected void bioJSMenuItem_actionPerformed(ActionEvent e)
2220   {
2221
2222   }
2223
2224   protected void closeMenuItem_actionPerformed(boolean b)
2225   {
2226   }
2227
2228   protected void redoMenuItem_actionPerformed(ActionEvent e)
2229   {
2230   }
2231
2232   protected void undoMenuItem_actionPerformed(ActionEvent e)
2233   {
2234   }
2235
2236   protected void selectAllSequenceMenuItem_actionPerformed(ActionEvent e)
2237   {
2238   }
2239
2240   protected void deselectAllSequenceMenuItem_actionPerformed(ActionEvent e)
2241   {
2242   }
2243
2244   protected void invertSequenceMenuItem_actionPerformed(ActionEvent e)
2245   {
2246   }
2247
2248   protected void remove2LeftMenuItem_actionPerformed(ActionEvent e)
2249   {
2250   }
2251
2252   protected void remove2RightMenuItem_actionPerformed(ActionEvent e)
2253   {
2254   }
2255
2256   protected void removeGappedColumnMenuItem_actionPerformed(ActionEvent e)
2257   {
2258   }
2259
2260   protected void removeAllGapsMenuItem_actionPerformed(ActionEvent e)
2261   {
2262   }
2263
2264   protected void wrapMenuItem_actionPerformed(ActionEvent e)
2265   {
2266   }
2267
2268   protected void viewBoxesMenuItem_actionPerformed(ActionEvent e)
2269   {
2270   }
2271
2272   protected void viewTextMenuItem_actionPerformed(ActionEvent e)
2273   {
2274   }
2275
2276   protected void colourTextMenuItem_actionPerformed(ActionEvent e)
2277   {
2278   }
2279
2280   protected void annotationPanelMenuItem_actionPerformed(ActionEvent e)
2281   {
2282   }
2283
2284   protected void overviewMenuItem_actionPerformed(ActionEvent e)
2285   {
2286   }
2287
2288   protected void sortPairwiseMenuItem_actionPerformed(ActionEvent e)
2289   {
2290   }
2291
2292   protected void sortIDMenuItem_actionPerformed(ActionEvent e)
2293   {
2294   }
2295
2296   protected void sortLengthMenuItem_actionPerformed(ActionEvent e)
2297   {
2298   }
2299
2300   protected void sortGroupMenuItem_actionPerformed(ActionEvent e)
2301   {
2302   }
2303
2304   protected void removeRedundancyMenuItem_actionPerformed(ActionEvent e)
2305   {
2306   }
2307
2308   protected void pairwiseAlignmentMenuItem_actionPerformed(ActionEvent e)
2309   {
2310   }
2311
2312   protected void neighbourTreeMenuItem_actionPerformed(ActionEvent e)
2313   {
2314   }
2315
2316   protected void conservationMenuItem_actionPerformed(boolean selected)
2317   {
2318   }
2319
2320   protected void printMenuItem_actionPerformed(ActionEvent e)
2321   {
2322   }
2323
2324   protected void renderGapsMenuItem_actionPerformed(ActionEvent e)
2325   {
2326   }
2327
2328   protected void findMenuItem_actionPerformed(ActionEvent e)
2329   {
2330   }
2331
2332   protected void abovePIDThreshold_actionPerformed(boolean selected)
2333   {
2334   }
2335
2336   public void showSeqFeatures_actionPerformed(ActionEvent actionEvent)
2337   {
2338   }
2339
2340   protected void deleteGroups_actionPerformed(ActionEvent e)
2341   {
2342   }
2343
2344   protected void createGroup_actionPerformed(ActionEvent e)
2345   {
2346   }
2347
2348   protected void unGroup_actionPerformed(ActionEvent e)
2349   {
2350   }
2351
2352   protected void copy_actionPerformed(ActionEvent e)
2353   {
2354   }
2355
2356   protected void cut_actionPerformed(ActionEvent e)
2357   {
2358   }
2359
2360   protected void delete_actionPerformed(ActionEvent e)
2361   {
2362   }
2363
2364   protected void pasteNew_actionPerformed(ActionEvent e)
2365   {
2366   }
2367
2368   protected void pasteThis_actionPerformed(ActionEvent e)
2369   {
2370   }
2371
2372   protected void applyToAllGroups_actionPerformed(boolean selected)
2373   {
2374   }
2375
2376   public void createPNG(java.io.File f)
2377   {
2378   }
2379
2380   protected void font_actionPerformed(ActionEvent e)
2381   {
2382   }
2383
2384   protected void seqLimit_actionPerformed(ActionEvent e)
2385   {
2386   }
2387
2388   public void seqDBRef_actionPerformed(ActionEvent e)
2389   {
2390
2391   }
2392
2393   public void createEPS(java.io.File f)
2394   {
2395   }
2396
2397   public void createSVG(java.io.File f)
2398   {
2399
2400   }
2401
2402   protected void loadTreeMenuItem_actionPerformed(ActionEvent e)
2403   {
2404
2405   }
2406
2407   /**
2408    * Template method to handle the 'load T-Coffee scores' menu event.
2409    * <p>
2410    * Subclasses override this method to provide a custom action.
2411    * 
2412    * @param event
2413    *          The raised event
2414    */
2415   protected void loadScores_actionPerformed(ActionEvent event)
2416   {
2417
2418   }
2419
2420   protected void jpred_actionPerformed(ActionEvent e)
2421   {
2422   }
2423
2424   protected void scaleAbove_actionPerformed(ActionEvent e)
2425   {
2426   }
2427
2428   protected void scaleLeft_actionPerformed(ActionEvent e)
2429   {
2430   }
2431
2432   protected void scaleRight_actionPerformed(ActionEvent e)
2433   {
2434   }
2435
2436   protected void modifyPID_actionPerformed()
2437   {
2438   }
2439
2440   protected void modifyConservation_actionPerformed()
2441   {
2442   }
2443
2444   protected void saveAs_actionPerformed(ActionEvent e)
2445   {
2446   }
2447
2448   protected void padGapsMenuitem_actionPerformed(ActionEvent e)
2449   {
2450   }
2451
2452   public void vamsasStore_actionPerformed(ActionEvent e)
2453   {
2454
2455   }
2456
2457   public void vamsasLoad_actionPerformed(ActionEvent e)
2458   {
2459
2460   }
2461
2462   public void showTranslation_actionPerformed(GeneticCodeI codeTable)
2463   {
2464
2465   }
2466
2467   public void featureSettings_actionPerformed(ActionEvent e)
2468   {
2469
2470   }
2471
2472   public void fetchSequence_actionPerformed(ActionEvent e)
2473   {
2474
2475   }
2476
2477   public void smoothFont_actionPerformed(ActionEvent e)
2478   {
2479
2480   }
2481
2482   public void annotationColour_actionPerformed()
2483   {
2484   }
2485
2486   public void annotationColumn_actionPerformed(ActionEvent e)
2487   {
2488   }
2489
2490   public void associatedData_actionPerformed(ActionEvent e)
2491   {
2492
2493   }
2494
2495   public void autoCalculate_actionPerformed(ActionEvent e)
2496   {
2497
2498   }
2499
2500   public void sortByTreeOption_actionPerformed(ActionEvent e)
2501   {
2502
2503   }
2504
2505   public void showAllSeqs_actionPerformed(ActionEvent e)
2506   {
2507
2508   }
2509
2510   public void showAllColumns_actionPerformed(ActionEvent e)
2511   {
2512
2513   }
2514
2515   public void hideSelSequences_actionPerformed(ActionEvent e)
2516   {
2517
2518   }
2519
2520   public void hideSelColumns_actionPerformed(ActionEvent e)
2521   {
2522
2523   }
2524
2525   public void hiddenMarkers_actionPerformed(ActionEvent e)
2526   {
2527
2528   }
2529
2530   public void findPdbId_actionPerformed(ActionEvent e)
2531   {
2532
2533   }
2534
2535   public void enterPdbId_actionPerformed(ActionEvent e)
2536   {
2537
2538   }
2539
2540   public void pdbFile_actionPerformed(ActionEvent e)
2541   {
2542
2543   }
2544
2545   public void invertColSel_actionPerformed(ActionEvent e)
2546   {
2547
2548   }
2549
2550   public void tabSelectionChanged(int sel)
2551   {
2552
2553   }
2554
2555   public void tabbedPane_mousePressed(MouseEvent e)
2556   {
2557
2558   }
2559
2560   public void tabbedPane_focusGained(FocusEvent e)
2561   {
2562     requestFocus();
2563   }
2564
2565   public void save_actionPerformed(ActionEvent e)
2566   {
2567
2568   }
2569
2570   public void reload_actionPerformed(ActionEvent e)
2571   {
2572
2573   }
2574
2575   public void newView_actionPerformed(ActionEvent e)
2576   {
2577
2578   }
2579
2580   public void textColour_actionPerformed()
2581   {
2582
2583   }
2584
2585   public void idRightAlign_actionPerformed(ActionEvent e)
2586   {
2587
2588   }
2589
2590   public void expandViews_actionPerformed(ActionEvent e)
2591   {
2592
2593   }
2594
2595   public void gatherViews_actionPerformed(ActionEvent e)
2596   {
2597
2598   }
2599
2600   public void buildTreeSortMenu()
2601   {
2602
2603   }
2604
2605   public void pageSetup_actionPerformed(ActionEvent e)
2606   {
2607
2608   }
2609
2610   public void alignmentProperties()
2611   {
2612
2613   }
2614
2615   protected void expand_newalign(ActionEvent e)
2616   {
2617     // TODO Auto-generated method stub
2618
2619   }
2620
2621   protected boolean isShowAutoCalculatedAbove()
2622   {
2623     return showAutoCalculatedAbove;
2624   }
2625
2626   protected void setShowAutoCalculatedAbove(boolean showAutoCalculatedAbove)
2627   {
2628     this.showAutoCalculatedAbove = showAutoCalculatedAbove;
2629   }
2630
2631   protected SequenceAnnotationOrder getAnnotationSortOrder()
2632   {
2633     return annotationSortOrder;
2634   }
2635
2636   protected void setAnnotationSortOrder(
2637           SequenceAnnotationOrder annotationSortOrder)
2638   {
2639     this.annotationSortOrder = annotationSortOrder;
2640   }
2641
2642   public Map<KeyStroke, JMenuItem> getAccelerators()
2643   {
2644     return this.accelerators;
2645   }
2646
2647   /**
2648    * Returns the selected index of the tabbed pane, or -1 if none selected
2649    * (including the case where the tabbed pane has not been made visible).
2650    * 
2651    * @return
2652    */
2653   public int getTabIndex()
2654   {
2655     return tabbedPane.getSelectedIndex();
2656   }
2657
2658   public JPanel getStatusPanel()
2659   {
2660     return statusPanel;
2661   }
2662
2663   /**
2664    * Sets a reference to the containing split frame. Also makes the 'toggle
2665    * split view' menu item visible and checked.
2666    * 
2667    * @param sf
2668    */
2669   public void setSplitFrame(SplitContainerI sf)
2670   {
2671     this.splitFrame = sf;
2672     if (sf != null)
2673     {
2674       this.showComplementMenuItem.setVisible(true);
2675       this.showComplementMenuItem.setState(true);
2676     }
2677   }
2678
2679   public SplitContainerI getSplitViewContainer()
2680   {
2681     return this.splitFrame;
2682   }
2683
2684   protected void showComplement_actionPerformed(boolean complement)
2685   {
2686   }
2687 }