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