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