JAL-2361 adding items to applet colour menus, TCoffee colour to desktop
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 13 Dec 2016 10:46:04 +0000 (10:46 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 13 Dec 2016 10:46:04 +0000 (10:46 +0000)
popup menu, extracted PopupMenu.buildColourMenu()

resources/lang/Messages.properties
resources/lang/Messages_es.properties
src/jalview/appletgui/APopupMenu.java
src/jalview/appletgui/AlignFrame.java
src/jalview/gui/PopupMenu.java
src/jalview/jbgui/GAlignFrame.java

index 74bb2d1..2a69f14 100644 (file)
@@ -210,7 +210,7 @@ label.hide_all = Hide all
 label.add_reference_annotations = Add reference annotations
 label.find_tip = Search alignment, selection or sequence ids for a subsequence (ignoring gaps).<br>Accepts regular expressions - search Help for 'regex' for details.
 label.colour_text = Colour Text
-label.show_non_conversed = Show nonconserved
+label.show_non_conserved = Show nonconserved
 label.overview_window = Overview Window
 label.none = None
 label.above_identity_threshold = Above Identity Threshold
@@ -669,7 +669,6 @@ action.set_text_colour = Text Colour...
 label.structure = Structure
 label.show_pdbstruct_dialog = 3D Structure Data...
 label.view_rna_structure = VARNA 2D Structure
-label.above_identity_percentage = Above % Identity
 label.create_sequence_details_report_annotation_for = Annotation for {0}
 label.sequence_details_for = Sequence Details for {0}
 label.sequence_name = Sequence Name
index 8da7dcb..9756ab4 100644 (file)
@@ -199,7 +199,7 @@ label.average_distance_bloslum62 = Distancia Media Usando BLOSUM62
 label.neighbour_blosum62 = Neighbour Joining usando BLOSUM62
 label.show_annotations = Mostrar anotaciones
 label.colour_text = Color del texto
-label.show_non_conversed = Mostrar no conservadas
+label.show_non_conserved = Mostrar no conservadas
 label.overview_window = Ventana resumen
 label.none = Ninguno
 label.above_identity_threshold = Por encima del umbral de identidad
@@ -621,7 +621,6 @@ label.from_file = desde fichero
 label.enter_pdb_id = Introducir PDB Id
 label.text_colour = Color del texto
 label.structure = Estructura
-label.above_identity_percentage = Sobre % identidad
 label.create_sequence_details_report_annotation_for = AnotaciĆ³n para {0}
 label.sequence_details_for = Detalles de la secuencia para {0}
 label.sequence_name = Nombre de la secuencia
index 9080cdd..39c6a8b 100644 (file)
@@ -45,6 +45,7 @@ import jalview.schemes.HelixColourScheme;
 import jalview.schemes.HydrophobicColourScheme;
 import jalview.schemes.NucleotideColourScheme;
 import jalview.schemes.PIDColourScheme;
+import jalview.schemes.PurinePyrimidineColourScheme;
 import jalview.schemes.StrandColourScheme;
 import jalview.schemes.TaylorColourScheme;
 import jalview.schemes.TurnColourScheme;
@@ -113,6 +114,8 @@ public class APopupMenu extends java.awt.PopupMenu implements
 
   MenuItem nucleotideMenuItem = new MenuItem();
 
+  MenuItem purinePyrimidineMenuItem = new MenuItem();
+
   Menu colourMenu = new Menu();
 
   CheckboxMenuItem showBoxes = new CheckboxMenuItem();
@@ -563,6 +566,10 @@ public class APopupMenu extends java.awt.PopupMenu implements
     {
       nucleotideMenuItem_actionPerformed();
     }
+    else if (source == purinePyrimidineMenuItem)
+    {
+      purinePyrimidineColour_actionPerformed();
+    }
 
     else if (source == userDefinedColour)
     {
@@ -894,6 +901,9 @@ public class APopupMenu extends java.awt.PopupMenu implements
     nucleotideMenuItem.setLabel(MessageManager
             .getString("label.nucleotide"));
     nucleotideMenuItem.addActionListener(this);
+    purinePyrimidineMenuItem.setLabel(MessageManager
+            .getString("label.purine_pyrimidine"));
+    purinePyrimidineMenuItem.addActionListener(this);
     conservationMenuItem.addItemListener(this);
     abovePIDColour.addItemListener(this);
     colourMenu.setLabel(MessageManager.getString("label.group_colour"));
@@ -904,7 +914,7 @@ public class APopupMenu extends java.awt.PopupMenu implements
     sequenceDetails.addActionListener(this);
     selSeqDetails.addActionListener(this);
     displayNonconserved.setLabel(MessageManager
-            .getString("label.show_non_conversed"));
+            .getString("label.show_non_conserved"));
     displayNonconserved.setState(false);
     displayNonconserved.addItemListener(this);
     showText.setLabel(MessageManager.getString("action.text"));
@@ -948,6 +958,7 @@ public class APopupMenu extends java.awt.PopupMenu implements
     colourMenu.add(turnColour);
     colourMenu.add(buriedColour);
     colourMenu.add(nucleotideMenuItem);
+    colourMenu.add(purinePyrimidineMenuItem);
     colourMenu.add(userDefinedColour);
     colourMenu.addSeparator();
     colourMenu.add(abovePIDColour);
@@ -976,7 +987,7 @@ public class APopupMenu extends java.awt.PopupMenu implements
     buriedColour.setLabel(MessageManager.getString("label.buried_index"));
     buriedColour.addActionListener(this);
     abovePIDColour.setLabel(MessageManager
-            .getString("label.above_identity_percentage"));
+            .getString("label.above_identity_threshold"));
 
     userDefinedColour.setLabel(MessageManager
             .getString("action.user_defined"));
