X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fjbgui%2FGAlignFrame.java;h=4fb5a44a2dec66993b1d833e06a14bf2ad30f214;hb=7047b076a62df177047ceb16c3611efe020bdd76;hp=8d180642bb25ad3975bab62463c7d8e8bc97af2b;hpb=4d7f98a6dd54d9863ba449ec79dcd95d25ed863d;p=jalview.git diff --git a/src/jalview/jbgui/GAlignFrame.java b/src/jalview/jbgui/GAlignFrame.java index 8d18064..4fb5a44 100755 --- a/src/jalview/jbgui/GAlignFrame.java +++ b/src/jalview/jbgui/GAlignFrame.java @@ -23,10 +23,12 @@ package jalview.jbgui; import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder; import jalview.api.SplitContainerI; import jalview.bin.Cache; +import jalview.bin.Jalview; import jalview.gui.JvSwingUtils; import jalview.gui.Preferences; -import jalview.schemes.ColourSchemeProperty; +import jalview.io.FileFormats; import jalview.util.MessageManager; +import jalview.util.Platform; import java.awt.BorderLayout; import java.awt.Color; @@ -50,12 +52,10 @@ import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; -import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JRadioButtonMenuItem; import javax.swing.JTabbedPane; import javax.swing.KeyStroke; -import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; import javax.swing.event.MenuEvent; import javax.swing.event.MenuListener; @@ -66,15 +66,13 @@ public class GAlignFrame extends JInternalFrame protected JMenuItem closeMenuItem = new JMenuItem(); - protected JMenu colourMenu = new JMenu(); - protected JMenu webService = new JMenu(); protected JMenuItem webServiceNoServices; - public JCheckBoxMenuItem viewBoxesMenuItem = new JCheckBoxMenuItem(); + protected JCheckBoxMenuItem viewBoxesMenuItem = new JCheckBoxMenuItem(); - public JCheckBoxMenuItem viewTextMenuItem = new JCheckBoxMenuItem(); + protected JCheckBoxMenuItem viewTextMenuItem = new JCheckBoxMenuItem(); protected JMenu sortByAnnotScore = new JMenu(); @@ -82,86 +80,57 @@ public class GAlignFrame extends JInternalFrame protected JMenu outputTextboxMenu = new JMenu(); - protected JRadioButtonMenuItem clustalColour = new JRadioButtonMenuItem(); - - protected JRadioButtonMenuItem zappoColour = new JRadioButtonMenuItem(); - - protected JRadioButtonMenuItem taylorColour = new JRadioButtonMenuItem(); - - protected JRadioButtonMenuItem hydrophobicityColour = new JRadioButtonMenuItem(); - - protected JRadioButtonMenuItem helixColour = new JRadioButtonMenuItem(); - - protected JRadioButtonMenuItem strandColour = new JRadioButtonMenuItem(); - - protected JRadioButtonMenuItem turnColour = new JRadioButtonMenuItem(); - - protected JRadioButtonMenuItem buriedColour = new JRadioButtonMenuItem(); - - protected JRadioButtonMenuItem userDefinedColour = new JRadioButtonMenuItem(); + protected JCheckBoxMenuItem annotationPanelMenuItem = new JCheckBoxMenuItem(); - protected JRadioButtonMenuItem PIDColour = new JRadioButtonMenuItem(); + protected JCheckBoxMenuItem colourTextMenuItem = new JCheckBoxMenuItem(); - protected JRadioButtonMenuItem BLOSUM62Colour = new JRadioButtonMenuItem(); - - protected JRadioButtonMenuItem nucleotideColour = new JRadioButtonMenuItem(); - - protected JRadioButtonMenuItem purinePyrimidineColour = new JRadioButtonMenuItem(); - - protected JRadioButtonMenuItem RNAInteractionColour = new JRadioButtonMenuItem(); - - // protected JRadioButtonMenuItem covariationColour = new - // JRadioButtonMenuItem(); - - protected JRadioButtonMenuItem tcoffeeColour = new JRadioButtonMenuItem(); - - public JCheckBoxMenuItem annotationPanelMenuItem = new JCheckBoxMenuItem(); - - public JCheckBoxMenuItem colourTextMenuItem = new JCheckBoxMenuItem(); - - public JCheckBoxMenuItem showNonconservedMenuItem = new JCheckBoxMenuItem(); + protected JCheckBoxMenuItem showNonconservedMenuItem = new JCheckBoxMenuItem(); protected JMenuItem undoMenuItem = new JMenuItem(); protected JMenuItem redoMenuItem = new JMenuItem(); - public JCheckBoxMenuItem conservationMenuItem = new JCheckBoxMenuItem(); - - JRadioButtonMenuItem noColourmenuItem = new JRadioButtonMenuItem(); + protected JCheckBoxMenuItem wrapMenuItem = new JCheckBoxMenuItem(); - public JCheckBoxMenuItem wrapMenuItem = new JCheckBoxMenuItem(); - - public JCheckBoxMenuItem renderGapsMenuItem = new JCheckBoxMenuItem(); - - public JCheckBoxMenuItem abovePIDThreshold = new JCheckBoxMenuItem(); + protected JCheckBoxMenuItem renderGapsMenuItem = new JCheckBoxMenuItem(); public JCheckBoxMenuItem showSeqFeatures = new JCheckBoxMenuItem(); - public JCheckBoxMenuItem showSeqFeaturesHeight = new JCheckBoxMenuItem(); - JMenuItem copy = new JMenuItem(); JMenuItem cut = new JMenuItem(); JMenu pasteMenu = new JMenu(); - public JCheckBoxMenuItem applyToAllGroups = new JCheckBoxMenuItem(); + protected JCheckBoxMenuItem seqLimits = new JCheckBoxMenuItem(); + + protected JCheckBoxMenuItem scaleAbove = new JCheckBoxMenuItem(); + + protected JCheckBoxMenuItem scaleLeft = new JCheckBoxMenuItem(); + + protected JCheckBoxMenuItem scaleRight = new JCheckBoxMenuItem(); + + protected JCheckBoxMenuItem applyToAllGroups; + + protected JMenu colourMenu = new JMenu(); + + protected JMenuItem textColour; - public JCheckBoxMenuItem seqLimits = new JCheckBoxMenuItem(); + protected JCheckBoxMenuItem conservationMenuItem; - public JCheckBoxMenuItem scaleAbove = new JCheckBoxMenuItem(); + protected JMenuItem modifyConservation; - public JCheckBoxMenuItem scaleLeft = new JCheckBoxMenuItem(); + protected JCheckBoxMenuItem abovePIDThreshold; - public JCheckBoxMenuItem scaleRight = new JCheckBoxMenuItem(); + protected JMenuItem modifyPID; - protected JMenuItem modifyConservation = new JMenuItem(); + protected JMenuItem annotationColour; protected JMenu sortByTreeMenu = new JMenu(); protected JMenu sort = new JMenu(); - protected JMenu calculateTree = new JMenu(); + protected JMenuItem calculateTree = new JMenuItem(); protected JCheckBoxMenuItem padGapsMenuitem = new JCheckBoxMenuItem(); @@ -169,13 +138,17 @@ public class GAlignFrame extends JInternalFrame protected JCheckBoxMenuItem showDbRefsMenuitem = new JCheckBoxMenuItem(); - protected ButtonGroup colours = new ButtonGroup(); - protected JMenuItem showTranslation = new JMenuItem(); + protected JMenuItem showReverse = new JMenuItem(); + + protected JMenuItem showReverseComplement = new JMenuItem(); + protected JMenu showProducts = new JMenu(); - protected JMenuItem rnahelicesColour = new JMenuItem(); + protected JMenuItem runGroovy = new JMenuItem(); + + protected JMenuItem loadVcf; protected JCheckBoxMenuItem autoCalculate = new JCheckBoxMenuItem(); @@ -197,7 +170,7 @@ public class GAlignFrame extends JInternalFrame protected JCheckBoxMenuItem hiddenMarkers = new JCheckBoxMenuItem(); - protected JTabbedPane tabbedPane = new JTabbedPane(); + protected JTabbedPane tabbedPane = jalview.jbgui.GDesktop.createTabbedPane(); protected JMenuItem reload = new JMenuItem(); @@ -224,6 +197,8 @@ public class GAlignFrame extends JInternalFrame protected JCheckBoxMenuItem normaliseSequenceLogo = new JCheckBoxMenuItem(); protected JCheckBoxMenuItem applyAutoAnnotationSettings = new JCheckBoxMenuItem(); + + protected JMenuItem openFeatureSettings; private SequenceAnnotationOrder annotationSortOrder; @@ -241,17 +216,16 @@ public class GAlignFrame extends JInternalFrame setJMenuBar(alignFrameMenuBar); // dynamically fill save as menu with available formats - for (int i = 0; i < jalview.io.FormatAdapter.WRITEABLE_FORMATS.length; i++) + for (String ff : FileFormats.getInstance().getWritableFormats(true)) { - JMenuItem item = new JMenuItem( - jalview.io.FormatAdapter.WRITEABLE_FORMATS[i]); + JMenuItem item = new JMenuItem(ff); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - outputText_actionPerformed(e); + outputText_actionPerformed(e.getActionCommand()); } }); @@ -262,7 +236,7 @@ public class GAlignFrame extends JInternalFrame System.err.println(e.toString()); } - if (!jalview.util.Platform.isAMac()) + if (!Platform.isAMac()) { closeMenuItem.setMnemonic('C'); outputTextboxMenu.setMnemonic('T'); @@ -273,186 +247,12 @@ public class GAlignFrame extends JInternalFrame pasteMenu.setMnemonic('P'); reload.setMnemonic('R'); } - - if (jalview.gui.UserDefinedColours.getUserColourSchemes() != null) - { - java.util.Enumeration userColours = jalview.gui.UserDefinedColours - .getUserColourSchemes().keys(); - - while (userColours.hasMoreElements()) - { - final JRadioButtonMenuItem radioItem = new JRadioButtonMenuItem( - userColours.nextElement().toString()); - radioItem.setName("USER_DEFINED"); - radioItem.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent evt) - { - if (evt.isControlDown() - || SwingUtilities.isRightMouseButton(evt)) - { - radioItem.removeActionListener(radioItem.getActionListeners()[0]); - - int option = JOptionPane.showInternalConfirmDialog( - jalview.gui.Desktop.desktop, - MessageManager - .getString("label.remove_from_default_list"), - MessageManager - .getString("label.remove_user_defined_colour"), - JOptionPane.YES_NO_OPTION); - if (option == JOptionPane.YES_OPTION) - { - jalview.gui.UserDefinedColours - .removeColourFromDefaults(radioItem.getText()); - colourMenu.remove(radioItem); - } - else - { - radioItem.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent evt) - { - userDefinedColour_actionPerformed(evt); - } - }); - } - } - } - }); - radioItem.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent evt) - { - userDefinedColour_actionPerformed(evt); - } - }); - colourMenu.insert(radioItem, 15); - colours.add(radioItem); - } - } - colours.add(noColourmenuItem); - colours.add(clustalColour); - colours.add(zappoColour); - colours.add(taylorColour); - colours.add(hydrophobicityColour); - colours.add(helixColour); - colours.add(strandColour); - colours.add(turnColour); - colours.add(buriedColour); - colours.add(userDefinedColour); - colours.add(PIDColour); - colours.add(BLOSUM62Colour); - colours.add(nucleotideColour); - colours.add(purinePyrimidineColour); - // colours.add(covariationColour); - colours.add(tcoffeeColour); - colours.add(RNAInteractionColour); - setColourSelected(jalview.bin.Cache.getDefault( - Preferences.DEFAULT_COLOUR, "None")); - } - - public void setColourSelected(String defaultColour) - { - - if (defaultColour != null) - { - int index = ColourSchemeProperty - .getColourIndexFromName(defaultColour); - - switch (index) - { - case ColourSchemeProperty.CLUSTAL: - clustalColour.setSelected(true); - - break; - - case ColourSchemeProperty.BLOSUM: - BLOSUM62Colour.setSelected(true); - - break; - - case ColourSchemeProperty.PID: - PIDColour.setSelected(true); - - break; - - case ColourSchemeProperty.ZAPPO: - zappoColour.setSelected(true); - - break; - - case ColourSchemeProperty.TAYLOR: - taylorColour.setSelected(true); - break; - - case ColourSchemeProperty.HYDROPHOBIC: - hydrophobicityColour.setSelected(true); - - break; - - case ColourSchemeProperty.HELIX: - helixColour.setSelected(true); - - break; - - case ColourSchemeProperty.STRAND: - strandColour.setSelected(true); - - break; - - case ColourSchemeProperty.TURN: - turnColour.setSelected(true); - - break; - - case ColourSchemeProperty.BURIED: - buriedColour.setSelected(true); - - break; - - case ColourSchemeProperty.NUCLEOTIDE: - nucleotideColour.setSelected(true); - - break; - - case ColourSchemeProperty.TCOFFEE: - tcoffeeColour.setSelected(true); - break; - - case ColourSchemeProperty.PURINEPYRIMIDINE: - purinePyrimidineColour.setSelected(true); - - break; - - case ColourSchemeProperty.RNAINTERACTION: - RNAInteractionColour.setSelected(true); - - break; - /* - * case ColourSchemeProperty.COVARIATION: - * covariationColour.setSelected(true); - * - * break; - */ - case ColourSchemeProperty.USER_DEFINED: - userDefinedColour.setSelected(true); - - break; - case ColourSchemeProperty.NONE: - default: - noColourmenuItem.setSelected(true); - break; - - } - } - } private void jbInit() throws Exception { + initColourMenu(); + JMenuItem saveAs = new JMenuItem( MessageManager.getString("action.save_as")); ActionListener al = new ActionListener() @@ -460,17 +260,20 @@ public class GAlignFrame extends JInternalFrame @Override public void actionPerformed(ActionEvent e) { - saveAs_actionPerformed(e); + saveAs_actionPerformed(); } }; - KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_S, Toolkit - .getDefaultToolkit().getMenuShortcutKeyMask() - | KeyEvent.SHIFT_MASK, false); + + // FIXME getDefaultToolkit throws an exception in Headless mode + KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_S, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() + | KeyEvent.SHIFT_MASK, + false); addMenuActionAndAccelerator(keyStroke, saveAs, al); closeMenuItem.setText(MessageManager.getString("action.close")); - keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_W, Toolkit - .getDefaultToolkit().getMenuShortcutKeyMask(), false); + keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_W, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); al = new ActionListener() { @Override @@ -492,8 +295,8 @@ public class GAlignFrame extends JInternalFrame webService.setText(MessageManager.getString("action.web_service")); JMenuItem selectAllSequenceMenuItem = new JMenuItem( MessageManager.getString("action.select_all")); - keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_A, Toolkit - .getDefaultToolkit().getMenuShortcutKeyMask(), false); + keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_A, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); al = new ActionListener() { @Override @@ -519,8 +322,8 @@ public class GAlignFrame extends JInternalFrame JMenuItem invertSequenceMenuItem = new JMenuItem( MessageManager.getString("action.invert_sequence_selection")); - keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_I, Toolkit - .getDefaultToolkit().getMenuShortcutKeyMask(), false); + keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_I, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); al = new ActionListener() { @Override @@ -543,8 +346,8 @@ public class GAlignFrame extends JInternalFrame }); JMenuItem expandAlignment = new JMenuItem( MessageManager.getString("action.view_flanking_regions")); - expandAlignment.setToolTipText(MessageManager - .getString("label.view_flanking_regions")); + expandAlignment.setToolTipText( + MessageManager.getString("label.view_flanking_regions")); expandAlignment.addActionListener(new ActionListener() { @Override @@ -555,8 +358,8 @@ public class GAlignFrame extends JInternalFrame }); JMenuItem remove2LeftMenuItem = new JMenuItem( MessageManager.getString("action.remove_left")); - keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_L, Toolkit - .getDefaultToolkit().getMenuShortcutKeyMask(), false); + keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_L, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); al = new ActionListener() { @Override @@ -569,8 +372,8 @@ public class GAlignFrame extends JInternalFrame JMenuItem remove2RightMenuItem = new JMenuItem( MessageManager.getString("action.remove_right")); - keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_R, Toolkit - .getDefaultToolkit().getMenuShortcutKeyMask(), false); + keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_R, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); al = new ActionListener() { @Override @@ -583,8 +386,8 @@ public class GAlignFrame extends JInternalFrame JMenuItem removeGappedColumnMenuItem = new JMenuItem( MessageManager.getString("action.remove_empty_columns")); - keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_E, Toolkit - .getDefaultToolkit().getMenuShortcutKeyMask(), false); + keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_E, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); al = new ActionListener() { @Override @@ -597,9 +400,10 @@ public class GAlignFrame extends JInternalFrame JMenuItem removeAllGapsMenuItem = new JMenuItem( MessageManager.getString("action.remove_all_gaps")); - keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_E, Toolkit - .getDefaultToolkit().getMenuShortcutKeyMask() - | KeyEvent.SHIFT_MASK, false); + keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_E, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() + | KeyEvent.SHIFT_MASK, + false); al = new ActionListener() { @Override @@ -650,8 +454,8 @@ public class GAlignFrame extends JInternalFrame viewTextMenuItem_actionPerformed(e); } }); - showNonconservedMenuItem.setText(MessageManager - .getString("label.show_non_conversed")); + showNonconservedMenuItem + .setText(MessageManager.getString("label.show_non_conserved")); showNonconservedMenuItem.setState(false); showNonconservedMenuItem.addActionListener(new ActionListener() { @@ -704,8 +508,8 @@ public class GAlignFrame extends JInternalFrame JMenuItem removeRedundancyMenuItem = new JMenuItem( MessageManager.getString("action.remove_redundancy")); - keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_D, Toolkit - .getDefaultToolkit().getMenuShortcutKeyMask(), false); + keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_D, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); al = new ActionListener() { @Override @@ -726,36 +530,6 @@ public class GAlignFrame extends JInternalFrame pairwiseAlignmentMenuItem_actionPerformed(e); } }); - JMenuItem PCAMenuItem = new JMenuItem( - MessageManager.getString("label.principal_component_analysis")); - PCAMenuItem.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - PCAMenuItem_actionPerformed(e); - } - }); - JMenuItem averageDistanceTreeMenuItem = new JMenuItem( - MessageManager.getString("label.average_distance_identity")); - averageDistanceTreeMenuItem.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - averageDistanceTreeMenuItem_actionPerformed(e); - } - }); - JMenuItem neighbourTreeMenuItem = new JMenuItem( - MessageManager.getString("label.neighbour_joining_identity")); - neighbourTreeMenuItem.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - neighbourTreeMenuItem_actionPerformed(e); - } - }); this.getContentPane().setLayout(new BorderLayout()); alignFrameMenuBar.setFont(new java.awt.Font("Verdana", 0, 11)); @@ -763,174 +537,14 @@ public class GAlignFrame extends JInternalFrame statusBar.setFont(new java.awt.Font("Verdana", 0, 11)); statusBar.setBorder(BorderFactory.createLineBorder(Color.black)); statusBar.setText(MessageManager.getString("label.status_bar")); - outputTextboxMenu.setText(MessageManager - .getString("label.out_to_textbox")); - clustalColour.setText(MessageManager.getString("label.clustalx")); - clustalColour.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - clustalColour_actionPerformed(e); - } - }); - zappoColour.setText(MessageManager.getString("label.zappo")); - zappoColour.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - zappoColour_actionPerformed(e); - } - }); - taylorColour.setText(MessageManager.getString("label.taylor")); - taylorColour.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - taylorColour_actionPerformed(e); - } - }); - hydrophobicityColour.setText(MessageManager - .getString("label.hydrophobicity")); - hydrophobicityColour.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - hydrophobicityColour_actionPerformed(e); - } - }); - helixColour.setText(MessageManager.getString("label.helix_propensity")); - helixColour.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - helixColour_actionPerformed(e); - } - }); - strandColour.setText(MessageManager - .getString("label.strand_propensity")); - strandColour.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - strandColour_actionPerformed(e); - } - }); - turnColour.setText(MessageManager.getString("label.turn_propensity")); - turnColour.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - turnColour_actionPerformed(e); - } - }); - buriedColour.setText(MessageManager.getString("label.buried_index")); - buriedColour.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - buriedColour_actionPerformed(e); - } - }); - userDefinedColour.setText(MessageManager - .getString("action.user_defined")); - userDefinedColour.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - userDefinedColour_actionPerformed(e); - } - }); - PIDColour - .setText(MessageManager.getString("label.percentage_identity")); - PIDColour.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - PIDColour_actionPerformed(e); - } - }); - BLOSUM62Colour - .setText(MessageManager.getString("label.blosum62_score")); - BLOSUM62Colour.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - BLOSUM62Colour_actionPerformed(e); - } - }); - nucleotideColour.setText(MessageManager.getString("label.nucleotide")); - nucleotideColour.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - nucleotideColour_actionPerformed(e); - } - }); + outputTextboxMenu + .setText(MessageManager.getString("label.out_to_textbox")); - purinePyrimidineColour.setText(MessageManager - .getString("label.purine_pyrimidine")); - purinePyrimidineColour.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - purinePyrimidineColour_actionPerformed(e); - } - }); - - RNAInteractionColour.setText("RNA Interaction type"); - RNAInteractionColour.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - RNAInteractionColour_actionPerformed(e); - } - }); - /* - * covariationColour.setText("Covariation"); - * covariationColour.addActionListener(new ActionListener() { public void - * actionPerformed(ActionEvent e) { covariationColour_actionPerformed(e); } - * }); - */ - - JMenuItem avDistanceTreeBlosumMenuItem = new JMenuItem( - MessageManager.getString("label.average_distance_bloslum62")); - avDistanceTreeBlosumMenuItem.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - avTreeBlosumMenuItem_actionPerformed(e); - } - }); - JMenuItem njTreeBlosumMenuItem = new JMenuItem( - MessageManager.getString("label.neighbour_blosum62")); - njTreeBlosumMenuItem.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - njTreeBlosumMenuItem_actionPerformed(e); - } - }); annotationPanelMenuItem.setActionCommand(""); - annotationPanelMenuItem.setText(MessageManager - .getString("label.show_annotations")); - annotationPanelMenuItem.setState(Cache.getDefault("SHOW_ANNOTATIONS", - true)); + annotationPanelMenuItem + .setText(MessageManager.getString("label.show_annotations")); + annotationPanelMenuItem + .setState(Cache.getDefault("SHOW_ANNOTATIONS", true)); annotationPanelMenuItem.addActionListener(new ActionListener() { @Override @@ -939,8 +553,8 @@ public class GAlignFrame extends JInternalFrame annotationPanelMenuItem_actionPerformed(e); } }); - showAllAlAnnotations.setText(MessageManager - .getString("label.show_all_al_annotations")); + showAllAlAnnotations.setText( + MessageManager.getString("label.show_all_al_annotations")); final boolean isAnnotationPanelShown = annotationPanelMenuItem .getState(); showAllAlAnnotations.setEnabled(isAnnotationPanelShown); @@ -952,8 +566,8 @@ public class GAlignFrame extends JInternalFrame showAllAnnotations_actionPerformed(false, true); } }); - hideAllAlAnnotations.setText(MessageManager - .getString("label.hide_all_al_annotations")); + hideAllAlAnnotations.setText( + MessageManager.getString("label.hide_all_al_annotations")); hideAllAlAnnotations.setEnabled(isAnnotationPanelShown); hideAllAlAnnotations.addActionListener(new ActionListener() { @@ -963,8 +577,8 @@ public class GAlignFrame extends JInternalFrame hideAllAnnotations_actionPerformed(false, true); } }); - showAllSeqAnnotations.setText(MessageManager - .getString("label.show_all_seq_annotations")); + showAllSeqAnnotations.setText( + MessageManager.getString("label.show_all_seq_annotations")); showAllSeqAnnotations.setEnabled(isAnnotationPanelShown); showAllSeqAnnotations.addActionListener(new ActionListener() { @@ -974,8 +588,8 @@ public class GAlignFrame extends JInternalFrame showAllAnnotations_actionPerformed(true, false); } }); - hideAllSeqAnnotations.setText(MessageManager - .getString("label.hide_all_seq_annotations")); + hideAllSeqAnnotations.setText( + MessageManager.getString("label.hide_all_seq_annotations")); hideAllSeqAnnotations.setEnabled(isAnnotationPanelShown); hideAllSeqAnnotations.addActionListener(new ActionListener() { @@ -993,8 +607,8 @@ public class GAlignFrame extends JInternalFrame final JCheckBoxMenuItem sortAnnByLabel = new JCheckBoxMenuItem( MessageManager.getString("label.sort_annotations_by_label")); - sortAnnBySequence - .setSelected(sortAnnotationsBy == SequenceAnnotationOrder.SEQUENCE_AND_LABEL); + sortAnnBySequence.setSelected( + sortAnnotationsBy == SequenceAnnotationOrder.SEQUENCE_AND_LABEL); sortAnnBySequence.addActionListener(new ActionListener() { @Override @@ -1002,13 +616,14 @@ public class GAlignFrame extends JInternalFrame { boolean newState = sortAnnBySequence.getState(); sortAnnByLabel.setSelected(false); - setAnnotationSortOrder(newState ? SequenceAnnotationOrder.SEQUENCE_AND_LABEL - : SequenceAnnotationOrder.NONE); + setAnnotationSortOrder( + newState ? SequenceAnnotationOrder.SEQUENCE_AND_LABEL + : SequenceAnnotationOrder.NONE); sortAnnotations_actionPerformed(); } }); - sortAnnByLabel - .setSelected(sortAnnotationsBy == SequenceAnnotationOrder.LABEL_AND_SEQUENCE); + sortAnnByLabel.setSelected( + sortAnnotationsBy == SequenceAnnotationOrder.LABEL_AND_SEQUENCE); sortAnnByLabel.addActionListener(new ActionListener() { @Override @@ -1016,13 +631,14 @@ public class GAlignFrame extends JInternalFrame { boolean newState = sortAnnByLabel.getState(); sortAnnBySequence.setSelected(false); - setAnnotationSortOrder(newState ? SequenceAnnotationOrder.LABEL_AND_SEQUENCE - : SequenceAnnotationOrder.NONE); + setAnnotationSortOrder( + newState ? SequenceAnnotationOrder.LABEL_AND_SEQUENCE + : SequenceAnnotationOrder.NONE); sortAnnotations_actionPerformed(); } }); - colourTextMenuItem.setText(MessageManager - .getString("label.colour_text")); + colourTextMenuItem = new JCheckBoxMenuItem( + MessageManager.getString("label.colour_text")); colourTextMenuItem.addActionListener(new ActionListener() { @Override @@ -1067,8 +683,8 @@ public class GAlignFrame extends JInternalFrame undoMenuItem.setEnabled(false); undoMenuItem.setText(MessageManager.getString("action.undo")); - keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_Z, Toolkit - .getDefaultToolkit().getMenuShortcutKeyMask(), false); + keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_Z, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); al = new ActionListener() { @Override @@ -1081,8 +697,8 @@ public class GAlignFrame extends JInternalFrame redoMenuItem.setEnabled(false); redoMenuItem.setText(MessageManager.getString("action.redo")); - keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_Y, Toolkit - .getDefaultToolkit().getMenuShortcutKeyMask(), false); + keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_Y, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); al = new ActionListener() { @Override @@ -1093,25 +709,6 @@ public class GAlignFrame extends JInternalFrame }; addMenuActionAndAccelerator(keyStroke, redoMenuItem, al); - conservationMenuItem.setText(MessageManager - .getString("action.by_conservation")); - conservationMenuItem.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - conservationMenuItem_actionPerformed(e); - } - }); - noColourmenuItem.setText(MessageManager.getString("label.none")); - noColourmenuItem.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - noColourmenuItem_actionPerformed(e); - } - }); wrapMenuItem.setText(MessageManager.getString("label.wrap")); wrapMenuItem.addActionListener(new ActionListener() { @@ -1124,8 +721,8 @@ public class GAlignFrame extends JInternalFrame JMenuItem printMenuItem = new JMenuItem( MessageManager.getString("action.print")); - keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_P, Toolkit - .getDefaultToolkit().getMenuShortcutKeyMask(), false); + keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_P, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); al = new ActionListener() { @Override @@ -1150,8 +747,8 @@ public class GAlignFrame extends JInternalFrame JMenuItem findMenuItem = new JMenuItem( MessageManager.getString("action.find")); - keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_F, Toolkit - .getDefaultToolkit().getMenuShortcutKeyMask(), false); + keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_F, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); findMenuItem.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager.getString("label.find_tip"))); al = new ActionListener() @@ -1164,18 +761,8 @@ public class GAlignFrame extends JInternalFrame }; addMenuActionAndAccelerator(keyStroke, findMenuItem, al); - abovePIDThreshold.setText(MessageManager - .getString("label.above_identity_threshold")); - abovePIDThreshold.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - abovePIDThreshold_actionPerformed(e); - } - }); - showSeqFeatures.setText(MessageManager - .getString("label.show_sequence_features")); + showSeqFeatures.setText( + MessageManager.getString("label.show_sequence_features")); showSeqFeatures.addActionListener(new ActionListener() { @Override @@ -1190,8 +777,8 @@ public class GAlignFrame extends JInternalFrame * void actionPerformed(ActionEvent actionEvent) { * showSeqFeaturesHeight_actionPerformed(actionEvent); } }); */ - showDbRefsMenuitem.setText(MessageManager - .getString("label.show_database_refs")); + showDbRefsMenuitem + .setText(MessageManager.getString("label.show_database_refs")); showDbRefsMenuitem.addActionListener(new ActionListener() { @@ -1202,8 +789,8 @@ public class GAlignFrame extends JInternalFrame } }); - showNpFeatsMenuitem.setText(MessageManager - .getString("label.show_non_positional_features")); + showNpFeatsMenuitem.setText( + MessageManager.getString("label.show_non_positional_features")); showNpFeatsMenuitem.addActionListener(new ActionListener() { @@ -1214,8 +801,8 @@ public class GAlignFrame extends JInternalFrame } }); - showGroupConservation.setText(MessageManager - .getString("label.group_conservation")); + showGroupConservation + .setText(MessageManager.getString("label.group_conservation")); showGroupConservation.addActionListener(new ActionListener() { @@ -1227,8 +814,8 @@ public class GAlignFrame extends JInternalFrame }); - showGroupConsensus.setText(MessageManager - .getString("label.group_consensus")); + showGroupConsensus + .setText(MessageManager.getString("label.group_consensus")); showGroupConsensus.addActionListener(new ActionListener() { @@ -1239,8 +826,8 @@ public class GAlignFrame extends JInternalFrame } }); - showConsensusHistogram.setText(MessageManager - .getString("label.show_consensus_histogram")); + showConsensusHistogram.setText( + MessageManager.getString("label.show_consensus_histogram")); showConsensusHistogram.addActionListener(new ActionListener() { @@ -1251,8 +838,8 @@ public class GAlignFrame extends JInternalFrame } }); - showSequenceLogo.setText(MessageManager - .getString("label.show_consensus_logo")); + showSequenceLogo + .setText(MessageManager.getString("label.show_consensus_logo")); showSequenceLogo.addActionListener(new ActionListener() { @@ -1263,8 +850,8 @@ public class GAlignFrame extends JInternalFrame } }); - normaliseSequenceLogo.setText(MessageManager - .getString("label.norm_consensus_logo")); + normaliseSequenceLogo + .setText(MessageManager.getString("label.norm_consensus_logo")); normaliseSequenceLogo.addActionListener(new ActionListener() { @@ -1275,8 +862,8 @@ public class GAlignFrame extends JInternalFrame } }); - applyAutoAnnotationSettings.setText(MessageManager - .getString("label.apply_all_groups")); + applyAutoAnnotationSettings + .setText(MessageManager.getString("label.apply_all_groups")); applyAutoAnnotationSettings.setState(false); applyAutoAnnotationSettings.setVisible(true); applyAutoAnnotationSettings.addActionListener(new ActionListener() @@ -1295,8 +882,10 @@ public class GAlignFrame extends JInternalFrame MessageManager.getString("label.show_last")); buttonGroup.add(showAutoFirst); buttonGroup.add(showAutoLast); - showAutoFirst.setSelected(Cache.getDefault( - Preferences.SHOW_AUTOCALC_ABOVE, false)); + final boolean autoFirst = Cache + .getDefault(Preferences.SHOW_AUTOCALC_ABOVE, false); + showAutoFirst.setSelected(autoFirst); + setShowAutoCalculatedAbove(autoFirst); showAutoFirst.addActionListener(new ActionListener() { @Override @@ -1317,46 +906,35 @@ public class GAlignFrame extends JInternalFrame } }); - nucleotideColour.setText(MessageManager.getString("label.nucleotide")); - nucleotideColour.addActionListener(new ActionListener() + JMenuItem deleteGroups = new JMenuItem( + MessageManager.getString("action.undefine_groups")); + keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_U, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); + al = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - nucleotideColour_actionPerformed(e); + deleteGroups_actionPerformed(e); } - }); + }; + addMenuActionAndAccelerator(keyStroke, deleteGroups, al); - tcoffeeColour.setText(MessageManager.getString("label.tcoffee_scores")); - tcoffeeColour.setEnabled(false); - tcoffeeColour.addActionListener(new ActionListener() + JMenuItem annotationColumn = new JMenuItem( + MessageManager.getString("action.select_by_annotation")); + annotationColumn.addActionListener(new ActionListener() { - @Override public void actionPerformed(ActionEvent e) { - tcoffeeColorScheme_actionPerformed(e); + annotationColumn_actionPerformed(e); } }); - JMenuItem deleteGroups = new JMenuItem( - MessageManager.getString("action.undefine_groups")); - keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_U, Toolkit - .getDefaultToolkit().getMenuShortcutKeyMask(), false); - al = new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - deleteGroups_actionPerformed(e); - } - }; - addMenuActionAndAccelerator(keyStroke, deleteGroups, al); - JMenuItem createGroup = new JMenuItem( - MessageManager.getString("action.create_groups")); - keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G, Toolkit - .getDefaultToolkit().getMenuShortcutKeyMask(), false); + MessageManager.getString("action.create_group")); + keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); al = new ActionListener() { @Override @@ -1369,9 +947,10 @@ public class GAlignFrame extends JInternalFrame JMenuItem unGroup = new JMenuItem( MessageManager.getString("action.remove_group")); - keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G, Toolkit - .getDefaultToolkit().getMenuShortcutKeyMask() - | KeyEvent.SHIFT_MASK, false); + keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() + | KeyEvent.SHIFT_MASK, + false); al = new ActionListener() { @Override @@ -1383,8 +962,8 @@ public class GAlignFrame extends JInternalFrame addMenuActionAndAccelerator(keyStroke, unGroup, al); copy.setText(MessageManager.getString("action.copy")); - keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_C, Toolkit - .getDefaultToolkit().getMenuShortcutKeyMask(), false); + keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_C, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); al = new ActionListener() { @@ -1397,8 +976,8 @@ public class GAlignFrame extends JInternalFrame addMenuActionAndAccelerator(keyStroke, copy, al); cut.setText(MessageManager.getString("action.cut")); - keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_X, Toolkit - .getDefaultToolkit().getMenuShortcutKeyMask(), false); + keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_X, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); al = new ActionListener() { @Override @@ -1423,9 +1002,10 @@ public class GAlignFrame extends JInternalFrame pasteMenu.setText(MessageManager.getString("action.paste")); JMenuItem pasteNew = new JMenuItem( MessageManager.getString("label.to_new_alignment")); - keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_V, Toolkit - .getDefaultToolkit().getMenuShortcutKeyMask() - | KeyEvent.SHIFT_MASK, false); + keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_V, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() + | KeyEvent.SHIFT_MASK, + false); al = new ActionListener() { @Override @@ -1438,8 +1018,8 @@ public class GAlignFrame extends JInternalFrame JMenuItem pasteThis = new JMenuItem( MessageManager.getString("label.to_this_alignment")); - keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_V, Toolkit - .getDefaultToolkit().getMenuShortcutKeyMask(), false); + keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_V, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); al = new ActionListener() { @Override @@ -1450,16 +1030,6 @@ public class GAlignFrame extends JInternalFrame }; addMenuActionAndAccelerator(keyStroke, pasteThis, al); - applyToAllGroups.setText(MessageManager - .getString("label.apply_colour_to_all_groups")); - applyToAllGroups.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - applyToAllGroups_actionPerformed(e); - } - }); JMenuItem createPNG = new JMenuItem("PNG"); createPNG.addActionListener(new ActionListener() { @@ -1469,8 +1039,8 @@ public class GAlignFrame extends JInternalFrame createPNG(null); } }); - createPNG.setActionCommand(MessageManager - .getString("label.save_png_image")); + createPNG.setActionCommand( + MessageManager.getString("label.save_png_image")); JMenuItem font = new JMenuItem(MessageManager.getString("action.font")); font.addActionListener(new ActionListener() @@ -1481,8 +1051,8 @@ public class GAlignFrame extends JInternalFrame font_actionPerformed(e); } }); - seqLimits.setText(MessageManager - .getString("label.show_sequence_limits")); + seqLimits.setText( + MessageManager.getString("label.show_sequence_limits")); seqLimits.setState(jalview.bin.Cache.getDefault("SHOW_JVSUFFIX", true)); seqLimits.addActionListener(new ActionListener() { @@ -1514,8 +1084,8 @@ public class GAlignFrame extends JInternalFrame JMenuItem loadTreeMenuItem = new JMenuItem( MessageManager.getString("label.load_associated_tree")); - loadTreeMenuItem.setActionCommand(MessageManager - .getString("label.load_tree_for_sequence_set")); + loadTreeMenuItem.setActionCommand( + MessageManager.getString("label.load_tree_for_sequence_set")); loadTreeMenuItem.addActionListener(new ActionListener() { @Override @@ -1559,8 +1129,8 @@ public class GAlignFrame extends JInternalFrame }); centreColumnLabelsMenuItem.setVisible(true); centreColumnLabelsMenuItem.setState(false); - centreColumnLabelsMenuItem.setText(MessageManager - .getString("label.centre_column_labels")); + centreColumnLabelsMenuItem.setText( + MessageManager.getString("label.centre_column_labels")); centreColumnLabelsMenuItem.addActionListener(new ActionListener() { @Override @@ -1571,8 +1141,8 @@ public class GAlignFrame extends JInternalFrame }); followHighlightMenuItem.setVisible(true); followHighlightMenuItem.setState(true); - followHighlightMenuItem.setText(MessageManager - .getString("label.automatic_scrolling")); + followHighlightMenuItem + .setText(MessageManager.getString("label.automatic_scrolling")); followHighlightMenuItem.addActionListener(new ActionListener() { @@ -1584,26 +1154,6 @@ public class GAlignFrame extends JInternalFrame }); - JMenuItem modifyPID = new JMenuItem( - MessageManager.getString("label.modify_identity_thereshold")); - modifyPID.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - modifyPID_actionPerformed(e); - } - }); - modifyConservation.setText(MessageManager - .getString("label.modify_conservation_thereshold")); - modifyConservation.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - modifyConservation_actionPerformed(e); - } - }); sortByTreeMenu .setText(MessageManager.getString("action.by_tree_order")); sort.setText(MessageManager.getString("action.sort")); @@ -1612,7 +1162,7 @@ public class GAlignFrame extends JInternalFrame @Override public void menuSelected(MenuEvent e) { - buildTreeMenu(); + buildTreeSortMenu(); } @Override @@ -1625,8 +1175,8 @@ public class GAlignFrame extends JInternalFrame { } }); - sortByAnnotScore.setText(MessageManager - .getString("label.sort_by_score")); + sortByAnnotScore + .setText(MessageManager.getString("label.sort_by_score")); sort.add(sortByAnnotScore); sort.addMenuListener(new javax.swing.event.MenuListener() { @@ -1650,11 +1200,11 @@ public class GAlignFrame extends JInternalFrame sortByAnnotScore.setVisible(false); calculateTree - .setText(MessageManager.getString("action.calculate_tree")); + .setText(MessageManager.getString("action.calculate_tree_pca")); padGapsMenuitem.setText(MessageManager.getString("label.pad_gaps")); - padGapsMenuitem.setState(jalview.bin.Cache - .getDefault("PAD_GAPS", false)); + padGapsMenuitem + .setState(jalview.bin.Cache.getDefault("PAD_GAPS", false)); padGapsMenuitem.addActionListener(new ActionListener() { @Override @@ -1674,8 +1224,8 @@ public class GAlignFrame extends JInternalFrame vamsasStore_actionPerformed(e); } }); - showTranslation.setText(MessageManager - .getString("label.translate_cDNA")); + showTranslation + .setText(MessageManager.getString("label.translate_cDNA")); showTranslation.addActionListener(new ActionListener() { @Override @@ -1684,74 +1234,76 @@ public class GAlignFrame extends JInternalFrame showTranslation_actionPerformed(e); } }); - - JMenuItem extractScores = new JMenuItem( - MessageManager.getString("label.extract_scores")); - extractScores.addActionListener(new ActionListener() + showReverse.setText(MessageManager.getString("label.reverse")); + showReverse.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - extractScores_actionPerformed(e); + showReverse_actionPerformed(false); } }); - extractScores.setVisible(true); - // JBPNote: TODO: make gui for regex based score extraction - - // for show products actions see AlignFrame.canShowProducts - showProducts.setText(MessageManager.getString("label.get_cross_refs")); - - JMenuItem openFeatureSettings = new JMenuItem( - MessageManager.getString("action.feature_settings")); - openFeatureSettings.addActionListener(new ActionListener() + showReverseComplement + .setText(MessageManager.getString("label.reverse_complement")); + showReverseComplement.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - featureSettings_actionPerformed(e); + showReverse_actionPerformed(true); } }); - JMenuItem fetchSequence = new JMenuItem( - MessageManager.getString("label.fetch_sequences")); - fetchSequence.addActionListener(new ActionListener() + + JMenuItem extractScores = new JMenuItem( + MessageManager.getString("label.extract_scores")); + extractScores.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - fetchSequence_actionPerformed(e); + extractScores_actionPerformed(e); } }); + extractScores.setVisible(true); + // JBPNote: TODO: make gui for regex based score extraction - JMenuItem annotationColour = new JMenuItem( - MessageManager.getString("action.by_annotation")); - annotationColour.addActionListener(new ActionListener() + // for show products actions see AlignFrame.canShowProducts + showProducts.setText(MessageManager.getString("label.get_cross_refs")); + + runGroovy.setText(MessageManager.getString("label.run_groovy")); + runGroovy.setToolTipText( + MessageManager.getString("label.run_groovy_tip")); + runGroovy.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - annotationColour_actionPerformed(e); + runGroovy_actionPerformed(); } }); - JMenuItem annotationColumn = new JMenuItem( - MessageManager.getString("action.select_by_annotation")); - annotationColumn.addActionListener(new ActionListener() + openFeatureSettings = new JMenuItem( + MessageManager.getString("action.feature_settings")); + openFeatureSettings.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - annotationColumn_actionPerformed(e); + featureSettings_actionPerformed(e); } }); - rnahelicesColour.setText(MessageManager - .getString("action.by_rna_helixes")); - rnahelicesColour.addActionListener(new ActionListener() + /* + * add sub-menu of database we can fetch from + */ + JMenuItem fetchSequence = new JMenuItem( + MessageManager.getString("label.fetch_sequences")); + fetchSequence.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - rnahelicesColour_actionPerformed(e); + fetchSequence_actionPerformed(); } }); @@ -1765,10 +1317,20 @@ public class GAlignFrame extends JInternalFrame associatedData_actionPerformed(e); } }); - autoCalculate.setText(MessageManager - .getString("label.autocalculate_consensus")); - autoCalculate.setState(jalview.bin.Cache.getDefault( - "AUTO_CALC_CONSENSUS", true)); + loadVcf = new JMenuItem(MessageManager.getString("label.load_vcf_file")); + loadVcf.setToolTipText(MessageManager.getString("label.load_vcf")); + loadVcf.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + loadVcf_actionPerformed(); + } + }); + autoCalculate.setText( + MessageManager.getString("label.autocalculate_consensus")); + autoCalculate.setState( + jalview.bin.Cache.getDefault("AUTO_CALC_CONSENSUS", true)); autoCalculate.addActionListener(new ActionListener() { @Override @@ -1777,12 +1339,10 @@ public class GAlignFrame extends JInternalFrame autoCalculate_actionPerformed(e); } }); - sortByTree.setText(MessageManager - .getString("label.sort_alignment_new_tree")); - sortByTree - .setToolTipText("" - + MessageManager - .getString("label.enable_automatically_sort_alignment_when_open_new_tree")); + sortByTree.setText( + MessageManager.getString("label.sort_alignment_new_tree")); + sortByTree.setToolTipText("" + MessageManager.getString( + "label.enable_automatically_sort_alignment_when_open_new_tree")); sortByTree .setState(jalview.bin.Cache.getDefault("SORT_BY_TREE", false)); sortByTree.addActionListener(new ActionListener() @@ -1794,12 +1354,11 @@ public class GAlignFrame extends JInternalFrame } }); - listenToViewSelections.setText(MessageManager - .getString("label.listen_for_selections")); + listenToViewSelections.setText( + MessageManager.getString("label.listen_for_selections")); listenToViewSelections - .setToolTipText("" - + MessageManager - .getString("label.selections_mirror_selections_made_same_sequences_other_views")); + .setToolTipText("" + MessageManager.getString( + "label.selections_mirror_selections_made_same_sequences_other_views")); listenToViewSelections.setState(false); listenToViewSelections.addActionListener(new ActionListener() { @@ -1865,8 +1424,8 @@ public class GAlignFrame extends JInternalFrame statusPanel.setLayout(new GridLayout()); JMenuItem showAllSeqs = new JMenuItem( MessageManager.getString("label.all_sequences")); - showAllSeqs.setToolTipText(MessageManager - .getString("label.toggle_sequence_visibility")); + showAllSeqs.setToolTipText( + MessageManager.getString("label.toggle_sequence_visibility")); showAllSeqs.addActionListener(new ActionListener() { @Override @@ -1877,8 +1436,8 @@ public class GAlignFrame extends JInternalFrame }); JMenuItem showAllColumns = new JMenuItem( MessageManager.getString("label.all_columns")); - showAllColumns.setToolTipText(MessageManager - .getString("label.toggle_columns_visibility")); + showAllColumns.setToolTipText( + MessageManager.getString("label.toggle_columns_visibility")); showAllColumns.addActionListener(new ActionListener() { @Override @@ -1890,8 +1449,8 @@ public class GAlignFrame extends JInternalFrame JMenu hideMenu = new JMenu(MessageManager.getString("action.hide")); JMenuItem hideSelSequences = new JMenuItem( MessageManager.getString("label.selected_sequences")); - hideSelSequences.setToolTipText(MessageManager - .getString("label.toggle_sequence_visibility")); + hideSelSequences.setToolTipText( + MessageManager.getString("label.toggle_sequence_visibility")); hideSelSequences.addActionListener(new ActionListener() { @Override @@ -1902,8 +1461,8 @@ public class GAlignFrame extends JInternalFrame }); JMenuItem hideSelColumns = new JMenuItem( MessageManager.getString("label.selected_columns")); - hideSelColumns.setToolTipText(MessageManager - .getString("label.toggle_columns_visibility")); + hideSelColumns.setToolTipText( + MessageManager.getString("label.toggle_columns_visibility")); hideSelColumns.addActionListener(new ActionListener() { @Override @@ -1945,8 +1504,8 @@ public class GAlignFrame extends JInternalFrame showAllhidden_actionPerformed(e); } }); - hiddenMarkers.setText(MessageManager - .getString("action.show_hidden_markers")); + hiddenMarkers.setText( + MessageManager.getString("action.show_hidden_markers")); hiddenMarkers.addActionListener(new ActionListener() { @Override @@ -1958,9 +1517,10 @@ public class GAlignFrame extends JInternalFrame JMenuItem invertColSel = new JMenuItem( MessageManager.getString("action.invert_column_selection")); - keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_I, Toolkit - .getDefaultToolkit().getMenuShortcutKeyMask() - | KeyEvent.ALT_MASK, false); + keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_I, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() + | KeyEvent.ALT_MASK, + false); al = new ActionListener() { @Override @@ -1996,7 +1556,19 @@ public class GAlignFrame extends JInternalFrame @Override public void mousePressed(MouseEvent e) { - tabbedPane_mousePressed(e); + if (e.isPopupTrigger()) // Mac + { + tabbedPane_mousePressed(e); + } + } + + @Override + public void mouseReleased(MouseEvent e) + { + if (e.isPopupTrigger()) // Windows + { + tabbedPane_mousePressed(e); + } } }); tabbedPane.addFocusListener(new FocusAdapter() @@ -2009,8 +1581,8 @@ public class GAlignFrame extends JInternalFrame }); JMenuItem save = new JMenuItem(MessageManager.getString("action.save")); - keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_S, Toolkit - .getDefaultToolkit().getMenuShortcutKeyMask(), false); + keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_S, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); al = new ActionListener() { @Override @@ -2034,8 +1606,8 @@ public class GAlignFrame extends JInternalFrame JMenuItem newView = new JMenuItem( MessageManager.getString("action.new_view")); - keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_T, Toolkit - .getDefaultToolkit().getMenuShortcutKeyMask(), false); + keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_T, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); al = new ActionListener() { @Override @@ -2049,20 +1621,12 @@ public class GAlignFrame extends JInternalFrame tabbedPane.setToolTipText("" + MessageManager.getString("label.rename_tab_eXpand_reGroup") + ""); - JMenuItem textColour = new JMenuItem( - MessageManager.getString("action.set_text_colour")); - textColour.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - textColour_actionPerformed(e); - } - }); + formatMenu.setText(MessageManager.getString("action.format")); JMenu selectMenu = new JMenu(MessageManager.getString("action.select")); - idRightAlign.setText(MessageManager - .getString("label.right_align_sequence_id")); + + idRightAlign.setText( + MessageManager.getString("label.right_align_sequence_id")); idRightAlign.addActionListener(new ActionListener() { @Override @@ -2118,6 +1682,19 @@ public class GAlignFrame extends JInternalFrame alignmentProperties(); } }); + JMenuItem selectHighlighted = new JMenuItem( + MessageManager.getString("action.select_highlighted_columns")); + selectHighlighted.setToolTipText( + MessageManager.getString("tooltip.select_highlighted_columns")); + al = new ActionListener() + { + @Override + public void actionPerformed(ActionEvent actionEvent) + { + selectHighlightedColumns_actionPerformed(actionEvent); + } + }; + selectHighlighted.addActionListener(al); JMenu tooltipSettingsMenu = new JMenu( MessageManager.getString("label.sequence_id_tooltip")); JMenu autoAnnMenu = new JMenu( @@ -2134,7 +1711,11 @@ public class GAlignFrame extends JInternalFrame alignFrameMenuBar.add(formatMenu); alignFrameMenuBar.add(colourMenu); alignFrameMenuBar.add(calculateMenu); - alignFrameMenuBar.add(webService); + if (!Jalview.isJS()) + { + alignFrameMenuBar.add(webService); + } + fileMenu.add(fetchSequence); fileMenu.add(addSequenceMenu); fileMenu.add(reload); @@ -2151,8 +1732,15 @@ public class GAlignFrame extends JInternalFrame fileMenu.add(exportAnnotations); fileMenu.add(loadTreeMenuItem); fileMenu.add(associatedData); + if (!Jalview.isJS()) + { + fileMenu.add(loadVcf); + } fileMenu.addSeparator(); fileMenu.add(closeMenuItem); + + pasteMenu.add(pasteNew); + pasteMenu.add(pasteThis); editMenu.add(undoMenuItem); editMenu.add(redoMenuItem); editMenu.add(cut); @@ -2173,6 +1761,13 @@ public class GAlignFrame extends JInternalFrame // editMenu.addSeparator(); editMenu.add(padGapsMenuitem); + showMenu.add(showAllColumns); + showMenu.add(showAllSeqs); + showMenu.add(showAllhidden); + hideMenu.add(hideSelColumns); + hideMenu.add(hideSelSequences); + hideMenu.add(hideAllSelection); + hideMenu.add(hideAllButSelection); viewMenu.add(newView); viewMenu.add(expandViews); viewMenu.add(gatherViews); @@ -2216,73 +1811,51 @@ public class GAlignFrame extends JInternalFrame autoAnnMenu.add(showGroupConsensus); annotationsMenu.add(autoAnnMenu); - colourMenu.add(applyToAllGroups); - colourMenu.add(textColour); - colourMenu.addSeparator(); - colourMenu.add(noColourmenuItem); - colourMenu.add(clustalColour); - colourMenu.add(BLOSUM62Colour); - colourMenu.add(PIDColour); - colourMenu.add(zappoColour); - colourMenu.add(taylorColour); - colourMenu.add(hydrophobicityColour); - colourMenu.add(helixColour); - colourMenu.add(strandColour); - colourMenu.add(turnColour); - colourMenu.add(buriedColour); - colourMenu.add(nucleotideColour); - colourMenu.add(purinePyrimidineColour); - colourMenu.add(RNAInteractionColour); - // colourMenu.add(covariationColour); - colourMenu.add(tcoffeeColour); - colourMenu.add(userDefinedColour); - colourMenu.addSeparator(); - colourMenu.add(conservationMenuItem); - colourMenu.add(modifyConservation); - colourMenu.add(abovePIDThreshold); - colourMenu.add(modifyPID); - colourMenu.add(annotationColour); - colourMenu.add(rnahelicesColour); + sort.add(sortIDMenuItem); + sort.add(sortLengthMenuItem); + sort.add(sortGroupMenuItem); + sort.add(sortPairwiseMenuItem); + sort.add(sortByTreeMenu); calculateMenu.add(sort); calculateMenu.add(calculateTree); calculateMenu.addSeparator(); calculateMenu.add(pairwiseAlignmentMenuItem); - calculateMenu.add(PCAMenuItem); calculateMenu.addSeparator(); calculateMenu.add(showTranslation); + calculateMenu.add(showReverse); + calculateMenu.add(showReverseComplement); calculateMenu.add(showProducts); calculateMenu.add(autoCalculate); calculateMenu.add(sortByTree); calculateMenu.addSeparator(); + calculateMenu.add(expandAlignment); calculateMenu.add(extractScores); + if (!Jalview.isJS()) + { + calculateMenu.addSeparator(); + calculateMenu.add(runGroovy); + } + webServiceNoServices = new JMenuItem( MessageManager.getString("label.no_services")); webService.add(webServiceNoServices); - pasteMenu.add(pasteNew); - pasteMenu.add(pasteThis); - sort.add(sortIDMenuItem); - sort.add(sortLengthMenuItem); - sort.add(sortGroupMenuItem); - sort.add(sortPairwiseMenuItem); - sort.add(sortByTreeMenu); - exportImageMenu.add(htmlMenuItem); + if (!Jalview.isJS()) + { + exportImageMenu.add(htmlMenuItem); + } exportImageMenu.add(epsFile); exportImageMenu.add(createPNG); exportImageMenu.add(createBioJS); - exportImageMenu.add(createSVG); + if (!Jalview.isJS()) + { + exportImageMenu.add(createSVG); + } addSequenceMenu.add(addFromFile); addSequenceMenu.add(addFromText); addSequenceMenu.add(addFromURL); this.getContentPane().add(statusPanel, java.awt.BorderLayout.SOUTH); statusPanel.add(statusBar, null); this.getContentPane().add(tabbedPane, java.awt.BorderLayout.CENTER); - showMenu.add(showAllColumns); - showMenu.add(showAllSeqs); - showMenu.add(showAllhidden); - hideMenu.add(hideSelColumns); - hideMenu.add(hideSelSequences); - hideMenu.add(hideAllSelection); - hideMenu.add(hideAllButSelection); formatMenu.add(font); formatMenu.addSeparator(); @@ -2310,13 +1883,126 @@ public class GAlignFrame extends JInternalFrame selectMenu.add(grpsFromSelection); selectMenu.add(deleteGroups); selectMenu.add(annotationColumn); - calculateMenu.add(expandAlignment); + selectMenu.add(selectHighlighted); // TODO - determine if the listenToViewSelections button is needed : see bug // JAL-574 // selectMenu.addSeparator(); // selectMenu.add(listenToViewSelections); } + protected void loadVcf_actionPerformed() + { + } + + /** + * Constructs the entries on the Colour menu (but does not add them to the + * menu). + */ + protected void initColourMenu() + { + applyToAllGroups = new JCheckBoxMenuItem( + MessageManager.getString("label.apply_colour_to_all_groups")); + applyToAllGroups.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + applyToAllGroups_actionPerformed(applyToAllGroups.isSelected()); + } + }); + + textColour = new JMenuItem( + MessageManager.getString("label.text_colour")); + textColour.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + textColour_actionPerformed(); + } + }); + + conservationMenuItem = new JCheckBoxMenuItem( + MessageManager.getString("action.by_conservation")); + conservationMenuItem.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + conservationMenuItem_actionPerformed( + conservationMenuItem.isSelected()); + } + }); + + abovePIDThreshold = new JCheckBoxMenuItem( + MessageManager.getString("label.above_identity_threshold")); + abovePIDThreshold.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + abovePIDThreshold_actionPerformed(abovePIDThreshold.isSelected()); + } + }); + modifyPID = new JMenuItem( + MessageManager.getString("label.modify_identity_threshold")); + modifyPID.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + modifyPID_actionPerformed(); + } + }); + modifyConservation = new JMenuItem(MessageManager + .getString("label.modify_conservation_threshold")); + modifyConservation.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + modifyConservation_actionPerformed(); + } + }); + + annotationColour = new JMenuItem( + MessageManager.getString("action.by_annotation")); + annotationColour.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + annotationColour_actionPerformed(); + } + }); + } + + protected void selectHighlightedColumns_actionPerformed( + ActionEvent actionEvent) + { + // TODO Auto-generated method stub + + } + + /** + * Generate the reverse sequence (or reverse complement if the flag is true) + * and add it to the alignment + * + * @param complement + */ + protected void showReverse_actionPerformed(boolean complement) + { + } + + /** + * Try to run script in a Groovy console, having first ensured that this + * alignframe is set as currentAlignFrame in Desktop + */ + protected void runGroovy_actionPerformed() + { + + } + /** * Adds the given action listener and key accelerator to the given menu item. * Also saves in a lookup table to support lookup of action by key stroke. @@ -2458,13 +2144,6 @@ public class GAlignFrame extends JInternalFrame } - protected void showSeqFeaturesHeight_actionPerformed( - ActionEvent actionEvent) - { - // TODO Auto-generated method stub - - } - protected void justifyRightMenuItem_actionPerformed(ActionEvent e) { // TODO Auto-generated method stub @@ -2507,7 +2186,7 @@ public class GAlignFrame extends JInternalFrame { } - protected void outputText_actionPerformed(ActionEvent e) + protected void outputText_actionPerformed(String formatName) { } @@ -2633,87 +2312,11 @@ public class GAlignFrame extends JInternalFrame { } - protected void PCAMenuItem_actionPerformed(ActionEvent e) - { - } - - protected void averageDistanceTreeMenuItem_actionPerformed(ActionEvent e) - { - } - protected void neighbourTreeMenuItem_actionPerformed(ActionEvent e) { } - protected void njTreeBlosumMenuItem_actionPerformed(ActionEvent e) - { - } - - protected void avTreeBlosumMenuItem_actionPerformed(ActionEvent e) - { - } - - protected void clustalColour_actionPerformed(ActionEvent e) - { - } - - protected void zappoColour_actionPerformed(ActionEvent e) - { - } - - protected void taylorColour_actionPerformed(ActionEvent e) - { - } - - protected void hydrophobicityColour_actionPerformed(ActionEvent e) - { - } - - protected void helixColour_actionPerformed(ActionEvent e) - { - } - - protected void strandColour_actionPerformed(ActionEvent e) - { - } - - protected void turnColour_actionPerformed(ActionEvent e) - { - } - - protected void buriedColour_actionPerformed(ActionEvent e) - { - } - - protected void userDefinedColour_actionPerformed(ActionEvent e) - { - } - - protected void PIDColour_actionPerformed(ActionEvent e) - { - } - - protected void BLOSUM62Colour_actionPerformed(ActionEvent e) - { - } - - protected void purinePyrimidineColour_actionPerformed(ActionEvent e) - { - } - - protected void RNAInteractionColour_actionPerformed(ActionEvent e) - { - } - - /* - * protected void covariationColour_actionPerformed(ActionEvent e) { } - */ - - protected void noColourmenuItem_actionPerformed(ActionEvent e) - { - } - - protected void conservationMenuItem_actionPerformed(ActionEvent e) + protected void conservationMenuItem_actionPerformed(boolean selected) { } @@ -2729,7 +2332,7 @@ public class GAlignFrame extends JInternalFrame { } - protected void abovePIDThreshold_actionPerformed(ActionEvent e) + protected void abovePIDThreshold_actionPerformed(boolean selected) { } @@ -2737,10 +2340,6 @@ public class GAlignFrame extends JInternalFrame { } - protected void nucleotideColour_actionPerformed(ActionEvent e) - { - } - protected void deleteGroups_actionPerformed(ActionEvent e) { } @@ -2773,7 +2372,7 @@ public class GAlignFrame extends JInternalFrame { } - protected void applyToAllGroups_actionPerformed(ActionEvent e) + protected void applyToAllGroups_actionPerformed(boolean selected) { } @@ -2821,19 +2420,6 @@ public class GAlignFrame extends JInternalFrame } - /** - * Template method to handle the 'Color T-Coffee scores' menu event. - *
- * Subclasses override this method to provide a custom action. - * - * @param event - * The raised event - */ - protected void tcoffeeColorScheme_actionPerformed(ActionEvent event) - { - - } - protected void jpred_actionPerformed(ActionEvent e) { } @@ -2850,15 +2436,15 @@ public class GAlignFrame extends JInternalFrame { } - protected void modifyPID_actionPerformed(ActionEvent e) + protected void modifyPID_actionPerformed() { } - protected void modifyConservation_actionPerformed(ActionEvent e) + protected void modifyConservation_actionPerformed() { } - protected void saveAs_actionPerformed(ActionEvent e) + protected void saveAs_actionPerformed() { } @@ -2886,7 +2472,7 @@ public class GAlignFrame extends JInternalFrame } - public void fetchSequence_actionPerformed(ActionEvent e) + public void fetchSequence_actionPerformed() { } @@ -2896,19 +2482,12 @@ public class GAlignFrame extends JInternalFrame } - public void annotationColour_actionPerformed(ActionEvent e) + public void annotationColour_actionPerformed() { - } public void annotationColumn_actionPerformed(ActionEvent e) { - - } - - public void rnahelicesColour_actionPerformed(ActionEvent e) - { - } public void associatedData_actionPerformed(ActionEvent e) @@ -3001,7 +2580,7 @@ public class GAlignFrame extends JInternalFrame } - public void textColour_actionPerformed(ActionEvent e) + public void textColour_actionPerformed() { } @@ -3021,7 +2600,7 @@ public class GAlignFrame extends JInternalFrame } - public void buildTreeMenu() + public void buildTreeSortMenu() { } @@ -3105,7 +2684,7 @@ public class GAlignFrame extends JInternalFrame return this.splitFrame; } - protected void showComplement_actionPerformed(boolean state) + protected void showComplement_actionPerformed(boolean complement) { } }