JAL-1432 updated copyright notices
[jalview.git] / src / jalview / jbgui / GAlignFrame.java
index 439a67d..d991950 100755 (executable)
@@ -1,29 +1,52 @@
 /*
- * 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.0b1)
+ * Copyright (C) 2014 The Jalview Authors
  * 
  * 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 
  * PURPOSE.  See the GNU General Public License for more details.
  * 
  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
  */
 package jalview.jbgui;
 
-import java.awt.*;
-import java.awt.event.*;
-
-import javax.swing.*;
-import javax.swing.event.*;
-
-import jalview.schemes.*;
+import jalview.schemes.ColourSchemeProperty;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.GridLayout;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.FocusAdapter;
+import java.awt.event.FocusEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+
+import javax.swing.BorderFactory;
+import javax.swing.ButtonGroup;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JInternalFrame;
+import javax.swing.JLabel;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JRadioButtonMenuItem;
+import javax.swing.JTabbedPane;
+import javax.swing.SwingUtilities;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.MenuEvent;
+import javax.swing.event.MenuListener;
 
 public class GAlignFrame extends JInternalFrame
 {
@@ -120,6 +143,8 @@ public class GAlignFrame extends JInternalFrame
   // protected JRadioButtonMenuItem covariationColour = new
   // JRadioButtonMenuItem();
 
+  protected JRadioButtonMenuItem tcoffeeColour = new JRadioButtonMenuItem();
+
   JMenuItem njTreeBlosumMenuItem = new JMenuItem();
 
   JMenuItem avDistanceTreeBlosumMenuItem = new JMenuItem();
@@ -216,7 +241,7 @@ public class GAlignFrame extends JInternalFrame
 
   protected JMenu showProducts = new JMenu();
 
-  public JMenuItem featureSettings = new JMenuItem();
+  public JMenuItem openFeatureSettings = new JMenuItem();
 
   JMenuItem fetchSequence = new JMenuItem();
 
@@ -428,6 +453,7 @@ public class GAlignFrame extends JInternalFrame
     colours.add(nucleotideColour);
     colours.add(purinePyrimidineColour);
     // colours.add(covariationColour);
+    colours.add(tcoffeeColour);
 
     setColourSelected(jalview.bin.Cache
             .getDefault("DEFAULT_COLOUR", "None"));
@@ -498,6 +524,10 @@ public class GAlignFrame extends JInternalFrame
 
         break;
 
+      case ColourSchemeProperty.TCOFFEE:
+        tcoffeeColour.setSelected(true);
+        break;
+
       case ColourSchemeProperty.PURINEPYRIMIDINE:
         purinePyrimidineColour.setSelected(true);
 
@@ -1146,6 +1176,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);
+      }
+    });
+
     deleteGroups.setText("Undefine groups");
     deleteGroups.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
             java.awt.event.KeyEvent.VK_U, Toolkit.getDefaultToolkit()
@@ -1266,6 +1309,7 @@ public class GAlignFrame extends JInternalFrame
         LoadtreeMenuItem_actionPerformed(e);
       }
     });
+
     scaleAbove.setVisible(false);
     scaleAbove.setText("Scale Above");
     scaleAbove.addActionListener(new java.awt.event.ActionListener()
@@ -1420,8 +1464,8 @@ public class GAlignFrame extends JInternalFrame
      * public void actionPerformed(ActionEvent e) {
      * showProducts_actionPerformed(e); } });
      */
-    featureSettings.setText("Feature Settings...");
-    featureSettings.addActionListener(new ActionListener()
+    openFeatureSettings.setText("Feature Settings...");
+    openFeatureSettings.addActionListener(new ActionListener()
     {
       public void actionPerformed(ActionEvent e)
       {
@@ -1474,9 +1518,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)
@@ -1486,8 +1531,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)
@@ -1804,7 +1850,7 @@ public class GAlignFrame extends JInternalFrame
     viewMenu.add(showSeqFeatures);
     // viewMenu.add(showSeqFeaturesHeight);
 
-    viewMenu.add(featureSettings);
+    viewMenu.add(openFeatureSettings);
     tooltipSettingsMenu.add(showDbRefsMenuitem);
     tooltipSettingsMenu.add(showNpFeatsMenuitem);
     viewMenu.add(tooltipSettingsMenu);
@@ -1829,6 +1875,7 @@ public class GAlignFrame extends JInternalFrame
     colourMenu.add(nucleotideColour);
     colourMenu.add(purinePyrimidineColour);
     // colourMenu.add(covariationColour);
+    colourMenu.add(tcoffeeColour);
     colourMenu.add(userDefinedColour);
     colourMenu.addSeparator();
     colourMenu.add(conservationMenuItem);
@@ -1902,21 +1949,22 @@ public class GAlignFrame extends JInternalFrame
     selectMenu.add(invertColSel);
     selectMenu.add(deleteGroups);
     selectMenu.add(grpsFromSelection);
-    // TODO - determine if the listenToViewSelections button is needed : see bug JAL-574
-    //selectMenu.addSeparator();
-    //selectMenu.add(listenToViewSelections);
+    // 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)
@@ -2308,6 +2356,33 @@ public class GAlignFrame extends JInternalFrame
 
   protected void LoadtreeMenuItem_actionPerformed(ActionEvent e)
   {
+
+  }
+
+  /**
+   * 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
+   */
+  protected void loadScores_actionPerformed(ActionEvent 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
+   */
+  protected void tcoffeeColorScheme_actionPerformed(ActionEvent event)
+  {
+
   }
 
   protected void jpred_actionPerformed(ActionEvent e)