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