Merge branch 'JAL-1403' into develop
[jalview.git] / src / jalview / jbgui / GAlignFrame.java
index b53bcc3..a37746c 100755 (executable)
@@ -1,13 +1,13 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
  * Jalview is free software: you can redistribute it and/or
  * modify it under the terms of the GNU General Public License 
  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- * 
+ *  
  * Jalview is distributed in the hope that it will be useful, but 
  * WITHOUT ANY WARRANTY; without even the implied warranty 
  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
@@ -18,6 +18,7 @@
 package jalview.jbgui;
 
 import jalview.schemes.ColourSchemeProperty;
+import jalview.util.MessageManager;
 
 import java.awt.BorderLayout;
 import java.awt.Color;
@@ -145,8 +146,7 @@ public class GAlignFrame extends JInternalFrame
   // JRadioButtonMenuItem();
 
   protected JRadioButtonMenuItem tcoffeeColour = new JRadioButtonMenuItem();
-  
+
   JMenuItem njTreeBlosumMenuItem = new JMenuItem();
 
   JMenuItem avDistanceTreeBlosumMenuItem = new JMenuItem();
@@ -184,6 +184,9 @@ public class GAlignFrame extends JInternalFrame
   public JCheckBoxMenuItem showSeqFeaturesHeight = new JCheckBoxMenuItem();
 
   JMenuItem deleteGroups = new JMenuItem();
+  
+  JMenuItem createGroup = new JMenuItem();
+  JMenuItem unGroup = new JMenuItem();
 
   JMenuItem delete = new JMenuItem();
 
@@ -208,7 +211,7 @@ public class GAlignFrame extends JInternalFrame
   JMenuItem epsFile = new JMenuItem();
 
   JMenuItem LoadtreeMenuItem = new JMenuItem();
-  
+
   public JCheckBoxMenuItem scaleAbove = new JCheckBoxMenuItem();
 
   public JCheckBoxMenuItem scaleLeft = new JCheckBoxMenuItem();
@@ -407,8 +410,8 @@ public class GAlignFrame extends JInternalFrame
 
               int option = JOptionPane.showInternalConfirmDialog(
                       jalview.gui.Desktop.desktop,
-                      "Remove from default list?",
-                      "Remove user defined colour",
+                      MessageManager.getString("label.remove_from_default_list"),
+                      MessageManager.getString("label.remove_user_defined_colour"),
                       JOptionPane.YES_NO_OPTION);
               if (option == JOptionPane.YES_OPTION)
               {
@@ -525,10 +528,10 @@ public class GAlignFrame extends JInternalFrame
         nucleotideColour.setSelected(true);
 
         break;
-        
+
       case ColourSchemeProperty.TCOFFEE:
-       tcoffeeColour.setSelected(true);
-       break;
+        tcoffeeColour.setSelected(true);
+        break;
 
       case ColourSchemeProperty.PURINEPYRIMIDINE:
         purinePyrimidineColour.setSelected(true);
@@ -625,7 +628,7 @@ public class GAlignFrame extends JInternalFrame
                 invertSequenceMenuItem_actionPerformed(e);
               }
             });
-    grpsFromSelection.setText("Make Groups for selection");
+    grpsFromSelection.setText("Make Groups For Selection");
     grpsFromSelection.addActionListener(new java.awt.event.ActionListener()
     {
       public void actionPerformed(ActionEvent e)
@@ -813,7 +816,6 @@ public class GAlignFrame extends JInternalFrame
             });
     this.getContentPane().setLayout(borderLayout1);
     alignFrameMenuBar.setFont(new java.awt.Font("Verdana", 0, 11));
-    alignFrameMenuBar.setBackground(Color.lightGray);
     statusBar.setBackground(Color.white);
     statusBar.setFont(new java.awt.Font("Verdana", 0, 11));
     statusBar.setBorder(BorderFactory.createLineBorder(Color.black));
@@ -1192,18 +1194,19 @@ public class GAlignFrame extends JInternalFrame
         nucleotideColour_actionPerformed(e);
       }
     });
-    
+
     tcoffeeColour.setText("T-Coffee scores");
     tcoffeeColour.setEnabled(false);
-    tcoffeeColour.addActionListener( new ActionListener() {
-               
-               @Override
-               public void actionPerformed(ActionEvent e) {
-                       tcoffeeColorScheme_actionPerformed(e);
-               }
-       } );
-    
-    
+    tcoffeeColour.addActionListener(new ActionListener()
+    {
+
+      @Override
+      public void actionPerformed(ActionEvent e)
+      {
+        tcoffeeColorScheme_actionPerformed(e);
+      }
+    });
+
     deleteGroups.setText("Undefine groups");
     deleteGroups.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
             java.awt.event.KeyEvent.VK_U, Toolkit.getDefaultToolkit()
@@ -1215,6 +1218,28 @@ public class GAlignFrame extends JInternalFrame
         deleteGroups_actionPerformed(e);
       }
     });
+    createGroup.setText("Create group");
+    createGroup.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
+            java.awt.event.KeyEvent.VK_G, Toolkit.getDefaultToolkit()
+                    .getMenuShortcutKeyMask(), false));
+    createGroup.addActionListener(new java.awt.event.ActionListener()
+    {
+      public void actionPerformed(ActionEvent e)
+      {
+        createGroup_actionPerformed(e);
+      }
+    });
+    unGroup.setText("Remove Group");
+    unGroup.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
+            java.awt.event.KeyEvent.VK_G,Toolkit.getDefaultToolkit()
+                    .getMenuShortcutKeyMask() | java.awt.event.KeyEvent.SHIFT_MASK, false));
+    unGroup.addActionListener(new java.awt.event.ActionListener()
+    {
+      public void actionPerformed(ActionEvent e)
+      {
+        unGroup_actionPerformed(e);
+      }
+    });
     copy.setText("Copy");
     copy.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
             java.awt.event.KeyEvent.VK_C, Toolkit.getDefaultToolkit()