@@ -984,7 +995,8 @@ public class APopupMenu extends java.awt.PopupMenu implements
     PIDColour.setLabel(MessageManager
             .getString("label.percentage_identity"));
     PIDColour.addActionListener(this);
-    BLOSUM62Colour.setLabel("BLOSUM62");
+    BLOSUM62Colour.setLabel(MessageManager
+            .getString("label.blosum62_score"));
     BLOSUM62Colour.addActionListener(this);
     conservationMenuItem.setLabel(MessageManager
             .getString("label.conservation"));
@@ -1089,6 +1101,12 @@ public class APopupMenu extends java.awt.PopupMenu implements
     refresh();
   }
 
+  public void purinePyrimidineColour_actionPerformed()
+  {
+    getGroup().cs = new PurinePyrimidineColourScheme();
+    refresh();
+  }
+
   protected void abovePIDColour_itemStateChanged()
   {
     SequenceGroup sg = getGroup();
index f830fe6..14b3e6a 100644 (file)
@@ -296,6 +296,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     {
       RNAHelixColour.setEnabled(false);
       purinePyrimidineColour.setEnabled(false);
+      nucleotideColour.setEnabled(false);
     }
     // Some JVMS send keyevents to Top frame or lowest panel,
     // Havent worked out why yet. So add to both this frame and seqCanvas for
@@ -3436,7 +3437,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
             .getString("label.colour_text"));
     colourTextMenuItem.addItemListener(this);
     displayNonconservedMenuItem.setLabel(MessageManager
-            .getString("label.show_non_conversed"));
+            .getString("label.show_non_conserved"));
     displayNonconservedMenuItem.addItemListener(this);
     wrapMenuItem.setLabel(MessageManager.getString("action.wrap"));
     wrapMenuItem.addItemListener(this);
index 0166e75..838b534 100644 (file)
@@ -52,6 +52,7 @@ import jalview.schemes.NucleotideColourScheme;
 import jalview.schemes.PIDColourScheme;
 import jalview.schemes.PurinePyrimidineColourScheme;
 import jalview.schemes.StrandColourScheme;
+import jalview.schemes.TCoffeeColourScheme;
 import jalview.schemes.TaylorColourScheme;
 import jalview.schemes.TurnColourScheme;
 import jalview.schemes.UserColourScheme;
@@ -119,9 +120,13 @@ public class PopupMenu extends JPopupMenu
 
   protected JRadioButtonMenuItem BLOSUM62Colour = new JRadioButtonMenuItem();
 
+  JRadioButtonMenuItem nucleotideColour = new JRadioButtonMenuItem();
+
   protected JRadioButtonMenuItem purinePyrimidineColour = new JRadioButtonMenuItem();
 
