Merge branch 'releases/Release_2_10_2b1_Branch'
[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<KeyStroke, JMenuItem>();
203
204   private SplitContainerI splitFrame;
205
206   public GAlignFrame()
207   {
208     try
209     {
210       jbInit();
211       setJMenuBar(alignFrameMenuBar);
212
213       // dynamically fill save as menu with available formats
214       for (String ff : FileFormats.getInstance().getWritableFormats(true))
215       {
216         JMenuItem item = new JMenuItem(ff);
217
218         item.addActionListener(new ActionListener()
219         {
220           @Override
221           public void actionPerformed(ActionEvent e)
222           {
223             outputText_actionPerformed(e);
224           }
225         });
226
227         outputTextboxMenu.add(item);
228       }
229     } catch (Exception e)
230     {
231       System.err.println(e.toString());
232     }
233
234     if (!Platform.isAMac())
235     {
236       closeMenuItem.setMnemonic('C');
237       outputTextboxMenu.setMnemonic('T');
238       undoMenuItem.setMnemonic('Z');
239       redoMenuItem.setMnemonic('0');
240       copy.setMnemonic('C');
241       cut.setMnemonic('U');
242       pasteMenu.setMnemonic('P');
243       reload.setMnemonic('R');
244     }
245   }
246
247   private void jbInit() throws Exception
248   {
249     initColourMenu();
250
251     JMenuItem saveAs = new JMenuItem(
252             MessageManager.getString("action.save_as"));
253     ActionListener al = new ActionListener()
254     {
255       @Override
256       public void actionPerformed(ActionEvent e)
257       {
258         saveAs_actionPerformed(e);
259       }
260     };
261
262     // FIXME getDefaultToolkit throws an exception in Headless mode
263     KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_S,
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 loadTreeMenuItem = new JMenuItem(
1081             MessageManager.getString("label.load_associated_tree"));
1082     loadTreeMenuItem.setActionCommand(
1083             MessageManager.getString("label.load_tree_for_sequence_set"));
1084     loadTreeMenuItem.addActionListener(new ActionListener()
1085     {
1086       @Override
1087       public void actionPerformed(ActionEvent e)
1088       {
1089         loadTreeMenuItem_actionPerformed(e);
1090       }
1091     });
1092
1093     scaleAbove.setVisible(false);
1094     scaleAbove.setText(MessageManager.getString("action.scale_above"));
1095     scaleAbove.addActionListener(new ActionListener()
1096     {
1097       @Override
1098       public void actionPerformed(ActionEvent e)
1099       {
1100         scaleAbove_actionPerformed(e);
1101       }
1102     });
1103     scaleLeft.setVisible(false);
1104     scaleLeft.setSelected(true);
1105     scaleLeft.setText(MessageManager.getString("action.scale_left"));
1106     scaleLeft.addActionListener(new ActionListener()
1107     {
1108       @Override
1109       public void actionPerformed(ActionEvent e)
1110       {
1111         scaleLeft_actionPerformed(e);
1112       }
1113     });
1114     scaleRight.setVisible(false);
1115     scaleRight.setSelected(true);
1116     scaleRight.setText(MessageManager.getString("action.scale_right"));
1117     scaleRight.addActionListener(new ActionListener()
1118     {
1119       @Override
1120       public void actionPerformed(ActionEvent e)
1121       {
1122         scaleRight_actionPerformed(e);
1123       }
1124     });
1125     centreColumnLabelsMenuItem.setVisible(true);
1126     centreColumnLabelsMenuItem.setState(false);
1127     centreColumnLabelsMenuItem.setText(
1128             MessageManager.getString("label.centre_column_labels"));
1129     centreColumnLabelsMenuItem.addActionListener(new ActionListener()
1130     {
1131       @Override
1132       public void actionPerformed(ActionEvent e)
1133       {
1134         centreColumnLabels_actionPerformed(e);
1135       }
1136     });
1137     followHighlightMenuItem.setVisible(true);
1138     followHighlightMenuItem.setState(true);
1139     followHighlightMenuItem
1140             .setText(MessageManager.getString("label.automatic_scrolling"));
1141     followHighlightMenuItem.addActionListener(new ActionListener()
1142     {
1143
1144       @Override
1145       public void actionPerformed(ActionEvent e)
1146       {
1147         followHighlight_actionPerformed();
1148       }
1149
1150     });
1151
1152     sortByTreeMenu
1153             .setText(MessageManager.getString("action.by_tree_order"));
1154     sort.setText(MessageManager.getString("action.sort"));
1155     sort.addMenuListener(new MenuListener()
1156     {
1157       @Override
1158       public void menuSelected(MenuEvent e)
1159       {
1160         buildTreeSortMenu();
1161       }
1162
1163       @Override
1164       public void menuDeselected(MenuEvent e)
1165       {
1166       }
1167
1168       @Override
1169       public void menuCanceled(MenuEvent e)
1170       {
1171       }
1172     });
1173     sortByAnnotScore
1174             .setText(MessageManager.getString("label.sort_by_score"));
1175     sort.add(sortByAnnotScore);
1176     sort.addMenuListener(new javax.swing.event.MenuListener()
1177     {
1178
1179       @Override
1180       public void menuCanceled(MenuEvent e)
1181       {
1182       }
1183
1184       @Override
1185       public void menuDeselected(MenuEvent e)
1186       {
1187       }
1188
1189       @Override
1190       public void menuSelected(MenuEvent e)
1191       {
1192         buildSortByAnnotationScoresMenu();
1193       }
1194     });
1195     sortByAnnotScore.setVisible(false);
1196
1197     calculateTree
1198             .setText(MessageManager.getString("action.calculate_tree_pca"));
1199
1200     padGapsMenuitem.setText(MessageManager.getString("label.pad_gaps"));
1201     padGapsMenuitem
1202             .setState(jalview.bin.Cache.getDefault("PAD_GAPS", false));
1203     padGapsMenuitem.addActionListener(new ActionListener()
1204     {
1205       @Override
1206       public void actionPerformed(ActionEvent e)
1207       {
1208         padGapsMenuitem_actionPerformed(e);
1209       }
1210     });
1211     JMenuItem vamsasStore = new JMenuItem(
1212             MessageManager.getString("label.vamsas_store"));
1213     vamsasStore.setVisible(false);
1214     vamsasStore.addActionListener(new ActionListener()
1215     {
1216       @Override
1217       public void actionPerformed(ActionEvent e)
1218       {
1219         vamsasStore_actionPerformed(e);
1220       }
1221     });
1222     showTranslation
1223             .setText(MessageManager.getString("label.translate_cDNA"));
1224     showTranslation.addActionListener(new ActionListener()
1225     {
1226       @Override
1227       public void actionPerformed(ActionEvent e)
1228       {
1229         showTranslation_actionPerformed(e);
1230       }
1231     });
1232     showReverse.setText(MessageManager.getString("label.reverse"));
1233     showReverse.addActionListener(new ActionListener()
1234     {
1235       @Override
1236       public void actionPerformed(ActionEvent e)
1237       {
1238         showReverse_actionPerformed(false);
1239       }
1240     });
1241     showReverseComplement
1242             .setText(MessageManager.getString("label.reverse_complement"));
1243     showReverseComplement.addActionListener(new ActionListener()
1244     {
1245       @Override
1246       public void actionPerformed(ActionEvent e)
1247       {
1248         showReverse_actionPerformed(true);
1249       }
1250     });
1251
1252     JMenuItem extractScores = new JMenuItem(
1253             MessageManager.getString("label.extract_scores"));
1254     extractScores.addActionListener(new ActionListener()
1255     {
1256       @Override
1257       public void actionPerformed(ActionEvent e)
1258       {
1259         extractScores_actionPerformed(e);
1260       }
1261     });
1262     extractScores.setVisible(true);
1263     // JBPNote: TODO: make gui for regex based score extraction
1264
1265     // for show products actions see AlignFrame.canShowProducts
1266     showProducts.setText(MessageManager.getString("label.get_cross_refs"));
1267
1268     runGroovy.setText(MessageManager.getString("label.run_groovy"));
1269     runGroovy.setToolTipText(
1270             MessageManager.getString("label.run_groovy_tip"));
1271     runGroovy.addActionListener(new ActionListener()
1272     {
1273       @Override
1274       public void actionPerformed(ActionEvent e)
1275       {
1276         runGroovy_actionPerformed();
1277       }
1278     });
1279
1280     JMenuItem openFeatureSettings = new JMenuItem(
1281             MessageManager.getString("action.feature_settings"));
1282     openFeatureSettings.addActionListener(new ActionListener()
1283     {
1284       @Override
1285       public void actionPerformed(ActionEvent e)
1286       {
1287         featureSettings_actionPerformed(e);
1288       }
1289     });
1290     JMenuItem fetchSequence = new JMenuItem(
1291             MessageManager.getString("label.fetch_sequences"));
1292     fetchSequence.addActionListener(new ActionListener()
1293     {
1294       @Override
1295       public void actionPerformed(ActionEvent e)
1296       {
1297         fetchSequence_actionPerformed(e);
1298       }
1299     });
1300
1301     JMenuItem associatedData = new JMenuItem(
1302             MessageManager.getString("label.load_features_annotations"));
1303     associatedData.addActionListener(new ActionListener()
1304     {
1305       @Override
1306       public void actionPerformed(ActionEvent e)
1307       {
1308         associatedData_actionPerformed(e);
1309       }
1310     });
1311     autoCalculate.setText(
1312             MessageManager.getString("label.autocalculate_consensus"));
1313     autoCalculate.setState(
1314             jalview.bin.Cache.getDefault("AUTO_CALC_CONSENSUS", true));
1315     autoCalculate.addActionListener(new ActionListener()
1316     {
1317       @Override
1318       public void actionPerformed(ActionEvent e)
1319       {
1320         autoCalculate_actionPerformed(e);
1321       }
1322     });
1323     sortByTree.setText(
1324             MessageManager.getString("label.sort_alignment_new_tree"));
1325     sortByTree.setToolTipText("<html>" + MessageManager.getString(
1326             "label.enable_automatically_sort_alignment_when_open_new_tree"));
1327     sortByTree
1328             .setState(jalview.bin.Cache.getDefault("SORT_BY_TREE", false));
1329     sortByTree.addActionListener(new ActionListener()
1330     {
1331       @Override
1332       public void actionPerformed(ActionEvent e)
1333       {
1334         sortByTreeOption_actionPerformed(e);
1335       }
1336     });
1337
1338     listenToViewSelections.setText(
1339             MessageManager.getString("label.listen_for_selections"));
1340     listenToViewSelections
1341             .setToolTipText("<html>" + MessageManager.getString(
1342                     "label.selections_mirror_selections_made_same_sequences_other_views"));
1343     listenToViewSelections.setState(false);
1344     listenToViewSelections.addActionListener(new ActionListener()
1345     {
1346       @Override
1347       public void actionPerformed(ActionEvent e)
1348       {
1349         listenToViewSelections_actionPerformed(e);
1350       }
1351     });
1352
1353     JMenu addSequenceMenu = new JMenu(
1354             MessageManager.getString("label.add_sequences"));
1355     JMenuItem addFromFile = new JMenuItem(
1356             MessageManager.getString("label.from_file"));
1357     addFromFile.addActionListener(new ActionListener()
1358     {
1359       @Override
1360       public void actionPerformed(ActionEvent e)
1361       {
1362         addFromFile_actionPerformed(e);
1363       }
1364     });
1365     JMenuItem addFromText = new JMenuItem(
1366             MessageManager.getString("label.from_textbox"));
1367     addFromText.addActionListener(new ActionListener()
1368     {
1369       @Override
1370       public void actionPerformed(ActionEvent e)
1371       {
1372         addFromText_actionPerformed(e);
1373       }
1374     });
1375     JMenuItem addFromURL = new JMenuItem(
1376             MessageManager.getString("label.from_url"));
1377     addFromURL.addActionListener(new ActionListener()
1378     {
1379       @Override
1380       public void actionPerformed(ActionEvent e)
1381       {
1382         addFromURL_actionPerformed(e);
1383       }
1384     });
1385     JMenuItem exportFeatures = new JMenuItem(
1386             MessageManager.getString("label.export_features"));
1387     exportFeatures.addActionListener(new ActionListener()
1388     {
1389       @Override
1390       public void actionPerformed(ActionEvent e)
1391       {
1392         exportFeatures_actionPerformed(e);
1393       }
1394     });
1395     JMenuItem exportAnnotations = new JMenuItem(
1396             MessageManager.getString("label.export_annotations"));
1397     exportAnnotations.addActionListener(new ActionListener()
1398     {
1399       @Override
1400       public void actionPerformed(ActionEvent e)
1401       {
1402         exportAnnotations_actionPerformed(e);
1403       }
1404     });
1405     statusPanel.setLayout(new GridLayout());
1406     JMenuItem showAllSeqs = new JMenuItem(
1407             MessageManager.getString("label.all_sequences"));
1408     showAllSeqs.setToolTipText(
1409             MessageManager.getString("label.toggle_sequence_visibility"));
1410     showAllSeqs.addActionListener(new ActionListener()
1411     {
1412       @Override
1413       public void actionPerformed(ActionEvent e)
1414       {
1415         showAllSeqs_actionPerformed(e);
1416       }
1417     });
1418     JMenuItem showAllColumns = new JMenuItem(
1419             MessageManager.getString("label.all_columns"));
1420     showAllColumns.setToolTipText(
1421             MessageManager.getString("label.toggle_columns_visibility"));
1422     showAllColumns.addActionListener(new ActionListener()
1423     {
1424       @Override
1425       public void actionPerformed(ActionEvent e)
1426       {
1427         showAllColumns_actionPerformed(e);
1428       }
1429     });
1430     JMenu hideMenu = new JMenu(MessageManager.getString("action.hide"));
1431     JMenuItem hideSelSequences = new JMenuItem(
1432             MessageManager.getString("label.selected_sequences"));
1433     hideSelSequences.setToolTipText(
1434             MessageManager.getString("label.toggle_sequence_visibility"));
1435     hideSelSequences.addActionListener(new ActionListener()
1436     {
1437       @Override
1438       public void actionPerformed(ActionEvent e)
1439       {
1440         hideSelSequences_actionPerformed(e);
1441       }
1442     });
1443     JMenuItem hideSelColumns = new JMenuItem(
1444             MessageManager.getString("label.selected_columns"));
1445     hideSelColumns.setToolTipText(
1446             MessageManager.getString("label.toggle_columns_visibility"));
1447     hideSelColumns.addActionListener(new ActionListener()
1448     {
1449       @Override
1450       public void actionPerformed(ActionEvent e)
1451       {
1452         hideSelColumns_actionPerformed(e);
1453       }
1454     });
1455     JMenuItem hideAllSelection = new JMenuItem(
1456             MessageManager.getString("label.selected_region"));
1457     hideAllSelection.addActionListener(new ActionListener()
1458     {
1459       @Override
1460       public void actionPerformed(ActionEvent e)
1461       {
1462         hideAllSelection_actionPerformed(e);
1463       }
1464     });
1465     // TODO: should be hidden if no selection exists.
1466     JMenuItem hideAllButSelection = new JMenuItem(
1467             MessageManager.getString("label.all_but_selected_region"));
1468     hideAllButSelection.addActionListener(new ActionListener()
1469     {
1470       @Override
1471       public void actionPerformed(ActionEvent e)
1472       {
1473         hideAllButSelection_actionPerformed(e);
1474       }
1475     });
1476     JMenuItem showAllhidden = new JMenuItem(
1477             MessageManager.getString("label.all_sequences_columns"));
1478     showAllhidden.setToolTipText(MessageManager
1479             .getString("label.toggles_visibility_hidden_selected_regions"));
1480     showAllhidden.addActionListener(new ActionListener()
1481     {
1482       @Override
1483       public void actionPerformed(ActionEvent e)
1484       {
1485         showAllhidden_actionPerformed(e);
1486       }
1487     });
1488     hiddenMarkers.setText(
1489             MessageManager.getString("action.show_hidden_markers"));
1490     hiddenMarkers.addActionListener(new ActionListener()
1491     {
1492       @Override
1493       public void actionPerformed(ActionEvent e)
1494       {
1495         hiddenMarkers_actionPerformed(e);
1496       }
1497     });
1498
1499     JMenuItem invertColSel = new JMenuItem(
1500             MessageManager.getString("action.invert_column_selection"));
1501     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_I,
1502             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()
1503                     | KeyEvent.ALT_MASK,
1504             false);
1505     al = new ActionListener()
1506     {
1507       @Override
1508       public void actionPerformed(ActionEvent e)
1509       {
1510         invertColSel_actionPerformed(e);
1511       }
1512     };
1513     addMenuActionAndAccelerator(keyStroke, invertColSel, al);
1514
1515     showComplementMenuItem.setVisible(false);
1516     showComplementMenuItem.addActionListener(new ActionListener()
1517     {
1518       @Override
1519       public void actionPerformed(ActionEvent e)
1520       {
1521         showComplement_actionPerformed(showComplementMenuItem.getState());
1522       }
1523     });
1524
1525     tabbedPane.addChangeListener(new javax.swing.event.ChangeListener()
1526     {
1527       @Override
1528       public void stateChanged(ChangeEvent evt)
1529       {
1530         JTabbedPane pane = (JTabbedPane) evt.getSource();
1531         int sel = pane.getSelectedIndex();
1532         tabSelectionChanged(sel);
1533       }
1534     });
1535     tabbedPane.addMouseListener(new MouseAdapter()
1536     {
1537       @Override
1538       public void mousePressed(MouseEvent e)
1539       {
1540         if (e.isPopupTrigger()) // Mac
1541         {
1542           tabbedPane_mousePressed(e);
1543         }
1544       }
1545
1546       @Override
1547       public void mouseReleased(MouseEvent e)
1548       {
1549         if (e.isPopupTrigger()) // Windows
1550         {
1551           tabbedPane_mousePressed(e);
1552         }
1553       }
1554     });
1555     tabbedPane.addFocusListener(new FocusAdapter()
1556     {
1557       @Override
1558       public void focusGained(FocusEvent e)
1559       {
1560         tabbedPane_focusGained(e);
1561       }
1562     });
1563
1564     JMenuItem save = new JMenuItem(MessageManager.getString("action.save"));
1565     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_S,
1566             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
1567     al = new ActionListener()
1568     {
1569       @Override
1570       public void actionPerformed(ActionEvent e)
1571       {
1572         save_actionPerformed(e);
1573       }
1574     };
1575     addMenuActionAndAccelerator(keyStroke, save, al);
1576
1577     reload.setEnabled(false);
1578     reload.setText(MessageManager.getString("action.reload"));
1579     reload.addActionListener(new ActionListener()
1580     {
1581       @Override
1582       public void actionPerformed(ActionEvent e)
1583       {
1584         reload_actionPerformed(e);
1585       }
1586     });
1587
1588     JMenuItem newView = new JMenuItem(
1589             MessageManager.getString("action.new_view"));
1590     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_T,
1591             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
1592     al = new ActionListener()
1593     {
1594       @Override
1595       public void actionPerformed(ActionEvent e)
1596       {
1597         newView_actionPerformed(e);
1598       }
1599     };
1600     addMenuActionAndAccelerator(keyStroke, newView, al);
1601
1602     tabbedPane.setToolTipText("<html><i>"
1603             + MessageManager.getString("label.rename_tab_eXpand_reGroup")
1604             + "</i></html>");
1605
1606     formatMenu.setText(MessageManager.getString("action.format"));
1607     JMenu selectMenu = new JMenu(MessageManager.getString("action.select"));
1608
1609     idRightAlign.setText(
1610             MessageManager.getString("label.right_align_sequence_id"));
1611     idRightAlign.addActionListener(new ActionListener()
1612     {
1613       @Override
1614       public void actionPerformed(ActionEvent e)
1615       {
1616         idRightAlign_actionPerformed(e);
1617       }
1618     });
1619
1620     gatherViews.setEnabled(false);
1621     gatherViews.setText(MessageManager.getString("action.gather_views"));
1622     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G, 0, false);
1623     al = new ActionListener()
1624     {
1625       @Override
1626       public void actionPerformed(ActionEvent e)
1627       {
1628         gatherViews_actionPerformed(e);
1629       }
1630     };
1631     addMenuActionAndAccelerator(keyStroke, gatherViews, al);
1632
1633     expandViews.setEnabled(false);
1634     expandViews.setText(MessageManager.getString("action.expand_views"));
1635     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_X, 0, false);
1636     al = new ActionListener()
1637     {
1638       @Override
1639       public void actionPerformed(ActionEvent e)
1640       {
1641         expandViews_actionPerformed(e);
1642       }
1643     };
1644     addMenuActionAndAccelerator(keyStroke, expandViews, al);
1645
1646     JMenuItem pageSetup = new JMenuItem(
1647             MessageManager.getString("action.page_setup"));
1648     pageSetup.addActionListener(new ActionListener()
1649     {
1650       @Override
1651       public void actionPerformed(ActionEvent e)
1652       {
1653         pageSetup_actionPerformed(e);
1654       }
1655     });
1656     JMenuItem alignmentProperties = new JMenuItem(
1657             MessageManager.getString("label.alignment_props"));
1658     alignmentProperties.addActionListener(new ActionListener()
1659     {
1660       @Override
1661       public void actionPerformed(ActionEvent actionEvent)
1662       {
1663         alignmentProperties();
1664       }
1665     });
1666     JMenuItem selectHighlighted = new JMenuItem(
1667             MessageManager.getString("action.select_highlighted_columns"));
1668     selectHighlighted.setToolTipText(
1669             MessageManager.getString("tooltip.select_highlighted_columns"));
1670     al = new ActionListener()
1671     {
1672       @Override
1673       public void actionPerformed(ActionEvent actionEvent)
1674       {
1675         selectHighlightedColumns_actionPerformed(actionEvent);
1676       }
1677     };
1678     selectHighlighted.addActionListener(al);
1679     JMenu tooltipSettingsMenu = new JMenu(
1680             MessageManager.getString("label.sequence_id_tooltip"));
1681     JMenu autoAnnMenu = new JMenu(
1682             MessageManager.getString("label.autocalculated_annotation"));
1683
1684     JMenu exportImageMenu = new JMenu(
1685             MessageManager.getString("label.export_image"));
1686     JMenu fileMenu = new JMenu(MessageManager.getString("action.file"));
1687     alignFrameMenuBar.add(fileMenu);
1688     alignFrameMenuBar.add(editMenu);
1689     alignFrameMenuBar.add(selectMenu);
1690     alignFrameMenuBar.add(viewMenu);
1691     alignFrameMenuBar.add(annotationsMenu);
1692     alignFrameMenuBar.add(formatMenu);
1693     alignFrameMenuBar.add(colourMenu);
1694     alignFrameMenuBar.add(calculateMenu);
1695     alignFrameMenuBar.add(webService);
1696
1697     fileMenu.add(fetchSequence);
1698     fileMenu.add(addSequenceMenu);
1699     fileMenu.add(reload);
1700     fileMenu.addSeparator();
1701     fileMenu.add(vamsasStore);
1702     fileMenu.add(save);
1703     fileMenu.add(saveAs);
1704     fileMenu.add(outputTextboxMenu);
1705     fileMenu.add(pageSetup);
1706     fileMenu.add(printMenuItem);
1707     fileMenu.addSeparator();
1708     fileMenu.add(exportImageMenu);
1709     fileMenu.add(exportFeatures);
1710     fileMenu.add(exportAnnotations);
1711     fileMenu.add(loadTreeMenuItem);
1712     fileMenu.add(associatedData);
1713     fileMenu.addSeparator();
1714     fileMenu.add(closeMenuItem);
1715
1716     pasteMenu.add(pasteNew);
1717     pasteMenu.add(pasteThis);
1718     editMenu.add(undoMenuItem);
1719     editMenu.add(redoMenuItem);
1720     editMenu.add(cut);
1721     editMenu.add(copy);
1722     editMenu.add(pasteMenu);
1723     editMenu.add(delete);
1724     editMenu.addSeparator();
1725     editMenu.add(remove2LeftMenuItem);
1726     editMenu.add(remove2RightMenuItem);
1727     editMenu.add(removeGappedColumnMenuItem);
1728     editMenu.add(removeAllGapsMenuItem);
1729     editMenu.add(removeRedundancyMenuItem);
1730     editMenu.addSeparator();
1731     // dont add these yet in the CVS build - they cannot be undone!
1732     // Excluded from Jalview 2.5 release - undo needs to be implemented.
1733     // editMenu.add(justifyLeftMenuItem);
1734     // editMenu.add(justifyRightMenuItem);
1735     // editMenu.addSeparator();
1736     editMenu.add(padGapsMenuitem);
1737
1738     showMenu.add(showAllColumns);
1739     showMenu.add(showAllSeqs);
1740     showMenu.add(showAllhidden);
1741     hideMenu.add(hideSelColumns);
1742     hideMenu.add(hideSelSequences);
1743     hideMenu.add(hideAllSelection);
1744     hideMenu.add(hideAllButSelection);
1745     viewMenu.add(newView);
1746     viewMenu.add(expandViews);
1747     viewMenu.add(gatherViews);
1748     viewMenu.addSeparator();
1749     viewMenu.add(showMenu);
1750     viewMenu.add(hideMenu);
1751     viewMenu.add(showComplementMenuItem);
1752     viewMenu.addSeparator();
1753     viewMenu.add(followHighlightMenuItem);
1754     viewMenu.addSeparator();
1755     viewMenu.add(showSeqFeatures);
1756     // viewMenu.add(showSeqFeaturesHeight);
1757     viewMenu.add(openFeatureSettings);
1758     tooltipSettingsMenu.add(showDbRefsMenuitem);
1759     tooltipSettingsMenu.add(showNpFeatsMenuitem);
1760     viewMenu.add(tooltipSettingsMenu);
1761     viewMenu.addSeparator();
1762     viewMenu.add(alignmentProperties);
1763     viewMenu.addSeparator();
1764     viewMenu.add(overviewMenuItem);
1765
1766     annotationsMenu.add(annotationPanelMenuItem);
1767     annotationsMenu.addSeparator();
1768     annotationsMenu.add(showAllAlAnnotations);
1769     annotationsMenu.add(hideAllAlAnnotations);
1770     annotationsMenu.addSeparator();
1771     annotationsMenu.add(showAllSeqAnnotations);
1772     annotationsMenu.add(hideAllSeqAnnotations);
1773     annotationsMenu.add(sortAnnBySequence);
1774     annotationsMenu.add(sortAnnByLabel);
1775     annotationsMenu.addSeparator();
1776     autoAnnMenu.add(showAutoFirst);
1777     autoAnnMenu.add(showAutoLast);
1778     autoAnnMenu.addSeparator();
1779     autoAnnMenu.add(applyAutoAnnotationSettings);
1780     autoAnnMenu.add(showConsensusHistogram);
1781     autoAnnMenu.add(showSequenceLogo);
1782     autoAnnMenu.add(normaliseSequenceLogo);
1783     autoAnnMenu.addSeparator();
1784     autoAnnMenu.add(showGroupConservation);
1785     autoAnnMenu.add(showGroupConsensus);
1786     annotationsMenu.add(autoAnnMenu);
1787
1788     sort.add(sortIDMenuItem);
1789     sort.add(sortLengthMenuItem);
1790     sort.add(sortGroupMenuItem);
1791     sort.add(sortPairwiseMenuItem);
1792     sort.add(sortByTreeMenu);
1793     calculateMenu.add(sort);
1794     calculateMenu.add(calculateTree);
1795     calculateMenu.addSeparator();
1796     calculateMenu.add(pairwiseAlignmentMenuItem);
1797     calculateMenu.addSeparator();
1798     calculateMenu.add(showTranslation);
1799     calculateMenu.add(showReverse);
1800     calculateMenu.add(showReverseComplement);
1801     calculateMenu.add(showProducts);
1802     calculateMenu.add(autoCalculate);
1803     calculateMenu.add(sortByTree);
1804     calculateMenu.addSeparator();
1805     calculateMenu.add(expandAlignment);
1806     calculateMenu.add(extractScores);
1807     calculateMenu.addSeparator();
1808     calculateMenu.add(runGroovy);
1809
1810     webServiceNoServices = new JMenuItem(
1811             MessageManager.getString("label.no_services"));
1812     webService.add(webServiceNoServices);
1813     exportImageMenu.add(htmlMenuItem);
1814     exportImageMenu.add(epsFile);
1815     exportImageMenu.add(createPNG);
1816     exportImageMenu.add(createBioJS);
1817     exportImageMenu.add(createSVG);
1818     addSequenceMenu.add(addFromFile);
1819     addSequenceMenu.add(addFromText);
1820     addSequenceMenu.add(addFromURL);
1821     this.getContentPane().add(statusPanel, java.awt.BorderLayout.SOUTH);
1822     statusPanel.add(statusBar, null);
1823     this.getContentPane().add(tabbedPane, java.awt.BorderLayout.CENTER);
1824
1825     formatMenu.add(font);
1826     formatMenu.addSeparator();
1827     formatMenu.add(wrapMenuItem);
1828     formatMenu.add(scaleAbove);
1829     formatMenu.add(scaleLeft);
1830     formatMenu.add(scaleRight);
1831     formatMenu.add(seqLimits);
1832     formatMenu.add(idRightAlign);
1833     formatMenu.add(hiddenMarkers);
1834     formatMenu.add(viewBoxesMenuItem);
1835     formatMenu.add(viewTextMenuItem);
1836     formatMenu.add(colourTextMenuItem);
1837     formatMenu.add(renderGapsMenuItem);
1838     formatMenu.add(centreColumnLabelsMenuItem);
1839     formatMenu.add(showNonconservedMenuItem);
1840     selectMenu.add(findMenuItem);
1841     selectMenu.addSeparator();
1842     selectMenu.add(selectAllSequenceMenuItem);
1843     selectMenu.add(deselectAllSequenceMenuItem);
1844     selectMenu.add(invertSequenceMenuItem);
1845     selectMenu.add(invertColSel);
1846     selectMenu.add(createGroup);
1847     selectMenu.add(unGroup);
1848     selectMenu.add(grpsFromSelection);
1849     selectMenu.add(deleteGroups);
1850     selectMenu.add(annotationColumn);
1851     selectMenu.add(selectHighlighted);
1852     // TODO - determine if the listenToViewSelections button is needed : see bug
1853     // JAL-574
1854     // selectMenu.addSeparator();
1855     // selectMenu.add(listenToViewSelections);
1856   }
1857
1858   /**
1859    * Constructs the entries on the Colour menu (but does not add them to the
1860    * menu).
1861    */
1862   protected void initColourMenu()
1863   {
1864     applyToAllGroups = new JCheckBoxMenuItem(
1865             MessageManager.getString("label.apply_colour_to_all_groups"));
1866     applyToAllGroups.addActionListener(new ActionListener()
1867     {
1868       @Override
1869       public void actionPerformed(ActionEvent e)
1870       {
1871         applyToAllGroups_actionPerformed(applyToAllGroups.isSelected());
1872       }
1873     });
1874
1875     textColour = new JMenuItem(
1876             MessageManager.getString("label.text_colour"));
1877     textColour.addActionListener(new ActionListener()
1878     {
1879       @Override
1880       public void actionPerformed(ActionEvent e)
1881       {
1882         textColour_actionPerformed();
1883       }
1884     });
1885
1886     conservationMenuItem = new JCheckBoxMenuItem(
1887             MessageManager.getString("action.by_conservation"));
1888     conservationMenuItem.addActionListener(new ActionListener()
1889     {
1890       @Override
1891       public void actionPerformed(ActionEvent e)
1892       {
1893         conservationMenuItem_actionPerformed(
1894                 conservationMenuItem.isSelected());
1895       }
1896     });
1897
1898     abovePIDThreshold = new JCheckBoxMenuItem(
1899             MessageManager.getString("label.above_identity_threshold"));
1900     abovePIDThreshold.addActionListener(new ActionListener()
1901     {
1902       @Override
1903       public void actionPerformed(ActionEvent e)
1904       {
1905         abovePIDThreshold_actionPerformed(abovePIDThreshold.isSelected());
1906       }
1907     });
1908     modifyPID = new JMenuItem(
1909             MessageManager.getString("label.modify_identity_threshold"));
1910     modifyPID.addActionListener(new ActionListener()
1911     {
1912       @Override
1913       public void actionPerformed(ActionEvent e)
1914       {
1915         modifyPID_actionPerformed();
1916       }
1917     });
1918     modifyConservation = new JMenuItem(MessageManager
1919             .getString("label.modify_conservation_threshold"));
1920     modifyConservation.addActionListener(new ActionListener()
1921     {
1922       @Override
1923       public void actionPerformed(ActionEvent e)
1924       {
1925         modifyConservation_actionPerformed();
1926       }
1927     });
1928
1929     annotationColour = new JMenuItem(
1930             MessageManager.getString("action.by_annotation"));
1931     annotationColour.addActionListener(new ActionListener()
1932     {
1933       @Override
1934       public void actionPerformed(ActionEvent e)
1935       {
1936         annotationColour_actionPerformed();
1937       }
1938     });
1939   }
1940
1941   protected void selectHighlightedColumns_actionPerformed(
1942           ActionEvent actionEvent)
1943   {
1944     // TODO Auto-generated method stub
1945
1946   }
1947
1948   /**
1949    * Generate the reverse sequence (or reverse complement if the flag is true)
1950    * and add it to the alignment
1951    * 
1952    * @param complement
1953    */
1954   protected void showReverse_actionPerformed(boolean complement)
1955   {
1956   }
1957
1958   /**
1959    * Try to run script in a Groovy console, having first ensured that this
1960    * alignframe is set as currentAlignFrame in Desktop
1961    */
1962   protected void runGroovy_actionPerformed()
1963   {
1964
1965   }
1966
1967   /**
1968    * Adds the given action listener and key accelerator to the given menu item.
1969    * Also saves in a lookup table to support lookup of action by key stroke.
1970    * 
1971    * @param keyStroke
1972    * @param menuItem
1973    * @param actionListener
1974    */
1975   protected void addMenuActionAndAccelerator(KeyStroke keyStroke,
1976           JMenuItem menuItem, ActionListener actionListener)
1977   {
1978     menuItem.setAccelerator(keyStroke);
1979     accelerators.put(keyStroke, menuItem);
1980     menuItem.addActionListener(actionListener);
1981   }
1982
1983   /**
1984    * Action on clicking sort annotations by type.
1985    * 
1986    * @param sortOrder
1987    */
1988   protected void sortAnnotations_actionPerformed()
1989   {
1990   }
1991
1992   /**
1993    * Action on clicking Show all annotations.
1994    * 
1995    * @param forSequences
1996    *          update sequence-related annotations
1997    * @param forAlignment
1998    *          update non-sequence-related annotations
1999    */
2000   protected void showAllAnnotations_actionPerformed(boolean forSequences,
2001           boolean forAlignment)
2002   {
2003     setAnnotationsVisibility(true, forSequences, forAlignment);
2004   }
2005
2006   /**
2007    * Action on clicking Hide all annotations.
2008    * 
2009    * @param forSequences
2010    *          update sequence-related annotations
2011    * @param forAlignment
2012    *          update non-sequence-related annotations
2013    */
2014   protected void hideAllAnnotations_actionPerformed(boolean forSequences,
2015           boolean forAlignment)
2016   {
2017     setAnnotationsVisibility(false, forSequences, forAlignment);
2018   }
2019
2020   /**
2021    * Set the visibility of annotations to true or false. Can act on
2022    * sequence-related annotations, or alignment-related, or both.
2023    * 
2024    * @param visible
2025    * @param forSequences
2026    *          update sequence-related annotations
2027    * @param forAlignment
2028    *          update non-sequence-related annotations
2029    */
2030   protected void setAnnotationsVisibility(boolean visible,
2031           boolean forSequences, boolean forAlignment)
2032   {
2033
2034   }
2035
2036   protected void normaliseSequenceLogo_actionPerformed(ActionEvent e)
2037   {
2038     // TODO Auto-generated method stub
2039
2040   }
2041
2042   protected void listenToViewSelections_actionPerformed(ActionEvent e)
2043   {
2044     // TODO Auto-generated method stub
2045
2046   }
2047
2048   protected void showAllhidden_actionPerformed(ActionEvent e)
2049   {
2050     // TODO Auto-generated method stub
2051
2052   }
2053
2054   protected void hideAllButSelection_actionPerformed(ActionEvent e)
2055   {
2056     // TODO Auto-generated method stub
2057
2058   }
2059
2060   protected void hideAllSelection_actionPerformed(ActionEvent e)
2061   {
2062     // TODO Auto-generated method stub
2063
2064   }
2065
2066   protected void applyAutoAnnotationSettings_actionPerformed(ActionEvent e)
2067   {
2068     // TODO Auto-generated method stub
2069
2070   }
2071
2072   protected void showConsensusHistogram_actionPerformed(ActionEvent e)
2073   {
2074     // TODO Auto-generated method stub
2075
2076   }
2077
2078   protected void showSequenceLogo_actionPerformed(ActionEvent e)
2079   {
2080     // TODO Auto-generated method stub
2081
2082   }
2083
2084   protected void makeGrpsFromSelection_actionPerformed(ActionEvent e)
2085   {
2086     // TODO Auto-generated method stub
2087
2088   }
2089
2090   protected void showGroupConsensus_actionPerformed(ActionEvent e)
2091   {
2092     // TODO Auto-generated method stub
2093
2094   }
2095
2096   protected void showGroupConservation_actionPerformed(ActionEvent e)
2097   {
2098     // TODO Auto-generated method stub
2099
2100   }
2101
2102   protected void showUnconservedMenuItem_actionPerformed(ActionEvent e)
2103   {
2104     // TODO Auto-generated method stub
2105
2106   }
2107
2108   protected void justifyRightMenuItem_actionPerformed(ActionEvent e)
2109   {
2110     // TODO Auto-generated method stub
2111
2112   }
2113
2114   protected void justifyLeftMenuItem_actionPerformed(ActionEvent e)
2115   {
2116     // TODO Auto-generated method stub
2117
2118   }
2119
2120   protected void followHighlight_actionPerformed()
2121   {
2122     // TODO Auto-generated method stub
2123
2124   }
2125
2126   protected void showNpFeats_actionPerformed(ActionEvent e)
2127   {
2128     // TODO Auto-generated method stub
2129
2130   }
2131
2132   protected void showDbRefs_actionPerformed(ActionEvent e)
2133   {
2134     // TODO Auto-generated method stub
2135
2136   }
2137
2138   protected void centreColumnLabels_actionPerformed(ActionEvent e)
2139   {
2140   }
2141
2142   protected void buildSortByAnnotationScoresMenu()
2143   {
2144   }
2145
2146   protected void extractScores_actionPerformed(ActionEvent e)
2147   {
2148   }
2149
2150   protected void outputText_actionPerformed(ActionEvent e)
2151   {
2152   }
2153
2154   public void addFromFile_actionPerformed(ActionEvent e)
2155   {
2156
2157   }
2158
2159   public void addFromText_actionPerformed(ActionEvent e)
2160   {
2161
2162   }
2163
2164   public void addFromURL_actionPerformed(ActionEvent e)
2165   {
2166
2167   }
2168
2169   public void exportFeatures_actionPerformed(ActionEvent e)
2170   {
2171
2172   }
2173
2174   public void exportAnnotations_actionPerformed(ActionEvent e)
2175   {
2176
2177   }
2178
2179   protected void htmlMenuItem_actionPerformed(ActionEvent e)
2180   {
2181   }
2182
2183   protected void bioJSMenuItem_actionPerformed(ActionEvent e)
2184   {
2185
2186   }
2187
2188   protected void closeMenuItem_actionPerformed(boolean b)
2189   {
2190   }
2191
2192   protected void redoMenuItem_actionPerformed(ActionEvent e)
2193   {
2194   }
2195
2196   protected void undoMenuItem_actionPerformed(ActionEvent e)
2197   {
2198   }
2199
2200   protected void selectAllSequenceMenuItem_actionPerformed(ActionEvent e)
2201   {
2202   }
2203
2204   protected void deselectAllSequenceMenuItem_actionPerformed(ActionEvent e)
2205   {
2206   }
2207
2208   protected void invertSequenceMenuItem_actionPerformed(ActionEvent e)
2209   {
2210   }
2211
2212   protected void remove2LeftMenuItem_actionPerformed(ActionEvent e)
2213   {
2214   }
2215
2216   protected void remove2RightMenuItem_actionPerformed(ActionEvent e)
2217   {
2218   }
2219
2220   protected void removeGappedColumnMenuItem_actionPerformed(ActionEvent e)
2221   {
2222   }
2223
2224   protected void removeAllGapsMenuItem_actionPerformed(ActionEvent e)
2225   {
2226   }
2227
2228   protected void wrapMenuItem_actionPerformed(ActionEvent e)
2229   {
2230   }
2231
2232   protected void viewBoxesMenuItem_actionPerformed(ActionEvent e)
2233   {
2234   }
2235
2236   protected void viewTextMenuItem_actionPerformed(ActionEvent e)
2237   {
2238   }
2239
2240   protected void colourTextMenuItem_actionPerformed(ActionEvent e)
2241   {
2242   }
2243
2244   protected void annotationPanelMenuItem_actionPerformed(ActionEvent e)
2245   {
2246   }
2247
2248   protected void overviewMenuItem_actionPerformed(ActionEvent e)
2249   {
2250   }
2251
2252   protected void sortPairwiseMenuItem_actionPerformed(ActionEvent e)
2253   {
2254   }
2255
2256   protected void sortIDMenuItem_actionPerformed(ActionEvent e)
2257   {
2258   }
2259
2260   protected void sortLengthMenuItem_actionPerformed(ActionEvent e)
2261   {
2262   }
2263
2264   protected void sortGroupMenuItem_actionPerformed(ActionEvent e)
2265   {
2266   }
2267
2268   protected void removeRedundancyMenuItem_actionPerformed(ActionEvent e)
2269   {
2270   }
2271
2272   protected void pairwiseAlignmentMenuItem_actionPerformed(ActionEvent e)
2273   {
2274   }
2275
2276   protected void neighbourTreeMenuItem_actionPerformed(ActionEvent e)
2277   {
2278   }
2279
2280   protected void conservationMenuItem_actionPerformed(boolean selected)
2281   {
2282   }
2283
2284   protected void printMenuItem_actionPerformed(ActionEvent e)
2285   {
2286   }
2287
2288   protected void renderGapsMenuItem_actionPerformed(ActionEvent e)
2289   {
2290   }
2291
2292   protected void findMenuItem_actionPerformed(ActionEvent e)
2293   {
2294   }
2295
2296   protected void abovePIDThreshold_actionPerformed(boolean selected)
2297   {
2298   }
2299
2300   public void showSeqFeatures_actionPerformed(ActionEvent actionEvent)
2301   {
2302   }
2303
2304   protected void deleteGroups_actionPerformed(ActionEvent e)
2305   {
2306   }
2307
2308   protected void createGroup_actionPerformed(ActionEvent e)
2309   {
2310   }
2311
2312   protected void unGroup_actionPerformed(ActionEvent e)
2313   {
2314   }
2315
2316   protected void copy_actionPerformed(ActionEvent e)
2317   {
2318   }
2319
2320   protected void cut_actionPerformed(ActionEvent e)
2321   {
2322   }
2323
2324   protected void delete_actionPerformed(ActionEvent e)
2325   {
2326   }
2327
2328   protected void pasteNew_actionPerformed(ActionEvent e)
2329   {
2330   }
2331
2332   protected void pasteThis_actionPerformed(ActionEvent e)
2333   {
2334   }
2335
2336   protected void applyToAllGroups_actionPerformed(boolean selected)
2337   {
2338   }
2339
2340   public void createPNG(java.io.File f)
2341   {
2342   }
2343
2344   protected void font_actionPerformed(ActionEvent e)
2345   {
2346   }
2347
2348   protected void seqLimit_actionPerformed(ActionEvent e)
2349   {
2350   }
2351
2352   public void seqDBRef_actionPerformed(ActionEvent e)
2353   {
2354
2355   }
2356
2357   public void createEPS(java.io.File f)
2358   {
2359   }
2360
2361   public void createSVG(java.io.File f)
2362   {
2363
2364   }
2365
2366   protected void loadTreeMenuItem_actionPerformed(ActionEvent e)
2367   {
2368
2369   }
2370
2371   /**
2372    * Template method to handle the 'load T-Coffee scores' menu event.
2373    * <p>
2374    * Subclasses override this method to provide a custom action.
2375    * 
2376    * @param event
2377    *          The raised event
2378    */
2379   protected void loadScores_actionPerformed(ActionEvent event)
2380   {
2381
2382   }
2383
2384   protected void jpred_actionPerformed(ActionEvent e)
2385   {
2386   }
2387
2388   protected void scaleAbove_actionPerformed(ActionEvent e)
2389   {
2390   }
2391
2392   protected void scaleLeft_actionPerformed(ActionEvent e)
2393   {
2394   }
2395
2396   protected void scaleRight_actionPerformed(ActionEvent e)
2397   {
2398   }
2399
2400   protected void modifyPID_actionPerformed()
2401   {
2402   }
2403
2404   protected void modifyConservation_actionPerformed()
2405   {
2406   }
2407
2408   protected void saveAs_actionPerformed(ActionEvent e)
2409   {
2410   }
2411
2412   protected void padGapsMenuitem_actionPerformed(ActionEvent e)
2413   {
2414   }
2415
2416   public void vamsasStore_actionPerformed(ActionEvent e)
2417   {
2418
2419   }
2420
2421   public void vamsasLoad_actionPerformed(ActionEvent e)
2422   {
2423
2424   }
2425
2426   public void showTranslation_actionPerformed(ActionEvent e)
2427   {
2428
2429   }
2430
2431   public void featureSettings_actionPerformed(ActionEvent e)
2432   {
2433
2434   }
2435
2436   public void fetchSequence_actionPerformed(ActionEvent e)
2437   {
2438
2439   }
2440
2441   public void smoothFont_actionPerformed(ActionEvent e)
2442   {
2443
2444   }
2445
2446   public void annotationColour_actionPerformed()
2447   {
2448   }
2449
2450   public void annotationColumn_actionPerformed(ActionEvent e)
2451   {
2452   }
2453
2454   public void associatedData_actionPerformed(ActionEvent e)
2455   {
2456
2457   }
2458
2459   public void autoCalculate_actionPerformed(ActionEvent e)
2460   {
2461
2462   }
2463
2464   public void sortByTreeOption_actionPerformed(ActionEvent e)
2465   {
2466
2467   }
2468
2469   public void showAllSeqs_actionPerformed(ActionEvent e)
2470   {
2471
2472   }
2473
2474   public void showAllColumns_actionPerformed(ActionEvent e)
2475   {
2476
2477   }
2478
2479   public void hideSelSequences_actionPerformed(ActionEvent e)
2480   {
2481
2482   }
2483
2484   public void hideSelColumns_actionPerformed(ActionEvent e)
2485   {
2486
2487   }
2488
2489   public void hiddenMarkers_actionPerformed(ActionEvent e)
2490   {
2491
2492   }
2493
2494   public void findPdbId_actionPerformed(ActionEvent e)
2495   {
2496
2497   }
2498
2499   public void enterPdbId_actionPerformed(ActionEvent e)
2500   {
2501
2502   }
2503
2504   public void pdbFile_actionPerformed(ActionEvent e)
2505   {
2506
2507   }
2508
2509   public void invertColSel_actionPerformed(ActionEvent e)
2510   {
2511
2512   }
2513
2514   public void tabSelectionChanged(int sel)
2515   {
2516
2517   }
2518
2519   public void tabbedPane_mousePressed(MouseEvent e)
2520   {
2521
2522   }
2523
2524   public void tabbedPane_focusGained(FocusEvent e)
2525   {
2526     requestFocus();
2527   }
2528
2529   public void save_actionPerformed(ActionEvent e)
2530   {
2531
2532   }
2533
2534   public void reload_actionPerformed(ActionEvent e)
2535   {
2536
2537   }
2538
2539   public void newView_actionPerformed(ActionEvent e)
2540   {
2541
2542   }
2543
2544   public void textColour_actionPerformed()
2545   {
2546
2547   }
2548
2549   public void idRightAlign_actionPerformed(ActionEvent e)
2550   {
2551
2552   }
2553
2554   public void expandViews_actionPerformed(ActionEvent e)
2555   {
2556
2557   }
2558
2559   public void gatherViews_actionPerformed(ActionEvent e)
2560   {
2561
2562   }
2563
2564   public void buildTreeSortMenu()
2565   {
2566
2567   }
2568
2569   public void pageSetup_actionPerformed(ActionEvent e)
2570   {
2571
2572   }
2573
2574   public void alignmentProperties()
2575   {
2576
2577   }
2578
2579   protected void expand_newalign(ActionEvent e)
2580   {
2581     // TODO Auto-generated method stub
2582
2583   }
2584
2585   protected boolean isShowAutoCalculatedAbove()
2586   {
2587     return showAutoCalculatedAbove;
2588   }
2589
2590   protected void setShowAutoCalculatedAbove(boolean showAutoCalculatedAbove)
2591   {
2592     this.showAutoCalculatedAbove = showAutoCalculatedAbove;
2593   }
2594
2595   protected SequenceAnnotationOrder getAnnotationSortOrder()
2596   {
2597     return annotationSortOrder;
2598   }
2599
2600   protected void setAnnotationSortOrder(
2601           SequenceAnnotationOrder annotationSortOrder)
2602   {
2603     this.annotationSortOrder = annotationSortOrder;
2604   }
2605
2606   public Map<KeyStroke, JMenuItem> getAccelerators()
2607   {
2608     return this.accelerators;
2609   }
2610
2611   /**
2612    * Returns the selected index of the tabbed pane, or -1 if none selected
2613    * (including the case where the tabbed pane has not been made visible).
2614    * 
2615    * @return
2616    */
2617   public int getTabIndex()
2618   {
2619     return tabbedPane.getSelectedIndex();
2620   }
2621
2622   public JPanel getStatusPanel()
2623   {
2624     return statusPanel;
2625   }
2626
2627   /**
2628    * Sets a reference to the containing split frame. Also makes the 'toggle
2629    * split view' menu item visible and checked.
2630    * 
2631    * @param sf
2632    */
2633   public void setSplitFrame(SplitContainerI sf)
2634   {
2635     this.splitFrame = sf;
2636     if (sf != null)
2637     {
2638       this.showComplementMenuItem.setVisible(true);
2639       this.showComplementMenuItem.setState(true);
2640     }
2641   }
2642
2643   public SplitContainerI getSplitViewContainer()
2644   {
2645     return this.splitFrame;
2646   }
2647
2648   protected void showComplement_actionPerformed(boolean complement)
2649   {
2650   }
2651 }