2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
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.
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.
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.
21 package jalview.jbgui;
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;
32 import java.awt.BorderLayout;
33 import java.awt.Color;
34 import java.awt.GridLayout;
35 import java.awt.Toolkit;
36 import java.awt.event.ActionEvent;
37 import java.awt.event.ActionListener;
38 import java.awt.event.FocusAdapter;
39 import java.awt.event.FocusEvent;
40 import java.awt.event.KeyEvent;
41 import java.awt.event.MouseAdapter;
42 import java.awt.event.MouseEvent;
43 import java.util.HashMap;
46 import javax.swing.BorderFactory;
47 import javax.swing.ButtonGroup;
48 import javax.swing.JCheckBoxMenuItem;
49 import javax.swing.JInternalFrame;
50 import javax.swing.JLabel;
51 import javax.swing.JMenu;
52 import javax.swing.JMenuBar;
53 import javax.swing.JMenuItem;
54 import javax.swing.JPanel;
55 import javax.swing.JRadioButtonMenuItem;
56 import javax.swing.JTabbedPane;
57 import javax.swing.KeyStroke;
58 import javax.swing.event.ChangeEvent;
59 import javax.swing.event.MenuEvent;
60 import javax.swing.event.MenuListener;
62 public class GAlignFrame extends JInternalFrame
64 protected JMenuBar alignFrameMenuBar = new JMenuBar();
66 protected JMenuItem closeMenuItem = new JMenuItem();
68 protected JMenu webService = new JMenu();
70 protected JMenuItem webServiceNoServices;
72 protected JCheckBoxMenuItem viewBoxesMenuItem = new JCheckBoxMenuItem();
74 protected JCheckBoxMenuItem viewTextMenuItem = new JCheckBoxMenuItem();
76 protected JMenu sortByAnnotScore = new JMenu();
78 public JLabel statusBar = new JLabel();
80 protected JMenu outputTextboxMenu = new JMenu();
82 protected JCheckBoxMenuItem annotationPanelMenuItem = new JCheckBoxMenuItem();
84 protected JCheckBoxMenuItem colourTextMenuItem = new JCheckBoxMenuItem();
86 protected JCheckBoxMenuItem showNonconservedMenuItem = new JCheckBoxMenuItem();
88 protected JMenuItem undoMenuItem = new JMenuItem();
90 protected JMenuItem redoMenuItem = new JMenuItem();
92 protected JCheckBoxMenuItem wrapMenuItem = new JCheckBoxMenuItem();
94 protected JCheckBoxMenuItem renderGapsMenuItem = new JCheckBoxMenuItem();
96 public JCheckBoxMenuItem showSeqFeatures = new JCheckBoxMenuItem();
98 JMenuItem copy = new JMenuItem();
100 JMenuItem cut = new JMenuItem();
102 JMenu pasteMenu = new JMenu();
104 protected JCheckBoxMenuItem seqLimits = new JCheckBoxMenuItem();
106 protected JCheckBoxMenuItem scaleAbove = new JCheckBoxMenuItem();
108 protected JCheckBoxMenuItem scaleLeft = new JCheckBoxMenuItem();
110 protected JCheckBoxMenuItem scaleRight = new JCheckBoxMenuItem();
112 protected JCheckBoxMenuItem applyToAllGroups;
114 protected JMenu colourMenu = new JMenu();
116 protected JMenuItem textColour;
118 protected JCheckBoxMenuItem conservationMenuItem;
120 protected JMenuItem modifyConservation;
122 protected JCheckBoxMenuItem abovePIDThreshold;
124 protected JMenuItem modifyPID;
126 protected JMenuItem annotationColour;
128 protected JMenu sortByTreeMenu = new JMenu();
130 protected JMenu sort = new JMenu();
132 protected JMenuItem calculateTree = new JMenuItem();
134 protected JCheckBoxMenuItem padGapsMenuitem = new JCheckBoxMenuItem();
136 protected JCheckBoxMenuItem showNpFeatsMenuitem = new JCheckBoxMenuItem();
138 protected JCheckBoxMenuItem showDbRefsMenuitem = new JCheckBoxMenuItem();
140 protected JMenuItem showTranslation = new JMenuItem();
142 protected JMenuItem showReverse = new JMenuItem();
144 protected JMenuItem showReverseComplement = new JMenuItem();
146 protected JMenu showProducts = new JMenu();
148 protected JMenuItem runGroovy = new JMenuItem();
150 protected JCheckBoxMenuItem autoCalculate = new JCheckBoxMenuItem();
152 protected JCheckBoxMenuItem sortByTree = new JCheckBoxMenuItem();
154 protected JCheckBoxMenuItem listenToViewSelections = new JCheckBoxMenuItem();
156 protected JPanel statusPanel = new JPanel();
158 protected JMenuItem showAllSeqAnnotations = new JMenuItem();
160 protected JMenuItem hideAllSeqAnnotations = new JMenuItem();
162 protected JMenuItem showAllAlAnnotations = new JMenuItem();
164 protected JMenuItem hideAllAlAnnotations = new JMenuItem();
166 protected JCheckBoxMenuItem showComplementMenuItem = new JCheckBoxMenuItem();
168 protected JCheckBoxMenuItem hiddenMarkers = new JCheckBoxMenuItem();
170 protected JTabbedPane tabbedPane = new JTabbedPane();
172 protected JMenuItem reload = new JMenuItem();
174 protected JMenu formatMenu = new JMenu();
176 protected JCheckBoxMenuItem idRightAlign = new JCheckBoxMenuItem();
178 protected JCheckBoxMenuItem centreColumnLabelsMenuItem = new JCheckBoxMenuItem();
180 protected JCheckBoxMenuItem followHighlightMenuItem = new JCheckBoxMenuItem();
182 protected JMenuItem gatherViews = new JMenuItem();
184 protected JMenuItem expandViews = new JMenuItem();
186 protected JCheckBoxMenuItem showGroupConsensus = new JCheckBoxMenuItem();
188 protected JCheckBoxMenuItem showGroupConservation = new JCheckBoxMenuItem();
190 protected JCheckBoxMenuItem showConsensusHistogram = new JCheckBoxMenuItem();
192 protected JCheckBoxMenuItem showSequenceLogo = new JCheckBoxMenuItem();
194 protected JCheckBoxMenuItem normaliseSequenceLogo = new JCheckBoxMenuItem();
196 protected JCheckBoxMenuItem applyAutoAnnotationSettings = new JCheckBoxMenuItem();
198 private SequenceAnnotationOrder annotationSortOrder;
200 private boolean showAutoCalculatedAbove = false;
202 private Map<KeyStroke, JMenuItem> accelerators = new HashMap<KeyStroke, JMenuItem>();
204 private SplitContainerI splitFrame;
211 setJMenuBar(alignFrameMenuBar);
213 // dynamically fill save as menu with available formats
214 for (String ff : FileFormats.getInstance().getWritableFormats(true))
216 JMenuItem item = new JMenuItem(ff);
218 item.addActionListener(new ActionListener()
221 public void actionPerformed(ActionEvent e)
223 outputText_actionPerformed(e);
227 outputTextboxMenu.add(item);
229 } catch (Exception e)
231 System.err.println(e.toString());
234 if (!Platform.isAMac())
236 closeMenuItem.setMnemonic('C');
237 outputTextboxMenu.setMnemonic('T');
238 undoMenuItem.setMnemonic('Z');
239 redoMenuItem.setMnemonic('0');
240 copy.setMnemonic('C');
241 cut.setMnemonic('U');
242 pasteMenu.setMnemonic('P');
243 reload.setMnemonic('R');
247 private void jbInit() throws Exception
251 JMenuItem saveAs = new JMenuItem(
252 MessageManager.getString("action.save_as"));
253 ActionListener al = new ActionListener()
256 public void actionPerformed(ActionEvent e)
258 saveAs_actionPerformed(e);
262 // FIXME getDefaultToolkit throws an exception in Headless mode
263 KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_S,
264 Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()
265 | KeyEvent.SHIFT_MASK,
267 addMenuActionAndAccelerator(keyStroke, saveAs, al);
269 closeMenuItem.setText(MessageManager.getString("action.close"));
270 keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_W,
271 Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
272 al = new ActionListener()
275 public void actionPerformed(ActionEvent e)
277 closeMenuItem_actionPerformed(false);
280 addMenuActionAndAccelerator(keyStroke, closeMenuItem, al);
282 JMenu editMenu = new JMenu(MessageManager.getString("action.edit"));
283 JMenu viewMenu = new JMenu(MessageManager.getString("action.view"));
284 JMenu annotationsMenu = new JMenu(
285 MessageManager.getString("action.annotations"));
286 JMenu showMenu = new JMenu(MessageManager.getString("action.show"));
287 colourMenu.setText(MessageManager.getString("action.colour"));
288 JMenu calculateMenu = new JMenu(
289 MessageManager.getString("action.calculate"));
290 webService.setText(MessageManager.getString("action.web_service"));
291 JMenuItem selectAllSequenceMenuItem = new JMenuItem(
292 MessageManager.getString("action.select_all"));
293 keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_A,
294 Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
295 al = new ActionListener()
298 public void actionPerformed(ActionEvent e)
300 selectAllSequenceMenuItem_actionPerformed(e);
303 addMenuActionAndAccelerator(keyStroke, selectAllSequenceMenuItem, al);
305 JMenuItem deselectAllSequenceMenuItem = new JMenuItem(
306 MessageManager.getString("action.deselect_all"));
307 keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false);
308 al = new ActionListener()
311 public void actionPerformed(ActionEvent e)
313 deselectAllSequenceMenuItem_actionPerformed(e);
316 addMenuActionAndAccelerator(keyStroke, deselectAllSequenceMenuItem, al);
318 JMenuItem invertSequenceMenuItem = new JMenuItem(
319 MessageManager.getString("action.invert_sequence_selection"));
320 keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_I,
321 Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
322 al = new ActionListener()
325 public void actionPerformed(ActionEvent e)
327 invertSequenceMenuItem_actionPerformed(e);
330 addMenuActionAndAccelerator(keyStroke, invertSequenceMenuItem, al);
332 JMenuItem grpsFromSelection = new JMenuItem(
333 MessageManager.getString("action.make_groups_selection"));
334 grpsFromSelection.addActionListener(new ActionListener()
337 public void actionPerformed(ActionEvent e)
339 makeGrpsFromSelection_actionPerformed(e);
342 JMenuItem expandAlignment = new JMenuItem(
343 MessageManager.getString("action.view_flanking_regions"));
344 expandAlignment.setToolTipText(
345 MessageManager.getString("label.view_flanking_regions"));
346 expandAlignment.addActionListener(new ActionListener()
349 public void actionPerformed(ActionEvent e)
354 JMenuItem remove2LeftMenuItem = new JMenuItem(
355 MessageManager.getString("action.remove_left"));
356 keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_L,
357 Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
358 al = new ActionListener()
361 public void actionPerformed(ActionEvent e)
363 remove2LeftMenuItem_actionPerformed(e);
366 addMenuActionAndAccelerator(keyStroke, remove2LeftMenuItem, al);
368 JMenuItem remove2RightMenuItem = new JMenuItem(
369 MessageManager.getString("action.remove_right"));
370 keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_R,
371 Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
372 al = new ActionListener()
375 public void actionPerformed(ActionEvent e)
377 remove2RightMenuItem_actionPerformed(e);
380 addMenuActionAndAccelerator(keyStroke, remove2RightMenuItem, al);
382 JMenuItem removeGappedColumnMenuItem = new JMenuItem(
383 MessageManager.getString("action.remove_empty_columns"));
384 keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_E,
385 Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
386 al = new ActionListener()
389 public void actionPerformed(ActionEvent e)
391 removeGappedColumnMenuItem_actionPerformed(e);
394 addMenuActionAndAccelerator(keyStroke, removeGappedColumnMenuItem, al);
396 JMenuItem removeAllGapsMenuItem = new JMenuItem(
397 MessageManager.getString("action.remove_all_gaps"));
398 keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_E,
399 Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()
400 | KeyEvent.SHIFT_MASK,
402 al = new ActionListener()
405 public void actionPerformed(ActionEvent e)
407 removeAllGapsMenuItem_actionPerformed(e);
410 addMenuActionAndAccelerator(keyStroke, removeAllGapsMenuItem, al);
412 JMenuItem justifyLeftMenuItem = new JMenuItem(
413 MessageManager.getString("action.left_justify_alignment"));
414 justifyLeftMenuItem.addActionListener(new ActionListener()
417 public void actionPerformed(ActionEvent e)
419 justifyLeftMenuItem_actionPerformed(e);
422 JMenuItem justifyRightMenuItem = new JMenuItem(
423 MessageManager.getString("action.right_justify_alignment"));
424 justifyRightMenuItem.addActionListener(new ActionListener()
427 public void actionPerformed(ActionEvent e)
429 justifyRightMenuItem_actionPerformed(e);
432 viewBoxesMenuItem.setText(MessageManager.getString("action.boxes"));
433 viewBoxesMenuItem.setState(true);
434 viewBoxesMenuItem.addActionListener(new ActionListener()
437 public void actionPerformed(ActionEvent e)
439 viewBoxesMenuItem_actionPerformed(e);
442 viewTextMenuItem.setText(MessageManager.getString("action.text"));
443 viewTextMenuItem.setState(true);
444 viewTextMenuItem.addActionListener(new ActionListener()
447 public void actionPerformed(ActionEvent e)
449 viewTextMenuItem_actionPerformed(e);
452 showNonconservedMenuItem
453 .setText(MessageManager.getString("label.show_non_conserved"));
454 showNonconservedMenuItem.setState(false);
455 showNonconservedMenuItem.addActionListener(new ActionListener()
458 public void actionPerformed(ActionEvent e)
460 showUnconservedMenuItem_actionPerformed(e);
463 JMenuItem sortPairwiseMenuItem = new JMenuItem(
464 MessageManager.getString("action.by_pairwise_id"));
465 sortPairwiseMenuItem.addActionListener(new ActionListener()
468 public void actionPerformed(ActionEvent e)
470 sortPairwiseMenuItem_actionPerformed(e);
473 JMenuItem sortIDMenuItem = new JMenuItem(
474 MessageManager.getString("action.by_id"));
475 sortIDMenuItem.addActionListener(new ActionListener()
478 public void actionPerformed(ActionEvent e)
480 sortIDMenuItem_actionPerformed(e);
483 JMenuItem sortLengthMenuItem = new JMenuItem(
484 MessageManager.getString("action.by_length"));
485 sortLengthMenuItem.addActionListener(new ActionListener()
488 public void actionPerformed(ActionEvent e)
490 sortLengthMenuItem_actionPerformed(e);
493 JMenuItem sortGroupMenuItem = new JMenuItem(
494 MessageManager.getString("action.by_group"));
495 sortGroupMenuItem.addActionListener(new ActionListener()
498 public void actionPerformed(ActionEvent e)
500 sortGroupMenuItem_actionPerformed(e);
504 JMenuItem removeRedundancyMenuItem = new JMenuItem(
505 MessageManager.getString("action.remove_redundancy"));
506 keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_D,
507 Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
508 al = new ActionListener()
511 public void actionPerformed(ActionEvent e)
513 removeRedundancyMenuItem_actionPerformed(e);
516 addMenuActionAndAccelerator(keyStroke, removeRedundancyMenuItem, al);
518 JMenuItem pairwiseAlignmentMenuItem = new JMenuItem(
519 MessageManager.getString("action.pairwise_alignment"));
520 pairwiseAlignmentMenuItem.addActionListener(new ActionListener()
523 public void actionPerformed(ActionEvent e)
525 pairwiseAlignmentMenuItem_actionPerformed(e);
529 this.getContentPane().setLayout(new BorderLayout());
530 alignFrameMenuBar.setFont(new java.awt.Font("Verdana", 0, 11));
531 statusBar.setBackground(Color.white);
532 statusBar.setFont(new java.awt.Font("Verdana", 0, 11));
533 statusBar.setBorder(BorderFactory.createLineBorder(Color.black));
534 statusBar.setText(MessageManager.getString("label.status_bar"));
536 .setText(MessageManager.getString("label.out_to_textbox"));
538 annotationPanelMenuItem.setActionCommand("");
539 annotationPanelMenuItem
540 .setText(MessageManager.getString("label.show_annotations"));
541 annotationPanelMenuItem
542 .setState(Cache.getDefault("SHOW_ANNOTATIONS", true));
543 annotationPanelMenuItem.addActionListener(new ActionListener()
546 public void actionPerformed(ActionEvent e)
548 annotationPanelMenuItem_actionPerformed(e);
551 showAllAlAnnotations.setText(
552 MessageManager.getString("label.show_all_al_annotations"));
553 final boolean isAnnotationPanelShown = annotationPanelMenuItem
555 showAllAlAnnotations.setEnabled(isAnnotationPanelShown);
556 showAllAlAnnotations.addActionListener(new ActionListener()
559 public void actionPerformed(ActionEvent e)
561 showAllAnnotations_actionPerformed(false, true);
564 hideAllAlAnnotations.setText(
565 MessageManager.getString("label.hide_all_al_annotations"));
566 hideAllAlAnnotations.setEnabled(isAnnotationPanelShown);
567 hideAllAlAnnotations.addActionListener(new ActionListener()
570 public void actionPerformed(ActionEvent e)
572 hideAllAnnotations_actionPerformed(false, true);
575 showAllSeqAnnotations.setText(
576 MessageManager.getString("label.show_all_seq_annotations"));
577 showAllSeqAnnotations.setEnabled(isAnnotationPanelShown);
578 showAllSeqAnnotations.addActionListener(new ActionListener()
581 public void actionPerformed(ActionEvent e)
583 showAllAnnotations_actionPerformed(true, false);
586 hideAllSeqAnnotations.setText(
587 MessageManager.getString("label.hide_all_seq_annotations"));
588 hideAllSeqAnnotations.setEnabled(isAnnotationPanelShown);
589 hideAllSeqAnnotations.addActionListener(new ActionListener()
592 public void actionPerformed(ActionEvent e)
594 hideAllAnnotations_actionPerformed(true, false);
597 SequenceAnnotationOrder sortAnnotationsBy = SequenceAnnotationOrder
598 .valueOf(Cache.getDefault(Preferences.SORT_ANNOTATIONS,
599 SequenceAnnotationOrder.NONE.name()));
600 final JCheckBoxMenuItem sortAnnBySequence = new JCheckBoxMenuItem(
601 MessageManager.getString("label.sort_annotations_by_sequence"));
602 final JCheckBoxMenuItem sortAnnByLabel = new JCheckBoxMenuItem(
603 MessageManager.getString("label.sort_annotations_by_label"));
605 sortAnnBySequence.setSelected(
606 sortAnnotationsBy == SequenceAnnotationOrder.SEQUENCE_AND_LABEL);
607 sortAnnBySequence.addActionListener(new ActionListener()
610 public void actionPerformed(ActionEvent e)
612 boolean newState = sortAnnBySequence.getState();
613 sortAnnByLabel.setSelected(false);
614 setAnnotationSortOrder(
615 newState ? SequenceAnnotationOrder.SEQUENCE_AND_LABEL
616 : SequenceAnnotationOrder.NONE);
617 sortAnnotations_actionPerformed();
620 sortAnnByLabel.setSelected(
621 sortAnnotationsBy == SequenceAnnotationOrder.LABEL_AND_SEQUENCE);
622 sortAnnByLabel.addActionListener(new ActionListener()
625 public void actionPerformed(ActionEvent e)
627 boolean newState = sortAnnByLabel.getState();
628 sortAnnBySequence.setSelected(false);
629 setAnnotationSortOrder(
630 newState ? SequenceAnnotationOrder.LABEL_AND_SEQUENCE
631 : SequenceAnnotationOrder.NONE);
632 sortAnnotations_actionPerformed();
635 colourTextMenuItem = new JCheckBoxMenuItem(
636 MessageManager.getString("label.colour_text"));
637 colourTextMenuItem.addActionListener(new ActionListener()
640 public void actionPerformed(ActionEvent e)
642 colourTextMenuItem_actionPerformed(e);
646 JMenuItem htmlMenuItem = new JMenuItem(
647 MessageManager.getString("label.html"));
648 htmlMenuItem.addActionListener(new ActionListener()
651 public void actionPerformed(ActionEvent e)
653 htmlMenuItem_actionPerformed(e);
657 JMenuItem createBioJS = new JMenuItem(
658 MessageManager.getString("label.biojs_html_export"));
659 createBioJS.addActionListener(new java.awt.event.ActionListener()
662 public void actionPerformed(ActionEvent e)
664 bioJSMenuItem_actionPerformed(e);
668 JMenuItem overviewMenuItem = new JMenuItem(
669 MessageManager.getString("label.overview_window"));
670 overviewMenuItem.addActionListener(new ActionListener()
673 public void actionPerformed(ActionEvent e)
675 overviewMenuItem_actionPerformed(e);
679 undoMenuItem.setEnabled(false);
680 undoMenuItem.setText(MessageManager.getString("action.undo"));
681 keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_Z,
682 Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
683 al = new ActionListener()
686 public void actionPerformed(ActionEvent e)
688 undoMenuItem_actionPerformed(e);
691 addMenuActionAndAccelerator(keyStroke, undoMenuItem, al);
693 redoMenuItem.setEnabled(false);
694 redoMenuItem.setText(MessageManager.getString("action.redo"));
695 keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_Y,
696 Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
697 al = new ActionListener()
700 public void actionPerformed(ActionEvent e)
702 redoMenuItem_actionPerformed(e);
705 addMenuActionAndAccelerator(keyStroke, redoMenuItem, al);
707 wrapMenuItem.setText(MessageManager.getString("label.wrap"));
708 wrapMenuItem.addActionListener(new ActionListener()
711 public void actionPerformed(ActionEvent e)
713 wrapMenuItem_actionPerformed(e);
717 JMenuItem printMenuItem = new JMenuItem(
718 MessageManager.getString("action.print"));
719 keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_P,
720 Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
721 al = new ActionListener()
724 public void actionPerformed(ActionEvent e)
726 printMenuItem_actionPerformed(e);
729 addMenuActionAndAccelerator(keyStroke, printMenuItem, al);
732 .setText(MessageManager.getString("action.show_gaps"));
733 renderGapsMenuItem.setState(true);
734 renderGapsMenuItem.addActionListener(new ActionListener()
737 public void actionPerformed(ActionEvent e)
739 renderGapsMenuItem_actionPerformed(e);
743 JMenuItem findMenuItem = new JMenuItem(
744 MessageManager.getString("action.find"));
745 keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_F,
746 Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
747 findMenuItem.setToolTipText(JvSwingUtils.wrapTooltip(true,
748 MessageManager.getString("label.find_tip")));
749 al = new ActionListener()
752 public void actionPerformed(ActionEvent e)
754 findMenuItem_actionPerformed(e);
757 addMenuActionAndAccelerator(keyStroke, findMenuItem, al);
759 showSeqFeatures.setText(
760 MessageManager.getString("label.show_sequence_features"));
761 showSeqFeatures.addActionListener(new ActionListener()
764 public void actionPerformed(ActionEvent actionEvent)
766 showSeqFeatures_actionPerformed(actionEvent);
770 * showSeqFeaturesHeight.setText("Vary Sequence Feature Height");
771 * showSeqFeaturesHeight.addActionListener(new ActionListener() { public
772 * void actionPerformed(ActionEvent actionEvent) {
773 * showSeqFeaturesHeight_actionPerformed(actionEvent); } });
776 .setText(MessageManager.getString("label.show_database_refs"));
777 showDbRefsMenuitem.addActionListener(new ActionListener()
781 public void actionPerformed(ActionEvent e)
783 showDbRefs_actionPerformed(e);
787 showNpFeatsMenuitem.setText(
788 MessageManager.getString("label.show_non_positional_features"));
789 showNpFeatsMenuitem.addActionListener(new ActionListener()
793 public void actionPerformed(ActionEvent e)
795 showNpFeats_actionPerformed(e);
799 showGroupConservation
800 .setText(MessageManager.getString("label.group_conservation"));
801 showGroupConservation.addActionListener(new ActionListener()
805 public void actionPerformed(ActionEvent e)
807 showGroupConservation_actionPerformed(e);
813 .setText(MessageManager.getString("label.group_consensus"));
814 showGroupConsensus.addActionListener(new ActionListener()
818 public void actionPerformed(ActionEvent e)
820 showGroupConsensus_actionPerformed(e);
824 showConsensusHistogram.setText(
825 MessageManager.getString("label.show_consensus_histogram"));
826 showConsensusHistogram.addActionListener(new ActionListener()
830 public void actionPerformed(ActionEvent e)
832 showConsensusHistogram_actionPerformed(e);
837 .setText(MessageManager.getString("label.show_consensus_logo"));
838 showSequenceLogo.addActionListener(new ActionListener()
842 public void actionPerformed(ActionEvent e)
844 showSequenceLogo_actionPerformed(e);
848 normaliseSequenceLogo
849 .setText(MessageManager.getString("label.norm_consensus_logo"));
850 normaliseSequenceLogo.addActionListener(new ActionListener()
854 public void actionPerformed(ActionEvent e)
856 normaliseSequenceLogo_actionPerformed(e);
860 applyAutoAnnotationSettings
861 .setText(MessageManager.getString("label.apply_all_groups"));
862 applyAutoAnnotationSettings.setState(false);
863 applyAutoAnnotationSettings.setVisible(true);
864 applyAutoAnnotationSettings.addActionListener(new ActionListener()
867 public void actionPerformed(ActionEvent e)
869 applyAutoAnnotationSettings_actionPerformed(e);
873 ButtonGroup buttonGroup = new ButtonGroup();
874 final JRadioButtonMenuItem showAutoFirst = new JRadioButtonMenuItem(
875 MessageManager.getString("label.show_first"));
876 final JRadioButtonMenuItem showAutoLast = new JRadioButtonMenuItem(
877 MessageManager.getString("label.show_last"));
878 buttonGroup.add(showAutoFirst);
879 buttonGroup.add(showAutoLast);
880 final boolean autoFirst = Cache
881 .getDefault(Preferences.SHOW_AUTOCALC_ABOVE, false);
882 showAutoFirst.setSelected(autoFirst);
883 setShowAutoCalculatedAbove(autoFirst);
884 showAutoFirst.addActionListener(new ActionListener()
887 public void actionPerformed(ActionEvent e)
889 setShowAutoCalculatedAbove(showAutoFirst.isSelected());
890 sortAnnotations_actionPerformed();
893 showAutoLast.setSelected(!showAutoFirst.isSelected());
894 showAutoLast.addActionListener(new ActionListener()
897 public void actionPerformed(ActionEvent e)
899 setShowAutoCalculatedAbove(!showAutoLast.isSelected());
900 sortAnnotations_actionPerformed();
904 JMenuItem deleteGroups = new JMenuItem(
905 MessageManager.getString("action.undefine_groups"));
906 keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_U,
907 Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
908 al = new ActionListener()
911 public void actionPerformed(ActionEvent e)
913 deleteGroups_actionPerformed(e);
916 addMenuActionAndAccelerator(keyStroke, deleteGroups, al);
918 JMenuItem annotationColumn = new JMenuItem(
919 MessageManager.getString("action.select_by_annotation"));
920 annotationColumn.addActionListener(new ActionListener()
923 public void actionPerformed(ActionEvent e)
925 annotationColumn_actionPerformed(e);
929 JMenuItem createGroup = new JMenuItem(
930 MessageManager.getString("action.create_group"));
931 keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G,
932 Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
933 al = new ActionListener()
936 public void actionPerformed(ActionEvent e)
938 createGroup_actionPerformed(e);
941 addMenuActionAndAccelerator(keyStroke, createGroup, al);
943 JMenuItem unGroup = new JMenuItem(
944 MessageManager.getString("action.remove_group"));
945 keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G,
946 Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()
947 | KeyEvent.SHIFT_MASK,
949 al = new ActionListener()
952 public void actionPerformed(ActionEvent e)
954 unGroup_actionPerformed(e);
957 addMenuActionAndAccelerator(keyStroke, unGroup, al);
959 copy.setText(MessageManager.getString("action.copy"));
960 keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_C,
961 Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
963 al = new ActionListener()
966 public void actionPerformed(ActionEvent e)
968 copy_actionPerformed(e);
971 addMenuActionAndAccelerator(keyStroke, copy, al);
973 cut.setText(MessageManager.getString("action.cut"));
974 keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_X,
975 Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
976 al = new ActionListener()
979 public void actionPerformed(ActionEvent e)
981 cut_actionPerformed(e);
984 addMenuActionAndAccelerator(keyStroke, cut, al);
986 JMenuItem delete = new JMenuItem(
987 MessageManager.getString("action.delete"));
988 delete.addActionListener(new ActionListener()
991 public void actionPerformed(ActionEvent e)
993 delete_actionPerformed(e);
997 pasteMenu.setText(MessageManager.getString("action.paste"));
998 JMenuItem pasteNew = new JMenuItem(
999 MessageManager.getString("label.to_new_alignment"));
1000 keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_V,
1001 Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()
1002 | KeyEvent.SHIFT_MASK,
1004 al = new ActionListener()
1007 public void actionPerformed(ActionEvent e)
1009 pasteNew_actionPerformed(e);
1012 addMenuActionAndAccelerator(keyStroke, pasteNew, al);
1014 JMenuItem pasteThis = new JMenuItem(
1015 MessageManager.getString("label.to_this_alignment"));
1016 keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_V,
1017 Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
1018 al = new ActionListener()
1021 public void actionPerformed(ActionEvent e)
1023 pasteThis_actionPerformed(e);
1026 addMenuActionAndAccelerator(keyStroke, pasteThis, al);
1028 JMenuItem createPNG = new JMenuItem("PNG");
1029 createPNG.addActionListener(new ActionListener()
1032 public void actionPerformed(ActionEvent e)
1037 createPNG.setActionCommand(
1038 MessageManager.getString("label.save_png_image"));
1040 JMenuItem font = new JMenuItem(MessageManager.getString("action.font"));
1041 font.addActionListener(new ActionListener()
1044 public void actionPerformed(ActionEvent e)
1046 font_actionPerformed(e);
1050 MessageManager.getString("label.show_sequence_limits"));
1051 seqLimits.setState(jalview.bin.Cache.getDefault("SHOW_JVSUFFIX", true));
1052 seqLimits.addActionListener(new ActionListener()
1055 public void actionPerformed(ActionEvent e)
1057 seqLimit_actionPerformed(e);
1060 JMenuItem epsFile = new JMenuItem("EPS");
1061 epsFile.addActionListener(new ActionListener()
1064 public void actionPerformed(ActionEvent e)
1070 JMenuItem createSVG = new JMenuItem("SVG");
1071 createSVG.addActionListener(new ActionListener()
1074 public void actionPerformed(ActionEvent e)
1080 JMenuItem loadTreeMenuItem = new JMenuItem(
1081 MessageManager.getString("label.load_associated_tree"));
1082 loadTreeMenuItem.setActionCommand(
1083 MessageManager.getString("label.load_tree_for_sequence_set"));
1084 loadTreeMenuItem.addActionListener(new ActionListener()
1087 public void actionPerformed(ActionEvent e)
1089 loadTreeMenuItem_actionPerformed(e);
1093 scaleAbove.setVisible(false);
1094 scaleAbove.setText(MessageManager.getString("action.scale_above"));
1095 scaleAbove.addActionListener(new ActionListener()
1098 public void actionPerformed(ActionEvent e)
1100 scaleAbove_actionPerformed(e);
1103 scaleLeft.setVisible(false);
1104 scaleLeft.setSelected(true);
1105 scaleLeft.setText(MessageManager.getString("action.scale_left"));
1106 scaleLeft.addActionListener(new ActionListener()
1109 public void actionPerformed(ActionEvent e)
1111 scaleLeft_actionPerformed(e);
1114 scaleRight.setVisible(false);
1115 scaleRight.setSelected(true);
1116 scaleRight.setText(MessageManager.getString("action.scale_right"));
1117 scaleRight.addActionListener(new ActionListener()
1120 public void actionPerformed(ActionEvent e)
1122 scaleRight_actionPerformed(e);
1125 centreColumnLabelsMenuItem.setVisible(true);
1126 centreColumnLabelsMenuItem.setState(false);
1127 centreColumnLabelsMenuItem.setText(
1128 MessageManager.getString("label.centre_column_labels"));
1129 centreColumnLabelsMenuItem.addActionListener(new ActionListener()
1132 public void actionPerformed(ActionEvent e)
1134 centreColumnLabels_actionPerformed(e);
1137 followHighlightMenuItem.setVisible(true);
1138 followHighlightMenuItem.setState(true);
1139 followHighlightMenuItem
1140 .setText(MessageManager.getString("label.automatic_scrolling"));
1141 followHighlightMenuItem.addActionListener(new ActionListener()
1145 public void actionPerformed(ActionEvent e)
1147 followHighlight_actionPerformed();
1153 .setText(MessageManager.getString("action.by_tree_order"));
1154 sort.setText(MessageManager.getString("action.sort"));
1155 sort.addMenuListener(new MenuListener()
1158 public void menuSelected(MenuEvent e)
1160 buildTreeSortMenu();
1164 public void menuDeselected(MenuEvent e)
1169 public void menuCanceled(MenuEvent e)
1174 .setText(MessageManager.getString("label.sort_by_score"));
1175 sort.add(sortByAnnotScore);
1176 sort.addMenuListener(new javax.swing.event.MenuListener()
1180 public void menuCanceled(MenuEvent e)
1185 public void menuDeselected(MenuEvent e)
1190 public void menuSelected(MenuEvent e)
1192 buildSortByAnnotationScoresMenu();
1195 sortByAnnotScore.setVisible(false);
1198 .setText(MessageManager.getString("action.calculate_tree_pca"));
1200 padGapsMenuitem.setText(MessageManager.getString("label.pad_gaps"));
1202 .setState(jalview.bin.Cache.getDefault("PAD_GAPS", false));
1203 padGapsMenuitem.addActionListener(new ActionListener()
1206 public void actionPerformed(ActionEvent e)
1208 padGapsMenuitem_actionPerformed(e);
1211 JMenuItem vamsasStore = new JMenuItem(
1212 MessageManager.getString("label.vamsas_store"));
1213 vamsasStore.setVisible(false);
1214 vamsasStore.addActionListener(new ActionListener()
1217 public void actionPerformed(ActionEvent e)
1219 vamsasStore_actionPerformed(e);
1223 .setText(MessageManager.getString("label.translate_cDNA"));
1224 showTranslation.addActionListener(new ActionListener()
1227 public void actionPerformed(ActionEvent e)
1229 showTranslation_actionPerformed(e);
1232 showReverse.setText(MessageManager.getString("label.reverse"));
1233 showReverse.addActionListener(new ActionListener()
1236 public void actionPerformed(ActionEvent e)
1238 showReverse_actionPerformed(false);
1241 showReverseComplement
1242 .setText(MessageManager.getString("label.reverse_complement"));
1243 showReverseComplement.addActionListener(new ActionListener()
1246 public void actionPerformed(ActionEvent e)
1248 showReverse_actionPerformed(true);
1252 JMenuItem extractScores = new JMenuItem(
1253 MessageManager.getString("label.extract_scores"));
1254 extractScores.addActionListener(new ActionListener()
1257 public void actionPerformed(ActionEvent e)
1259 extractScores_actionPerformed(e);
1262 extractScores.setVisible(true);
1263 // JBPNote: TODO: make gui for regex based score extraction
1265 // for show products actions see AlignFrame.canShowProducts
1266 showProducts.setText(MessageManager.getString("label.get_cross_refs"));
1268 runGroovy.setText(MessageManager.getString("label.run_groovy"));
1269 runGroovy.setToolTipText(
1270 MessageManager.getString("label.run_groovy_tip"));
1271 runGroovy.addActionListener(new ActionListener()
1274 public void actionPerformed(ActionEvent e)
1276 runGroovy_actionPerformed();
1280 JMenuItem openFeatureSettings = new JMenuItem(
1281 MessageManager.getString("action.feature_settings"));
1282 openFeatureSettings.addActionListener(new ActionListener()
1285 public void actionPerformed(ActionEvent e)
1287 featureSettings_actionPerformed(e);
1290 JMenuItem fetchSequence = new JMenuItem(
1291 MessageManager.getString("label.fetch_sequences"));
1292 fetchSequence.addActionListener(new ActionListener()
1295 public void actionPerformed(ActionEvent e)
1297 fetchSequence_actionPerformed(e);
1301 JMenuItem associatedData = new JMenuItem(
1302 MessageManager.getString("label.load_features_annotations"));
1303 associatedData.addActionListener(new ActionListener()
1306 public void actionPerformed(ActionEvent e)
1308 associatedData_actionPerformed(e);
1311 autoCalculate.setText(
1312 MessageManager.getString("label.autocalculate_consensus"));
1313 autoCalculate.setState(
1314 jalview.bin.Cache.getDefault("AUTO_CALC_CONSENSUS", true));
1315 autoCalculate.addActionListener(new ActionListener()
1318 public void actionPerformed(ActionEvent e)
1320 autoCalculate_actionPerformed(e);
1324 MessageManager.getString("label.sort_alignment_new_tree"));
1325 sortByTree.setToolTipText("<html>" + MessageManager.getString(
1326 "label.enable_automatically_sort_alignment_when_open_new_tree"));
1328 .setState(jalview.bin.Cache.getDefault("SORT_BY_TREE", false));
1329 sortByTree.addActionListener(new ActionListener()
1332 public void actionPerformed(ActionEvent e)
1334 sortByTreeOption_actionPerformed(e);
1338 listenToViewSelections.setText(
1339 MessageManager.getString("label.listen_for_selections"));
1340 listenToViewSelections
1341 .setToolTipText("<html>" + MessageManager.getString(
1342 "label.selections_mirror_selections_made_same_sequences_other_views"));
1343 listenToViewSelections.setState(false);
1344 listenToViewSelections.addActionListener(new ActionListener()
1347 public void actionPerformed(ActionEvent e)
1349 listenToViewSelections_actionPerformed(e);
1353 JMenu addSequenceMenu = new JMenu(
1354 MessageManager.getString("label.add_sequences"));
1355 JMenuItem addFromFile = new JMenuItem(
1356 MessageManager.getString("label.from_file"));
1357 addFromFile.addActionListener(new ActionListener()
1360 public void actionPerformed(ActionEvent e)
1362 addFromFile_actionPerformed(e);
1365 JMenuItem addFromText = new JMenuItem(
1366 MessageManager.getString("label.from_textbox"));
1367 addFromText.addActionListener(new ActionListener()
1370 public void actionPerformed(ActionEvent e)
1372 addFromText_actionPerformed(e);
1375 JMenuItem addFromURL = new JMenuItem(
1376 MessageManager.getString("label.from_url"));
1377 addFromURL.addActionListener(new ActionListener()
1380 public void actionPerformed(ActionEvent e)
1382 addFromURL_actionPerformed(e);
1385 JMenuItem exportFeatures = new JMenuItem(
1386 MessageManager.getString("label.export_features"));
1387 exportFeatures.addActionListener(new ActionListener()
1390 public void actionPerformed(ActionEvent e)
1392 exportFeatures_actionPerformed(e);
1395 JMenuItem exportAnnotations = new JMenuItem(
1396 MessageManager.getString("label.export_annotations"));
1397 exportAnnotations.addActionListener(new ActionListener()
1400 public void actionPerformed(ActionEvent e)
1402 exportAnnotations_actionPerformed(e);
1405 statusPanel.setLayout(new GridLayout());
1406 JMenuItem showAllSeqs = new JMenuItem(
1407 MessageManager.getString("label.all_sequences"));
1408 showAllSeqs.setToolTipText(
1409 MessageManager.getString("label.toggle_sequence_visibility"));
1410 showAllSeqs.addActionListener(new ActionListener()
1413 public void actionPerformed(ActionEvent e)
1415 showAllSeqs_actionPerformed(e);
1418 JMenuItem showAllColumns = new JMenuItem(
1419 MessageManager.getString("label.all_columns"));
1420 showAllColumns.setToolTipText(
1421 MessageManager.getString("label.toggle_columns_visibility"));
1422 showAllColumns.addActionListener(new ActionListener()
1425 public void actionPerformed(ActionEvent e)
1427 showAllColumns_actionPerformed(e);
1430 JMenu hideMenu = new JMenu(MessageManager.getString("action.hide"));
1431 JMenuItem hideSelSequences = new JMenuItem(
1432 MessageManager.getString("label.selected_sequences"));
1433 hideSelSequences.setToolTipText(
1434 MessageManager.getString("label.toggle_sequence_visibility"));
1435 hideSelSequences.addActionListener(new ActionListener()
1438 public void actionPerformed(ActionEvent e)
1440 hideSelSequences_actionPerformed(e);
1443 JMenuItem hideSelColumns = new JMenuItem(
1444 MessageManager.getString("label.selected_columns"));
1445 hideSelColumns.setToolTipText(
1446 MessageManager.getString("label.toggle_columns_visibility"));
1447 hideSelColumns.addActionListener(new ActionListener()
1450 public void actionPerformed(ActionEvent e)
1452 hideSelColumns_actionPerformed(e);
1455 JMenuItem hideAllSelection = new JMenuItem(
1456 MessageManager.getString("label.selected_region"));
1457 hideAllSelection.addActionListener(new ActionListener()
1460 public void actionPerformed(ActionEvent e)
1462 hideAllSelection_actionPerformed(e);
1465 // TODO: should be hidden if no selection exists.
1466 JMenuItem hideAllButSelection = new JMenuItem(
1467 MessageManager.getString("label.all_but_selected_region"));
1468 hideAllButSelection.addActionListener(new ActionListener()
1471 public void actionPerformed(ActionEvent e)
1473 hideAllButSelection_actionPerformed(e);
1476 JMenuItem showAllhidden = new JMenuItem(
1477 MessageManager.getString("label.all_sequences_columns"));
1478 showAllhidden.setToolTipText(MessageManager
1479 .getString("label.toggles_visibility_hidden_selected_regions"));
1480 showAllhidden.addActionListener(new ActionListener()
1483 public void actionPerformed(ActionEvent e)
1485 showAllhidden_actionPerformed(e);
1488 hiddenMarkers.setText(
1489 MessageManager.getString("action.show_hidden_markers"));
1490 hiddenMarkers.addActionListener(new ActionListener()
1493 public void actionPerformed(ActionEvent e)
1495 hiddenMarkers_actionPerformed(e);
1499 JMenuItem invertColSel = new JMenuItem(
1500 MessageManager.getString("action.invert_column_selection"));
1501 keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_I,
1502 Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()
1503 | KeyEvent.ALT_MASK,
1505 al = new ActionListener()
1508 public void actionPerformed(ActionEvent e)
1510 invertColSel_actionPerformed(e);
1513 addMenuActionAndAccelerator(keyStroke, invertColSel, al);
1515 showComplementMenuItem.setVisible(false);
1516 showComplementMenuItem.addActionListener(new ActionListener()
1519 public void actionPerformed(ActionEvent e)
1521 showComplement_actionPerformed(showComplementMenuItem.getState());
1525 tabbedPane.addChangeListener(new javax.swing.event.ChangeListener()
1528 public void stateChanged(ChangeEvent evt)
1530 JTabbedPane pane = (JTabbedPane) evt.getSource();
1531 int sel = pane.getSelectedIndex();
1532 tabSelectionChanged(sel);
1535 tabbedPane.addMouseListener(new MouseAdapter()
1538 public void mousePressed(MouseEvent e)
1540 if (e.isPopupTrigger()) // Mac
1542 tabbedPane_mousePressed(e);
1547 public void mouseReleased(MouseEvent e)
1549 if (e.isPopupTrigger()) // Windows
1551 tabbedPane_mousePressed(e);
1555 tabbedPane.addFocusListener(new FocusAdapter()
1558 public void focusGained(FocusEvent e)
1560 tabbedPane_focusGained(e);
1564 JMenuItem save = new JMenuItem(MessageManager.getString("action.save"));
1565 keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_S,
1566 Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
1567 al = new ActionListener()
1570 public void actionPerformed(ActionEvent e)
1572 save_actionPerformed(e);
1575 addMenuActionAndAccelerator(keyStroke, save, al);
1577 reload.setEnabled(false);
1578 reload.setText(MessageManager.getString("action.reload"));
1579 reload.addActionListener(new ActionListener()
1582 public void actionPerformed(ActionEvent e)
1584 reload_actionPerformed(e);
1588 JMenuItem newView = new JMenuItem(
1589 MessageManager.getString("action.new_view"));
1590 keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_T,
1591 Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
1592 al = new ActionListener()
1595 public void actionPerformed(ActionEvent e)
1597 newView_actionPerformed(e);
1600 addMenuActionAndAccelerator(keyStroke, newView, al);
1602 tabbedPane.setToolTipText("<html><i>"
1603 + MessageManager.getString("label.rename_tab_eXpand_reGroup")
1606 formatMenu.setText(MessageManager.getString("action.format"));
1607 JMenu selectMenu = new JMenu(MessageManager.getString("action.select"));
1609 idRightAlign.setText(
1610 MessageManager.getString("label.right_align_sequence_id"));
1611 idRightAlign.addActionListener(new ActionListener()
1614 public void actionPerformed(ActionEvent e)
1616 idRightAlign_actionPerformed(e);
1620 gatherViews.setEnabled(false);
1621 gatherViews.setText(MessageManager.getString("action.gather_views"));
1622 keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G, 0, false);
1623 al = new ActionListener()
1626 public void actionPerformed(ActionEvent e)
1628 gatherViews_actionPerformed(e);
1631 addMenuActionAndAccelerator(keyStroke, gatherViews, al);
1633 expandViews.setEnabled(false);
1634 expandViews.setText(MessageManager.getString("action.expand_views"));
1635 keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_X, 0, false);
1636 al = new ActionListener()
1639 public void actionPerformed(ActionEvent e)
1641 expandViews_actionPerformed(e);
1644 addMenuActionAndAccelerator(keyStroke, expandViews, al);
1646 JMenuItem pageSetup = new JMenuItem(
1647 MessageManager.getString("action.page_setup"));
1648 pageSetup.addActionListener(new ActionListener()
1651 public void actionPerformed(ActionEvent e)
1653 pageSetup_actionPerformed(e);
1656 JMenuItem alignmentProperties = new JMenuItem(
1657 MessageManager.getString("label.alignment_props"));
1658 alignmentProperties.addActionListener(new ActionListener()
1661 public void actionPerformed(ActionEvent actionEvent)
1663 alignmentProperties();
1666 JMenuItem selectHighlighted = new JMenuItem(
1667 MessageManager.getString("action.select_highlighted_columns"));
1668 selectHighlighted.setToolTipText(
1669 MessageManager.getString("tooltip.select_highlighted_columns"));
1670 al = new ActionListener()
1673 public void actionPerformed(ActionEvent actionEvent)
1675 selectHighlightedColumns_actionPerformed(actionEvent);
1678 selectHighlighted.addActionListener(al);
1679 JMenu tooltipSettingsMenu = new JMenu(
1680 MessageManager.getString("label.sequence_id_tooltip"));
1681 JMenu autoAnnMenu = new JMenu(
1682 MessageManager.getString("label.autocalculated_annotation"));
1684 JMenu exportImageMenu = new JMenu(
1685 MessageManager.getString("label.export_image"));
1686 JMenu fileMenu = new JMenu(MessageManager.getString("action.file"));
1687 alignFrameMenuBar.add(fileMenu);
1688 alignFrameMenuBar.add(editMenu);
1689 alignFrameMenuBar.add(selectMenu);
1690 alignFrameMenuBar.add(viewMenu);
1691 alignFrameMenuBar.add(annotationsMenu);
1692 alignFrameMenuBar.add(formatMenu);
1693 alignFrameMenuBar.add(colourMenu);
1694 alignFrameMenuBar.add(calculateMenu);
1695 alignFrameMenuBar.add(webService);
1697 fileMenu.add(fetchSequence);
1698 fileMenu.add(addSequenceMenu);
1699 fileMenu.add(reload);
1700 fileMenu.addSeparator();
1701 fileMenu.add(vamsasStore);
1703 fileMenu.add(saveAs);
1704 fileMenu.add(outputTextboxMenu);
1705 fileMenu.add(pageSetup);
1706 fileMenu.add(printMenuItem);
1707 fileMenu.addSeparator();
1708 fileMenu.add(exportImageMenu);
1709 fileMenu.add(exportFeatures);
1710 fileMenu.add(exportAnnotations);
1711 fileMenu.add(loadTreeMenuItem);
1712 fileMenu.add(associatedData);
1713 fileMenu.addSeparator();
1714 fileMenu.add(closeMenuItem);
1716 pasteMenu.add(pasteNew);
1717 pasteMenu.add(pasteThis);
1718 editMenu.add(undoMenuItem);
1719 editMenu.add(redoMenuItem);
1722 editMenu.add(pasteMenu);
1723 editMenu.add(delete);
1724 editMenu.addSeparator();
1725 editMenu.add(remove2LeftMenuItem);
1726 editMenu.add(remove2RightMenuItem);
1727 editMenu.add(removeGappedColumnMenuItem);
1728 editMenu.add(removeAllGapsMenuItem);
1729 editMenu.add(removeRedundancyMenuItem);
1730 editMenu.addSeparator();
1731 // dont add these yet in the CVS build - they cannot be undone!
1732 // Excluded from Jalview 2.5 release - undo needs to be implemented.
1733 // editMenu.add(justifyLeftMenuItem);
1734 // editMenu.add(justifyRightMenuItem);
1735 // editMenu.addSeparator();
1736 editMenu.add(padGapsMenuitem);
1738 showMenu.add(showAllColumns);
1739 showMenu.add(showAllSeqs);
1740 showMenu.add(showAllhidden);
1741 hideMenu.add(hideSelColumns);
1742 hideMenu.add(hideSelSequences);
1743 hideMenu.add(hideAllSelection);
1744 hideMenu.add(hideAllButSelection);
1745 viewMenu.add(newView);
1746 viewMenu.add(expandViews);
1747 viewMenu.add(gatherViews);
1748 viewMenu.addSeparator();
1749 viewMenu.add(showMenu);
1750 viewMenu.add(hideMenu);
1751 viewMenu.add(showComplementMenuItem);
1752 viewMenu.addSeparator();
1753 viewMenu.add(followHighlightMenuItem);
1754 viewMenu.addSeparator();
1755 viewMenu.add(showSeqFeatures);
1756 // viewMenu.add(showSeqFeaturesHeight);
1757 viewMenu.add(openFeatureSettings);
1758 tooltipSettingsMenu.add(showDbRefsMenuitem);
1759 tooltipSettingsMenu.add(showNpFeatsMenuitem);
1760 viewMenu.add(tooltipSettingsMenu);
1761 viewMenu.addSeparator();
1762 viewMenu.add(alignmentProperties);
1763 viewMenu.addSeparator();
1764 viewMenu.add(overviewMenuItem);
1766 annotationsMenu.add(annotationPanelMenuItem);
1767 annotationsMenu.addSeparator();
1768 annotationsMenu.add(showAllAlAnnotations);
1769 annotationsMenu.add(hideAllAlAnnotations);
1770 annotationsMenu.addSeparator();
1771 annotationsMenu.add(showAllSeqAnnotations);
1772 annotationsMenu.add(hideAllSeqAnnotations);
1773 annotationsMenu.add(sortAnnBySequence);
1774 annotationsMenu.add(sortAnnByLabel);
1775 annotationsMenu.addSeparator();
1776 autoAnnMenu.add(showAutoFirst);
1777 autoAnnMenu.add(showAutoLast);
1778 autoAnnMenu.addSeparator();
1779 autoAnnMenu.add(applyAutoAnnotationSettings);
1780 autoAnnMenu.add(showConsensusHistogram);
1781 autoAnnMenu.add(showSequenceLogo);
1782 autoAnnMenu.add(normaliseSequenceLogo);
1783 autoAnnMenu.addSeparator();
1784 autoAnnMenu.add(showGroupConservation);
1785 autoAnnMenu.add(showGroupConsensus);
1786 annotationsMenu.add(autoAnnMenu);
1788 sort.add(sortIDMenuItem);
1789 sort.add(sortLengthMenuItem);
1790 sort.add(sortGroupMenuItem);
1791 sort.add(sortPairwiseMenuItem);
1792 sort.add(sortByTreeMenu);
1793 calculateMenu.add(sort);
1794 calculateMenu.add(calculateTree);
1795 calculateMenu.addSeparator();
1796 calculateMenu.add(pairwiseAlignmentMenuItem);
1797 calculateMenu.addSeparator();
1798 calculateMenu.add(showTranslation);
1799 calculateMenu.add(showReverse);
1800 calculateMenu.add(showReverseComplement);
1801 calculateMenu.add(showProducts);
1802 calculateMenu.add(autoCalculate);
1803 calculateMenu.add(sortByTree);
1804 calculateMenu.addSeparator();
1805 calculateMenu.add(expandAlignment);
1806 calculateMenu.add(extractScores);
1807 calculateMenu.addSeparator();
1808 calculateMenu.add(runGroovy);
1810 webServiceNoServices = new JMenuItem(
1811 MessageManager.getString("label.no_services"));
1812 webService.add(webServiceNoServices);
1813 exportImageMenu.add(htmlMenuItem);
1814 exportImageMenu.add(epsFile);
1815 exportImageMenu.add(createPNG);
1816 exportImageMenu.add(createBioJS);
1817 exportImageMenu.add(createSVG);
1818 addSequenceMenu.add(addFromFile);
1819 addSequenceMenu.add(addFromText);
1820 addSequenceMenu.add(addFromURL);
1821 this.getContentPane().add(statusPanel, java.awt.BorderLayout.SOUTH);
1822 statusPanel.add(statusBar, null);
1823 this.getContentPane().add(tabbedPane, java.awt.BorderLayout.CENTER);
1825 formatMenu.add(font);
1826 formatMenu.addSeparator();
1827 formatMenu.add(wrapMenuItem);
1828 formatMenu.add(scaleAbove);
1829 formatMenu.add(scaleLeft);
1830 formatMenu.add(scaleRight);
1831 formatMenu.add(seqLimits);
1832 formatMenu.add(idRightAlign);
1833 formatMenu.add(hiddenMarkers);
1834 formatMenu.add(viewBoxesMenuItem);
1835 formatMenu.add(viewTextMenuItem);
1836 formatMenu.add(colourTextMenuItem);
1837 formatMenu.add(renderGapsMenuItem);
1838 formatMenu.add(centreColumnLabelsMenuItem);
1839 formatMenu.add(showNonconservedMenuItem);
1840 selectMenu.add(findMenuItem);
1841 selectMenu.addSeparator();
1842 selectMenu.add(selectAllSequenceMenuItem);
1843 selectMenu.add(deselectAllSequenceMenuItem);
1844 selectMenu.add(invertSequenceMenuItem);
1845 selectMenu.add(invertColSel);
1846 selectMenu.add(createGroup);
1847 selectMenu.add(unGroup);
1848 selectMenu.add(grpsFromSelection);
1849 selectMenu.add(deleteGroups);
1850 selectMenu.add(annotationColumn);
1851 selectMenu.add(selectHighlighted);
1852 // TODO - determine if the listenToViewSelections button is needed : see bug
1854 // selectMenu.addSeparator();
1855 // selectMenu.add(listenToViewSelections);
1859 * Constructs the entries on the Colour menu (but does not add them to the
1862 protected void initColourMenu()
1864 applyToAllGroups = new JCheckBoxMenuItem(
1865 MessageManager.getString("label.apply_colour_to_all_groups"));
1866 applyToAllGroups.addActionListener(new ActionListener()
1869 public void actionPerformed(ActionEvent e)
1871 applyToAllGroups_actionPerformed(applyToAllGroups.isSelected());
1875 textColour = new JMenuItem(
1876 MessageManager.getString("label.text_colour"));
1877 textColour.addActionListener(new ActionListener()
1880 public void actionPerformed(ActionEvent e)
1882 textColour_actionPerformed();
1886 conservationMenuItem = new JCheckBoxMenuItem(
1887 MessageManager.getString("action.by_conservation"));
1888 conservationMenuItem.addActionListener(new ActionListener()
1891 public void actionPerformed(ActionEvent e)
1893 conservationMenuItem_actionPerformed(
1894 conservationMenuItem.isSelected());
1898 abovePIDThreshold = new JCheckBoxMenuItem(
1899 MessageManager.getString("label.above_identity_threshold"));
1900 abovePIDThreshold.addActionListener(new ActionListener()
1903 public void actionPerformed(ActionEvent e)
1905 abovePIDThreshold_actionPerformed(abovePIDThreshold.isSelected());
1908 modifyPID = new JMenuItem(
1909 MessageManager.getString("label.modify_identity_threshold"));
1910 modifyPID.addActionListener(new ActionListener()
1913 public void actionPerformed(ActionEvent e)
1915 modifyPID_actionPerformed();
1918 modifyConservation = new JMenuItem(MessageManager
1919 .getString("label.modify_conservation_threshold"));
1920 modifyConservation.addActionListener(new ActionListener()
1923 public void actionPerformed(ActionEvent e)
1925 modifyConservation_actionPerformed();
1929 annotationColour = new JMenuItem(
1930 MessageManager.getString("action.by_annotation"));
1931 annotationColour.addActionListener(new ActionListener()
1934 public void actionPerformed(ActionEvent e)
1936 annotationColour_actionPerformed();
1941 protected void selectHighlightedColumns_actionPerformed(
1942 ActionEvent actionEvent)
1944 // TODO Auto-generated method stub
1949 * Generate the reverse sequence (or reverse complement if the flag is true)
1950 * and add it to the alignment
1954 protected void showReverse_actionPerformed(boolean complement)
1959 * Try to run script in a Groovy console, having first ensured that this
1960 * alignframe is set as currentAlignFrame in Desktop
1962 protected void runGroovy_actionPerformed()
1968 * Adds the given action listener and key accelerator to the given menu item.
1969 * Also saves in a lookup table to support lookup of action by key stroke.
1973 * @param actionListener
1975 protected void addMenuActionAndAccelerator(KeyStroke keyStroke,
1976 JMenuItem menuItem, ActionListener actionListener)
1978 menuItem.setAccelerator(keyStroke);
1979 accelerators.put(keyStroke, menuItem);
1980 menuItem.addActionListener(actionListener);
1984 * Action on clicking sort annotations by type.
1988 protected void sortAnnotations_actionPerformed()
1993 * Action on clicking Show all annotations.
1995 * @param forSequences
1996 * update sequence-related annotations
1997 * @param forAlignment
1998 * update non-sequence-related annotations
2000 protected void showAllAnnotations_actionPerformed(boolean forSequences,
2001 boolean forAlignment)
2003 setAnnotationsVisibility(true, forSequences, forAlignment);
2007 * Action on clicking Hide all annotations.
2009 * @param forSequences
2010 * update sequence-related annotations
2011 * @param forAlignment
2012 * update non-sequence-related annotations
2014 protected void hideAllAnnotations_actionPerformed(boolean forSequences,
2015 boolean forAlignment)
2017 setAnnotationsVisibility(false, forSequences, forAlignment);
2021 * Set the visibility of annotations to true or false. Can act on
2022 * sequence-related annotations, or alignment-related, or both.
2025 * @param forSequences
2026 * update sequence-related annotations
2027 * @param forAlignment
2028 * update non-sequence-related annotations
2030 protected void setAnnotationsVisibility(boolean visible,
2031 boolean forSequences, boolean forAlignment)
2036 protected void normaliseSequenceLogo_actionPerformed(ActionEvent e)
2038 // TODO Auto-generated method stub
2042 protected void listenToViewSelections_actionPerformed(ActionEvent e)
2044 // TODO Auto-generated method stub
2048 protected void showAllhidden_actionPerformed(ActionEvent e)
2050 // TODO Auto-generated method stub
2054 protected void hideAllButSelection_actionPerformed(ActionEvent e)
2056 // TODO Auto-generated method stub
2060 protected void hideAllSelection_actionPerformed(ActionEvent e)
2062 // TODO Auto-generated method stub
2066 protected void applyAutoAnnotationSettings_actionPerformed(ActionEvent e)
2068 // TODO Auto-generated method stub
2072 protected void showConsensusHistogram_actionPerformed(ActionEvent e)
2074 // TODO Auto-generated method stub
2078 protected void showSequenceLogo_actionPerformed(ActionEvent e)
2080 // TODO Auto-generated method stub
2084 protected void makeGrpsFromSelection_actionPerformed(ActionEvent e)
2086 // TODO Auto-generated method stub
2090 protected void showGroupConsensus_actionPerformed(ActionEvent e)
2092 // TODO Auto-generated method stub
2096 protected void showGroupConservation_actionPerformed(ActionEvent e)
2098 // TODO Auto-generated method stub
2102 protected void showUnconservedMenuItem_actionPerformed(ActionEvent e)
2104 // TODO Auto-generated method stub
2108 protected void justifyRightMenuItem_actionPerformed(ActionEvent e)
2110 // TODO Auto-generated method stub
2114 protected void justifyLeftMenuItem_actionPerformed(ActionEvent e)
2116 // TODO Auto-generated method stub
2120 protected void followHighlight_actionPerformed()
2122 // TODO Auto-generated method stub
2126 protected void showNpFeats_actionPerformed(ActionEvent e)
2128 // TODO Auto-generated method stub
2132 protected void showDbRefs_actionPerformed(ActionEvent e)
2134 // TODO Auto-generated method stub
2138 protected void centreColumnLabels_actionPerformed(ActionEvent e)
2142 protected void buildSortByAnnotationScoresMenu()
2146 protected void extractScores_actionPerformed(ActionEvent e)
2150 protected void outputText_actionPerformed(ActionEvent e)
2154 public void addFromFile_actionPerformed(ActionEvent e)
2159 public void addFromText_actionPerformed(ActionEvent e)
2164 public void addFromURL_actionPerformed(ActionEvent e)
2169 public void exportFeatures_actionPerformed(ActionEvent e)
2174 public void exportAnnotations_actionPerformed(ActionEvent e)
2179 protected void htmlMenuItem_actionPerformed(ActionEvent e)
2183 protected void bioJSMenuItem_actionPerformed(ActionEvent e)
2188 protected void closeMenuItem_actionPerformed(boolean b)
2192 protected void redoMenuItem_actionPerformed(ActionEvent e)
2196 protected void undoMenuItem_actionPerformed(ActionEvent e)
2200 protected void selectAllSequenceMenuItem_actionPerformed(ActionEvent e)
2204 protected void deselectAllSequenceMenuItem_actionPerformed(ActionEvent e)
2208 protected void invertSequenceMenuItem_actionPerformed(ActionEvent e)
2212 protected void remove2LeftMenuItem_actionPerformed(ActionEvent e)
2216 protected void remove2RightMenuItem_actionPerformed(ActionEvent e)
2220 protected void removeGappedColumnMenuItem_actionPerformed(ActionEvent e)
2224 protected void removeAllGapsMenuItem_actionPerformed(ActionEvent e)
2228 protected void wrapMenuItem_actionPerformed(ActionEvent e)
2232 protected void viewBoxesMenuItem_actionPerformed(ActionEvent e)
2236 protected void viewTextMenuItem_actionPerformed(ActionEvent e)
2240 protected void colourTextMenuItem_actionPerformed(ActionEvent e)
2244 protected void annotationPanelMenuItem_actionPerformed(ActionEvent e)
2248 protected void overviewMenuItem_actionPerformed(ActionEvent e)
2252 protected void sortPairwiseMenuItem_actionPerformed(ActionEvent e)
2256 protected void sortIDMenuItem_actionPerformed(ActionEvent e)
2260 protected void sortLengthMenuItem_actionPerformed(ActionEvent e)
2264 protected void sortGroupMenuItem_actionPerformed(ActionEvent e)
2268 protected void removeRedundancyMenuItem_actionPerformed(ActionEvent e)
2272 protected void pairwiseAlignmentMenuItem_actionPerformed(ActionEvent e)
2276 protected void neighbourTreeMenuItem_actionPerformed(ActionEvent e)
2280 protected void conservationMenuItem_actionPerformed(boolean selected)
2284 protected void printMenuItem_actionPerformed(ActionEvent e)
2288 protected void renderGapsMenuItem_actionPerformed(ActionEvent e)
2292 protected void findMenuItem_actionPerformed(ActionEvent e)
2296 protected void abovePIDThreshold_actionPerformed(boolean selected)
2300 public void showSeqFeatures_actionPerformed(ActionEvent actionEvent)
2304 protected void deleteGroups_actionPerformed(ActionEvent e)
2308 protected void createGroup_actionPerformed(ActionEvent e)
2312 protected void unGroup_actionPerformed(ActionEvent e)
2316 protected void copy_actionPerformed(ActionEvent e)
2320 protected void cut_actionPerformed(ActionEvent e)
2324 protected void delete_actionPerformed(ActionEvent e)
2328 protected void pasteNew_actionPerformed(ActionEvent e)
2332 protected void pasteThis_actionPerformed(ActionEvent e)
2336 protected void applyToAllGroups_actionPerformed(boolean selected)
2340 public void createPNG(java.io.File f)
2344 protected void font_actionPerformed(ActionEvent e)
2348 protected void seqLimit_actionPerformed(ActionEvent e)
2352 public void seqDBRef_actionPerformed(ActionEvent e)
2357 public void createEPS(java.io.File f)
2361 public void createSVG(java.io.File f)
2366 protected void loadTreeMenuItem_actionPerformed(ActionEvent e)
2372 * Template method to handle the 'load T-Coffee scores' menu event.
2374 * Subclasses override this method to provide a custom action.
2379 protected void loadScores_actionPerformed(ActionEvent event)
2384 protected void jpred_actionPerformed(ActionEvent e)
2388 protected void scaleAbove_actionPerformed(ActionEvent e)
2392 protected void scaleLeft_actionPerformed(ActionEvent e)
2396 protected void scaleRight_actionPerformed(ActionEvent e)
2400 protected void modifyPID_actionPerformed()
2404 protected void modifyConservation_actionPerformed()
2408 protected void saveAs_actionPerformed(ActionEvent e)
2412 protected void padGapsMenuitem_actionPerformed(ActionEvent e)
2416 public void vamsasStore_actionPerformed(ActionEvent e)
2421 public void vamsasLoad_actionPerformed(ActionEvent e)
2426 public void showTranslation_actionPerformed(ActionEvent e)
2431 public void featureSettings_actionPerformed(ActionEvent e)
2436 public void fetchSequence_actionPerformed(ActionEvent e)
2441 public void smoothFont_actionPerformed(ActionEvent e)
2446 public void annotationColour_actionPerformed()
2450 public void annotationColumn_actionPerformed(ActionEvent e)
2454 public void associatedData_actionPerformed(ActionEvent e)
2459 public void autoCalculate_actionPerformed(ActionEvent e)
2464 public void sortByTreeOption_actionPerformed(ActionEvent e)
2469 public void showAllSeqs_actionPerformed(ActionEvent e)
2474 public void showAllColumns_actionPerformed(ActionEvent e)
2479 public void hideSelSequences_actionPerformed(ActionEvent e)
2484 public void hideSelColumns_actionPerformed(ActionEvent e)
2489 public void hiddenMarkers_actionPerformed(ActionEvent e)
2494 public void findPdbId_actionPerformed(ActionEvent e)
2499 public void enterPdbId_actionPerformed(ActionEvent e)
2504 public void pdbFile_actionPerformed(ActionEvent e)
2509 public void invertColSel_actionPerformed(ActionEvent e)
2514 public void tabSelectionChanged(int sel)
2519 public void tabbedPane_mousePressed(MouseEvent e)
2524 public void tabbedPane_focusGained(FocusEvent e)
2529 public void save_actionPerformed(ActionEvent e)
2534 public void reload_actionPerformed(ActionEvent e)
2539 public void newView_actionPerformed(ActionEvent e)
2544 public void textColour_actionPerformed()
2549 public void idRightAlign_actionPerformed(ActionEvent e)
2554 public void expandViews_actionPerformed(ActionEvent e)
2559 public void gatherViews_actionPerformed(ActionEvent e)
2564 public void buildTreeSortMenu()
2569 public void pageSetup_actionPerformed(ActionEvent e)
2574 public void alignmentProperties()
2579 protected void expand_newalign(ActionEvent e)
2581 // TODO Auto-generated method stub
2585 protected boolean isShowAutoCalculatedAbove()
2587 return showAutoCalculatedAbove;
2590 protected void setShowAutoCalculatedAbove(boolean showAutoCalculatedAbove)
2592 this.showAutoCalculatedAbove = showAutoCalculatedAbove;
2595 protected SequenceAnnotationOrder getAnnotationSortOrder()
2597 return annotationSortOrder;
2600 protected void setAnnotationSortOrder(
2601 SequenceAnnotationOrder annotationSortOrder)
2603 this.annotationSortOrder = annotationSortOrder;
2606 public Map<KeyStroke, JMenuItem> getAccelerators()
2608 return this.accelerators;
2612 * Returns the selected index of the tabbed pane, or -1 if none selected
2613 * (including the case where the tabbed pane has not been made visible).
2617 public int getTabIndex()
2619 return tabbedPane.getSelectedIndex();
2622 public JPanel getStatusPanel()
2628 * Sets a reference to the containing split frame. Also makes the 'toggle
2629 * split view' menu item visible and checked.
2633 public void setSplitFrame(SplitContainerI sf)
2635 this.splitFrame = sf;
2638 this.showComplementMenuItem.setVisible(true);
2639 this.showComplementMenuItem.setState(true);
2643 public SplitContainerI getSplitViewContainer()
2645 return this.splitFrame;
2648 protected void showComplement_actionPerformed(boolean complement)