-  protected JRadioButtonMenuItem RNAInteractionColour = new JRadioButtonMenuItem();
+  protected JRadioButtonMenuItem tcoffeeColour = new JRadioButtonMenuItem();
+
+  // protected JRadioButtonMenuItem RNAInteractionColour;
 
   JRadioButtonMenuItem noColourmenuItem = new JRadioButtonMenuItem();
 
@@ -149,8 +154,6 @@ public class PopupMenu extends JPopupMenu
 
   JMenuItem outline = new JMenuItem();
 
-  JRadioButtonMenuItem nucleotideMenuItem = new JRadioButtonMenuItem();
-
   JMenu colourMenu = new JMenu();
 
   JCheckBoxMenuItem showBoxes = new JCheckBoxMenuItem();
@@ -239,23 +242,6 @@ public class PopupMenu extends JPopupMenu
     this.ap = ap;
     sequence = seq;
 
-    ButtonGroup colours = new ButtonGroup();
-    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(abovePIDColour);
-    colours.add(userDefinedColour);
-    colours.add(PIDColour);
-    colours.add(BLOSUM62Colour);
-    colours.add(purinePyrimidineColour);
-    colours.add(RNAInteractionColour);
-
     for (String ff : FileFormat.getWritableFormats(true))
     {
       JMenuItem item = new JMenuItem(ff);
@@ -526,6 +512,10 @@ public class PopupMenu extends JPopupMenu
       {
         purinePyrimidineColour.setSelected(true);
       }
+      else if (sg.cs instanceof NucleotideColourScheme)
+      {
+        nucleotideColour.setSelected(true);
+      }
 
       /*
        * else if (sg.cs instanceof CovariationColourScheme) {
@@ -1121,9 +1111,9 @@ public class PopupMenu extends JPopupMenu
         outline_actionPerformed();
       }
     });
-    nucleotideMenuItem
+    nucleotideColour
             .setText(MessageManager.getString("label.nucleotide"));
-    nucleotideMenuItem.addActionListener(new ActionListener()
+    nucleotideColour.addActionListener(new ActionListener()
     {
       @Override
       public void actionPerformed(ActionEvent e)
@@ -1162,7 +1152,7 @@ public class PopupMenu extends JPopupMenu
       }
     });
     displayNonconserved.setText(MessageManager
-            .getString("label.show_non_conversed"));
+            .getString("label.show_non_conserved"));
     displayNonconserved.setState(true);
     displayNonconserved.addActionListener(new ActionListener()
     {
@@ -1338,47 +1328,9 @@ public class PopupMenu extends JPopupMenu
     sequenceMenu.add(sequenceName);
     sequenceMenu.add(sequenceDetails);
     sequenceMenu.add(makeReferenceSeq);
-    colourMenu.add(textColour);
-    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(nucleotideMenuItem);
-    if (ap.getAlignment().isNucleotide())
-    {
-      colourMenu.add(purinePyrimidineColour);
-    }
 
-    SortedMap<String, UserColourScheme> userColourSchemes = UserDefinedColours
-            .getUserColourSchemes();
-    if (userColourSchemes != null)
-    {
-      for (String userColour : userColourSchemes.keySet())
-    {
-        JMenuItem item = new JMenuItem(userColour);
-        item.addActionListener(new ActionListener()
-        {
-          @Override
-          public void actionPerformed(ActionEvent evt)
-          {
-            userDefinedColour_actionPerformed(evt);
-          }
-        });
-        colourMenu.add(item);
-      }
-    }
-    colourMenu.add(userDefinedColour);
+    buildColourMenu();
 
-    colourMenu.addSeparator();
-    colourMenu.add(abovePIDColour);
-    colourMenu.add(conservationMenuItem);
     editMenu.add(copy);
     editMenu.add(cut);
     editMenu.add(editSequence);
@@ -1482,7 +1434,7 @@ public class PopupMenu extends JPopupMenu
       }
     });
     abovePIDColour.setText(MessageManager
-            .getString("label.above_identity_percentage"));
+            .getString("label.above_identity_threshold"));
     abovePIDColour.addActionListener(new java.awt.event.ActionListener()
     {
       @Override
@@ -1533,6 +1485,16 @@ public class PopupMenu extends JPopupMenu
               }
             });
 
+    tcoffeeColour.setText(MessageManager.getString("label.tcoffee_scores"));
+    tcoffeeColour.addActionListener(new ActionListener()
+    {
+      @Override
+      public void actionPerformed(ActionEvent e)
+      {
+        tcoffeeColorScheme_actionPerformed();
+      }
+    });
+
     /*
      * covariationColour.addActionListener(new java.awt.event.ActionListener() {
      * public void actionPerformed(ActionEvent e) {
@@ -1540,19 +1502,89 @@ public class PopupMenu extends JPopupMenu
      */
 
     conservationMenuItem.setText(MessageManager
-            .getString("label.conservation"));
-    conservationMenuItem
-            .addActionListener(new java.awt.event.ActionListener()
-            {
-              @Override
-              public void actionPerformed(ActionEvent e)
-              {
-                conservationMenuItem_actionPerformed();
+            .getString("action.by_conservation"));
+    conservationMenuItem.addActionListener(new ActionListener()
+    {
+      @Override
+      public void actionPerformed(ActionEvent e)
+      {
+        conservationMenuItem_actionPerformed();
               }
             });
   }
 
   /**
+   * Adds items to the group colour sub-menu
+   */
+  protected void buildColourMenu()
+  {
+    colourMenu.removeAll();
+    colourMenu.add(textColour);
+    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(tcoffeeColour);
+
+    SortedMap<String, UserColourScheme> userColourSchemes = UserDefinedColours
+            .getUserColourSchemes();
+    if (userColourSchemes != null)
+    {
+      for (String userColour : userColourSchemes.keySet())
+    {
+        JMenuItem item = new JMenuItem(userColour);
+        item.addActionListener(new ActionListener()
+        {
+          @Override
+          public void actionPerformed(ActionEvent evt)
+          {
+            userDefinedColour_actionPerformed(evt);
+          }
+        });
+        colourMenu.add(item);
+      }
+    }
+    colourMenu.add(userDefinedColour);
+
+    colourMenu.addSeparator();
+    colourMenu.add(abovePIDColour);
+    colourMenu.add(conservationMenuItem);
+
+    /*
+     * add some of these items to a ButtonGroup so their
+     * selection is mutually exclusive
+     */
+    ButtonGroup colours = new ButtonGroup();
+    colours.add(noColourmenuItem);
+    colours.add(clustalColour);
+    colours.add(BLOSUM62Colour);
+    colours.add(PIDColour);
+    colours.add(zappoColour);
+    colours.add(taylorColour);
+    colours.add(hydrophobicityColour);
+    colours.add(helixColour);
+    colours.add(strandColour);
+    colours.add(turnColour);
+    colours.add(buriedColour);
+    colours.add(purinePyrimidineColour);
+    colours.add(tcoffeeColour);
+    colours.add(nucleotideColour);
+    colours.add(userDefinedColour);
+    colours.add(abovePIDColour);
+    // colours.add(RNAInteractionColour);
+
+  }
+
+  /**
    * Check for any annotations on the underlying dataset sequences (for the
    * current selection group) which are not 'on the alignment'.If any are found,
    * enable the option to add them to the alignment. The criteria for 'on the
@@ -1838,6 +1870,12 @@ public class PopupMenu extends JPopupMenu
     refresh();
   }
 
+  protected void tcoffeeColorScheme_actionPerformed()
+  {
+    getGroup().cs = new TCoffeeColourScheme(getGroup());
+    refresh();
+  }
+
   /*
    * protected void covariationColour_actionPerformed() { getGroup().cs = new
    * CovariationColourScheme(sequence.getAnnotation()[0]); refresh(); }
index 294596c..088ddfa 100755 (executable)
@@ -687,7 +687,7 @@ public class GAlignFrame extends JInternalFrame
       }
     });
     showNonconservedMenuItem.setText(MessageManager
-            .getString("label.show_non_conversed"));
+            .getString("label.show_non_conserved"));
     showNonconservedMenuItem.setState(false);
     showNonconservedMenuItem.addActionListener(new ActionListener()
     {
@@ -2471,8 +2471,7 @@ public class GAlignFrame extends JInternalFrame
      */
 
     conservationMenuItem = new JCheckBoxMenuItem(
-            MessageManager
-            .getString("action.by_conservation"));
+            MessageManager.getString("action.by_conservation"));
     conservationMenuItem.addActionListener(new ActionListener()
     {
       @Override