X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fjbgui%2FGAlignFrame.java;h=18731adda63651610e5e5385519f320cb9f22d39;hb=3da878124135ff033f42d19d8733891b09e953cd;hp=59401729d63895c2c54314b9bf5db31eaa6f1485;hpb=2d8dfad8a0aa6a6febfc0c3bc0379de0b46e0cfc;p=jalview.git diff --git a/src/jalview/jbgui/GAlignFrame.java b/src/jalview/jbgui/GAlignFrame.java index 5940172..18731ad 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; @@ -75,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(); @@ -123,7 +126,7 @@ public class GAlignFrame extends JInternalFrame protected JMenuItem modifyPID; - protected JMenuItem annotationColour; + protected JRadioButtonMenuItem annotationColour; protected JMenu sortByTreeMenu = new JMenu(); @@ -137,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(); @@ -203,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; @@ -1223,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() { @@ -1964,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 @@ -2461,7 +2482,7 @@ public class GAlignFrame extends JInternalFrame } - public void showTranslation_actionPerformed(ActionEvent e) + public void showTranslation_actionPerformed(GeneticCodeI codeTable) { }