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