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