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