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