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