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