@@ -1316,7 +1341,7 @@ public class GAlignFrame extends JInternalFrame
       }
     });
     LoadtreeMenuItem.setActionCommand("Load a tree for this sequence set");
-    LoadtreeMenuItem.setText("Load Associated Tree"); 
+    LoadtreeMenuItem.setText("Load Associated Tree");
     LoadtreeMenuItem.addActionListener(new java.awt.event.ActionListener()
     {
       public void actionPerformed(ActionEvent e)
@@ -1324,7 +1349,7 @@ public class GAlignFrame extends JInternalFrame
         LoadtreeMenuItem_actionPerformed(e);
       }
     });
-    
+
     scaleAbove.setVisible(false);
     scaleAbove.setText("Scale Above");
     scaleAbove.addActionListener(new java.awt.event.ActionListener()
@@ -1533,9 +1558,10 @@ public class GAlignFrame extends JInternalFrame
       }
     });
     sortByTree.setText("Sort Alignment With New Tree");
-    sortByTree.setToolTipText("<html>Enable this to automatically sort<br>the alignment when you open<br> a new tree.");
-    sortByTree.setState(jalview.bin.Cache.getDefault(
-            "SORT_BY_TREE", false));
+    sortByTree
+            .setToolTipText("<html>Enable this to automatically sort<br>the alignment when you open<br> a new tree.");
+    sortByTree
+            .setState(jalview.bin.Cache.getDefault("SORT_BY_TREE", false));
     sortByTree.addActionListener(new ActionListener()
     {
       public void actionPerformed(ActionEvent e)
@@ -1545,8 +1571,9 @@ public class GAlignFrame extends JInternalFrame
     });
 
     listenToViewSelections.setText("Listen for selections");
-    listenToViewSelections.setToolTipText("<html>When selected, selections in this view will mirror<br>selections made on the same sequences in other views.");
-    listenToViewSelections.setState(false); 
+    listenToViewSelections
+            .setToolTipText("<html>When selected, selections in this view will mirror<br>selections made on the same sequences in other views.");
+    listenToViewSelections.setState(false);
     listenToViewSelections.addActionListener(new ActionListener()
     {
       public void actionPerformed(ActionEvent e)
@@ -1961,23 +1988,26 @@ public class GAlignFrame extends JInternalFrame
     selectMenu.add(deselectAllSequenceMenuItem);
     selectMenu.add(invertSequenceMenuItem);
     selectMenu.add(invertColSel);
-    selectMenu.add(deleteGroups);
+    selectMenu.add(createGroup);
+    selectMenu.add(unGroup);
     selectMenu.add(grpsFromSelection);
-    // TODO - determine if the listenToViewSelections button is needed : see bug JAL-574
-    //selectMenu.addSeparator();
-    //selectMenu.add(listenToViewSelections);
+    selectMenu.add(deleteGroups);
+    // TODO - determine if the listenToViewSelections button is needed : see bug
+    // JAL-574
+    // selectMenu.addSeparator();
+    // selectMenu.add(listenToViewSelections);
   }
 
   protected void normaliseSequenceLogo_actionPerformed(ActionEvent e)
   {
     // TODO Auto-generated method stub
-    
+
   }
 
   protected void listenToViewSelections_actionPerformed(ActionEvent e)
   {
     // TODO Auto-generated method stub
-    
+
   }
 
   protected void showAllhidden_actionPerformed(ActionEvent e)
@@ -2326,6 +2356,14 @@ public class GAlignFrame extends JInternalFrame
   protected void deleteGroups_actionPerformed(ActionEvent e)
   {
   }
+  
+  protected void createGroup_actionPerformed(ActionEvent e)
+  {
+  }
+  
+  protected void unGroup_actionPerformed(ActionEvent e)
+  {
+  }
 
   protected void copy_actionPerformed(ActionEvent e)
   {
@@ -2376,30 +2414,32 @@ public class GAlignFrame extends JInternalFrame
   {
 
   }
-  
+
   /**
-   * Template method to handle the 'load T-Coffee scores' menu event. 
+   * Template method to handle the 'load T-Coffee scores' menu event.
    * <p>
    * Subclasses override this method to provide a custom action.
-   *  
-   * @param event The raised event
+   * 
+   * @param event
+   *          The raised event
    */
-  protected void loadScores_actionPerformed(ActionEvent event) {
-          
+  protected void loadScores_actionPerformed(ActionEvent event)
+  {
+
   }
-  
 
   /**
-   * Template method to handle the 'Color T-Coffee scores' menu event. 
+   * Template method to handle the 'Color T-Coffee scores' menu event.
    * <p>
    * Subclasses override this method to provide a custom action.
-   *  
-   * @param event The raised event
+   * 
+   * @param event
+   *          The raised event
    */
-  protected void tcoffeeColorScheme_actionPerformed(ActionEvent event) {
-         
+  protected void tcoffeeColorScheme_actionPerformed(ActionEvent event)
+  {
+
   }
-  
 
   protected void jpred_actionPerformed(ActionEvent e)
   {