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