X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fjbgui%2FGAlignFrame.java;h=18731adda63651610e5e5385519f320cb9f22d39;hb=3da878124135ff033f42d19d8733891b09e953cd;hp=2b056fcebd60bf23385da81c242d9c74571327e9;hpb=96026e673c3629afa54a0d03be4b0022c7b42869;p=jalview.git diff --git a/src/jalview/jbgui/GAlignFrame.java b/src/jalview/jbgui/GAlignFrame.java index 2b056fc..18731ad 100755 --- a/src/jalview/jbgui/GAlignFrame.java +++ b/src/jalview/jbgui/GAlignFrame.java @@ -21,12 +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.bin.Jalview; import jalview.gui.JvSwingUtils; import jalview.gui.Preferences; import jalview.io.FileFormats; +import jalview.schemes.ResidueColourScheme; import jalview.util.MessageManager; import jalview.util.Platform; @@ -76,7 +78,7 @@ public class GAlignFrame extends JInternalFrame protected JMenu sortByAnnotScore = new JMenu(); - public JLabel statusBar = new JLabel(); + protected JLabel statusBar = new JLabel(); protected JMenu outputTextboxMenu = new JMenu(); @@ -124,7 +126,7 @@ public class GAlignFrame extends JInternalFrame protected JMenuItem modifyPID; - protected JMenuItem annotationColour; + protected JRadioButtonMenuItem annotationColour; protected JMenu sortByTreeMenu = new JMenu(); @@ -138,7 +140,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(); @@ -204,7 +206,7 @@ public class GAlignFrame extends JInternalFrame private boolean showAutoCalculatedAbove = false; - private Map accelerators = new HashMap(); + private Map accelerators = new HashMap<>(); private SplitContainerI splitFrame; @@ -236,7 +238,7 @@ public class GAlignFrame extends JInternalFrame System.err.println(e.toString()); } - if (Platform.isWin()) // was "not mac and not JS" + if (Platform.allowMnemonics()) // was "not mac and not JS" { closeMenuItem.setMnemonic('C'); outputTextboxMenu.setMnemonic('T'); @@ -970,7 +972,7 @@ public class GAlignFrame extends JInternalFrame @Override public void actionPerformed(ActionEvent e) { - copy_actionPerformed(e); + copy_actionPerformed(); } }; addMenuActionAndAccelerator(keyStroke, copy, al); @@ -983,7 +985,7 @@ public class GAlignFrame extends JInternalFrame @Override public void actionPerformed(ActionEvent e) { - cut_actionPerformed(e); + cut_actionPerformed(); } }; addMenuActionAndAccelerator(keyStroke, cut, al); @@ -995,7 +997,7 @@ public class GAlignFrame extends JInternalFrame @Override public void actionPerformed(ActionEvent e) { - delete_actionPerformed(e); + delete_actionPerformed(); } }); @@ -1224,16 +1226,33 @@ public class GAlignFrame extends JInternalFrame vamsasStore_actionPerformed(e); } }); - showTranslation - .setText(MessageManager.getString("label.translate_cDNA")); - showTranslation.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) + + /* + * Translate as cDNA with sub-menu of translation tables + */ + showTranslation.setText(MessageManager + .getString("label.translate_cDNA")); + boolean first = true; + for (final GeneticCodeI table : GeneticCodes.getInstance() + .getCodeTables()) + { + JMenuItem item = new JMenuItem(table.getId() + " " + table.getName()); + showTranslation.add(item); + item.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + showTranslation_actionPerformed(table); + } + }); + if (first) { - showTranslation_actionPerformed(e); + showTranslation.addSeparator(); } - }); + first = false; + } + showReverse.setText(MessageManager.getString("label.reverse")); showReverse.addActionListener(new ActionListener() { @@ -1711,7 +1730,7 @@ public class GAlignFrame extends JInternalFrame alignFrameMenuBar.add(formatMenu); alignFrameMenuBar.add(colourMenu); alignFrameMenuBar.add(calculateMenu); - if (!Jalview.isJS()) + if (!Platform.isJS()) { alignFrameMenuBar.add(webService); } @@ -1732,7 +1751,7 @@ public class GAlignFrame extends JInternalFrame fileMenu.add(exportAnnotations); fileMenu.add(loadTreeMenuItem); fileMenu.add(associatedData); - if (!Jalview.isJS()) + if (!Platform.isJS()) { fileMenu.add(loadVcf); } @@ -1830,7 +1849,7 @@ public class GAlignFrame extends JInternalFrame calculateMenu.addSeparator(); calculateMenu.add(expandAlignment); calculateMenu.add(extractScores); - if (!Jalview.isJS()) + if (!Platform.isJS()) { calculateMenu.addSeparator(); calculateMenu.add(runGroovy); @@ -1839,15 +1858,15 @@ public class GAlignFrame extends JInternalFrame webServiceNoServices = new JMenuItem( MessageManager.getString("label.no_services")); webService.add(webServiceNoServices); - if (!Jalview.isJS()) + if (!Platform.isJS()) { exportImageMenu.add(htmlMenuItem); } exportImageMenu.add(epsFile); exportImageMenu.add(createPNG); - exportImageMenu.add(createBioJS); - if (!Jalview.isJS()) + if (!Platform.isJS()) { + exportImageMenu.add(createBioJS); exportImageMenu.add(createSVG); } addSequenceMenu.add(addFromFile); @@ -1965,8 +1984,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 @@ -2352,15 +2372,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() { } @@ -2462,7 +2482,7 @@ public class GAlignFrame extends JInternalFrame } - public void showTranslation_actionPerformed(ActionEvent e) + public void showTranslation_actionPerformed(GeneticCodeI codeTable) { }