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