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