X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fjbgui%2FGAlignFrame.java;h=8bbfb8d10d23cbf2511c6600d831ef7fc4e9ea3a;hb=8fa69554edf6aeb278b4a4afd8e2b60264fdccd8;hp=86d0c85b201dae4cef8f9ed9748dc73f8b0b2fd4;hpb=3d0101179759ef157b088ea135423cd909512d9f;p=jalview.git diff --git a/src/jalview/jbgui/GAlignFrame.java b/src/jalview/jbgui/GAlignFrame.java index 86d0c85..8bbfb8d 100755 --- a/src/jalview/jbgui/GAlignFrame.java +++ b/src/jalview/jbgui/GAlignFrame.java @@ -21,11 +21,14 @@ package jalview.jbgui; import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder; +import jalview.analysis.GeneticCodeI; +import jalview.analysis.GeneticCodes; import jalview.api.SplitContainerI; import jalview.bin.Cache; import jalview.gui.JvSwingUtils; import jalview.gui.Preferences; import jalview.io.FileFormats; +import jalview.schemes.ResidueColourScheme; import jalview.util.MessageManager; import jalview.util.Platform; @@ -59,15 +62,18 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.MenuEvent; import javax.swing.event.MenuListener; +@SuppressWarnings("serial") public class GAlignFrame extends JInternalFrame { protected JMenuBar alignFrameMenuBar = new JMenuBar(); protected JMenuItem closeMenuItem = new JMenuItem(); - protected JMenu webService = new JMenu(); + public JMenu webService = new JMenu();// BH 2019 was protected, but not + // sufficient for AlignFrame thread run - protected JMenuItem webServiceNoServices; + public JMenuItem webServiceNoServices;// BH 2019 was protected, but not + // sufficient for AlignFrame thread run protected JCheckBoxMenuItem viewBoxesMenuItem = new JCheckBoxMenuItem(); @@ -75,7 +81,9 @@ public class GAlignFrame extends JInternalFrame protected JMenu sortByAnnotScore = new JMenu(); - public JLabel statusBar = new JLabel(); + public JLabel statusBar = new JLabel(); // BH 2019 was protected, but not + // sufficient for + // AlignFrame.printWriter protected JMenu outputTextboxMenu = new JMenu(); @@ -123,7 +131,7 @@ public class GAlignFrame extends JInternalFrame protected JMenuItem modifyPID; - protected JMenuItem annotationColour; + protected JRadioButtonMenuItem annotationColour; protected JMenu sortByTreeMenu = new JMenu(); @@ -137,7 +145,7 @@ public class GAlignFrame extends JInternalFrame protected JCheckBoxMenuItem showDbRefsMenuitem = new JCheckBoxMenuItem(); - protected JMenuItem showTranslation = new JMenuItem(); + protected JMenu showTranslation = new JMenu(); protected JMenuItem showReverse = new JMenuItem(); @@ -147,6 +155,8 @@ public class GAlignFrame extends JInternalFrame protected JMenuItem runGroovy = new JMenuItem(); + protected JMenuItem loadVcf; + protected JCheckBoxMenuItem autoCalculate = new JCheckBoxMenuItem(); protected JCheckBoxMenuItem sortByTree = new JCheckBoxMenuItem(); @@ -195,11 +205,13 @@ public class GAlignFrame extends JInternalFrame protected JCheckBoxMenuItem applyAutoAnnotationSettings = new JCheckBoxMenuItem(); + protected JMenuItem openFeatureSettings; + private SequenceAnnotationOrder annotationSortOrder; private boolean showAutoCalculatedAbove = false; - private Map accelerators = new HashMap(); + private Map accelerators = new HashMap<>(); private SplitContainerI splitFrame; @@ -207,6 +219,10 @@ public class GAlignFrame extends JInternalFrame { try { + + // for Web-page embedding using id=align-frame-div + setName("jalview-alignment"); + jbInit(); setJMenuBar(alignFrameMenuBar); @@ -220,7 +236,7 @@ public class GAlignFrame extends JInternalFrame @Override public void actionPerformed(ActionEvent e) { - outputText_actionPerformed(e); + outputText_actionPerformed(e.getActionCommand()); } }); @@ -231,7 +247,7 @@ public class GAlignFrame extends JInternalFrame System.err.println(e.toString()); } - if (!Platform.isAMac()) + if (Platform.allowMnemonics()) // was "not mac and not JS" { closeMenuItem.setMnemonic('C'); outputTextboxMenu.setMnemonic('T'); @@ -255,7 +271,7 @@ public class GAlignFrame extends JInternalFrame @Override public void actionPerformed(ActionEvent e) { - saveAs_actionPerformed(e); + saveAs_actionPerformed(); } }; @@ -965,7 +981,7 @@ public class GAlignFrame extends JInternalFrame @Override public void actionPerformed(ActionEvent e) { - copy_actionPerformed(e); + copy_actionPerformed(); } }; addMenuActionAndAccelerator(keyStroke, copy, al); @@ -978,7 +994,7 @@ public class GAlignFrame extends JInternalFrame @Override public void actionPerformed(ActionEvent e) { - cut_actionPerformed(e); + cut_actionPerformed(); } }; addMenuActionAndAccelerator(keyStroke, cut, al); @@ -990,7 +1006,7 @@ public class GAlignFrame extends JInternalFrame @Override public void actionPerformed(ActionEvent e) { - delete_actionPerformed(e); + delete_actionPerformed(); } }); @@ -1219,16 +1235,33 @@ public class GAlignFrame extends JInternalFrame vamsasStore_actionPerformed(e); } }); + + /* + * Translate as cDNA with sub-menu of translation tables + */ showTranslation .setText(MessageManager.getString("label.translate_cDNA")); - showTranslation.addActionListener(new ActionListener() + boolean first = true; + for (final GeneticCodeI table : GeneticCodes.getInstance() + .getCodeTables()) { - @Override - public void actionPerformed(ActionEvent e) + JMenuItem item = new JMenuItem(table.getId() + " " + table.getName()); + showTranslation.add(item); + item.addActionListener(new ActionListener() { - showTranslation_actionPerformed(e); + @Override + public void actionPerformed(ActionEvent e) + { + showTranslation_actionPerformed(table); + } + }); + if (first) + { + showTranslation.addSeparator(); } - }); + first = false; + } + showReverse.setText(MessageManager.getString("label.reverse")); showReverse.addActionListener(new ActionListener() { @@ -1277,7 +1310,7 @@ public class GAlignFrame extends JInternalFrame } }); - JMenuItem openFeatureSettings = new JMenuItem( + openFeatureSettings = new JMenuItem( MessageManager.getString("action.feature_settings")); openFeatureSettings.addActionListener(new ActionListener() { @@ -1287,6 +1320,10 @@ public class GAlignFrame extends JInternalFrame featureSettings_actionPerformed(e); } }); + + /* + * add sub-menu of database we can fetch from + */ JMenuItem fetchSequence = new JMenuItem( MessageManager.getString("label.fetch_sequences")); fetchSequence.addActionListener(new ActionListener() @@ -1294,7 +1331,7 @@ public class GAlignFrame extends JInternalFrame @Override public void actionPerformed(ActionEvent e) { - fetchSequence_actionPerformed(e); + fetchSequence_actionPerformed(); } }); @@ -1308,6 +1345,17 @@ public class GAlignFrame extends JInternalFrame associatedData_actionPerformed(e); } }); + 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( @@ -1692,7 +1740,10 @@ public class GAlignFrame extends JInternalFrame alignFrameMenuBar.add(formatMenu); alignFrameMenuBar.add(colourMenu); alignFrameMenuBar.add(calculateMenu); - alignFrameMenuBar.add(webService); + if (!Platform.isJS()) + { + alignFrameMenuBar.add(webService); + } fileMenu.add(fetchSequence); fileMenu.add(addSequenceMenu); @@ -1710,6 +1761,10 @@ public class GAlignFrame extends JInternalFrame fileMenu.add(exportAnnotations); fileMenu.add(loadTreeMenuItem); fileMenu.add(associatedData); + if (!Platform.isJS()) + { + fileMenu.add(loadVcf); + } fileMenu.addSeparator(); fileMenu.add(closeMenuItem); @@ -1804,17 +1859,26 @@ public class GAlignFrame extends JInternalFrame calculateMenu.addSeparator(); calculateMenu.add(expandAlignment); calculateMenu.add(extractScores); - calculateMenu.addSeparator(); - calculateMenu.add(runGroovy); + if (!Platform.isJS()) + { + calculateMenu.addSeparator(); + calculateMenu.add(runGroovy); + } webServiceNoServices = new JMenuItem( MessageManager.getString("label.no_services")); webService.add(webServiceNoServices); - exportImageMenu.add(htmlMenuItem); + if (!Platform.isJS()) + { + exportImageMenu.add(htmlMenuItem); + } exportImageMenu.add(epsFile); exportImageMenu.add(createPNG); - exportImageMenu.add(createBioJS); - exportImageMenu.add(createSVG); + if (!Platform.isJS()) + { + exportImageMenu.add(createBioJS); + exportImageMenu.add(createSVG); + } addSequenceMenu.add(addFromFile); addSequenceMenu.add(addFromText); addSequenceMenu.add(addFromURL); @@ -1855,6 +1919,10 @@ public class GAlignFrame extends JInternalFrame // selectMenu.add(listenToViewSelections); } + protected void loadVcf_actionPerformed() + { + } + /** * Constructs the entries on the Colour menu (but does not add them to the * menu). @@ -1926,8 +1994,9 @@ public class GAlignFrame extends JInternalFrame } }); - annotationColour = new JMenuItem( + annotationColour = new JRadioButtonMenuItem( MessageManager.getString("action.by_annotation")); + annotationColour.setName(ResidueColourScheme.ANNOTATION_COLOUR); annotationColour.addActionListener(new ActionListener() { @Override @@ -2147,7 +2216,7 @@ public class GAlignFrame extends JInternalFrame { } - protected void outputText_actionPerformed(ActionEvent e) + protected void outputText_actionPerformed(String formatName) { } @@ -2313,15 +2382,15 @@ public class GAlignFrame extends JInternalFrame { } - protected void copy_actionPerformed(ActionEvent e) + protected void copy_actionPerformed() { } - protected void cut_actionPerformed(ActionEvent e) + protected void cut_actionPerformed() { } - protected void delete_actionPerformed(ActionEvent e) + protected void delete_actionPerformed() { } @@ -2405,7 +2474,7 @@ public class GAlignFrame extends JInternalFrame { } - protected void saveAs_actionPerformed(ActionEvent e) + protected void saveAs_actionPerformed() { } @@ -2423,7 +2492,7 @@ public class GAlignFrame extends JInternalFrame } - public void showTranslation_actionPerformed(ActionEvent e) + public void showTranslation_actionPerformed(GeneticCodeI codeTable) { } @@ -2433,7 +2502,7 @@ public class GAlignFrame extends JInternalFrame } - public void fetchSequence_actionPerformed(ActionEvent e) + public void fetchSequence_actionPerformed() { }