JAL-1432 updated copyright notices
[jalview.git] / src / jalview / appletgui / AppletJmol.java
index 7bf21a8..46f5b49 100644 (file)
@@ -1,19 +1,20 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, 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.appletgui;
 
@@ -26,11 +27,6 @@ import jalview.datamodel.*;
 import jalview.structure.*;
 import jalview.io.*;
 
-import org.jmol.api.*;
-
-import org.jmol.popup.*;
-import org.jmol.viewer.JmolConstants;
-
 import jalview.schemes.*;
 
 public class AppletJmol extends EmbmenuFrame implements
@@ -53,7 +49,7 @@ public class AppletJmol extends EmbmenuFrame implements
   CheckboxMenuItem seqColour = new CheckboxMenuItem("By Sequence", true);
 
   CheckboxMenuItem jmolColour = new CheckboxMenuItem("Using Jmol", false);
-  
+
   MenuItem chain = new MenuItem("By Chain");
 
   MenuItem charge = new MenuItem("Charge & Cysteine");
@@ -72,6 +68,8 @@ public class AppletJmol extends EmbmenuFrame implements
 
   MenuItem buried = new MenuItem("Buried Index");
 
+  MenuItem purinepyrimidine = new MenuItem("Purine/Pyrimidine");
+
   MenuItem user = new MenuItem("User Defined Colours");
 
   MenuItem jmolHelp = new MenuItem("Jmol Help");
@@ -85,6 +83,7 @@ public class AppletJmol extends EmbmenuFrame implements
   RenderPanel renderPanel;
 
   AlignmentPanel ap;
+
   ArrayList _aps = new ArrayList();
 
   String fileLoadingError;
@@ -132,10 +131,11 @@ public class AppletJmol extends EmbmenuFrame implements
           AlignmentPanel ap, String protocol)
   {
     this.ap = ap;
-    jmb = new AppletJmolBinding(this, ap.getStructureSelectionManager(), new PDBEntry[]
-    { pdbentry }, new SequenceI[][]
-    { seq }, new String[][]
-    { chains }, protocol);
+    jmb = new AppletJmolBinding(this, ap.getStructureSelectionManager(),
+            new PDBEntry[]
+            { pdbentry }, new SequenceI[][]
+            { seq }, new String[][]
+            { chains }, protocol);
     jmb.setColourBySequence(true);
     if (pdbentry.getId() == null || pdbentry.getId().length() < 1)
     {
@@ -157,13 +157,14 @@ public class AppletJmol extends EmbmenuFrame implements
     }
 
     String alreadyMapped = StructureSelectionManager
-            .getStructureSelectionManager(ap.av.applet).alreadyMappedToFile(
-                    pdbentry.getId());
+            .getStructureSelectionManager(ap.av.applet)
+            .alreadyMappedToFile(pdbentry.getId());
     MCview.PDBfile reader = null;
     if (alreadyMapped != null)
     {
-      reader = StructureSelectionManager.getStructureSelectionManager(ap.av.applet)
-              .setMapping(seq, chains, pdbentry.getFile(), protocol);
+      reader = StructureSelectionManager.getStructureSelectionManager(
+              ap.av.applet).setMapping(seq, chains, pdbentry.getFile(),
+              protocol);
       // PROMPT USER HERE TO ADD TO NEW OR EXISTING VIEW?
       // FOR NOW, LETS JUST OPEN A NEW WINDOW
     }
@@ -187,8 +188,9 @@ public class AppletJmol extends EmbmenuFrame implements
     strand.addActionListener(this);
     turn.addActionListener(this);
     buried.addActionListener(this);
+    purinepyrimidine.addActionListener(this);
     user.addActionListener(this);
-    
+
     jmolHelp.addActionListener(this);
 
     coloursMenu.add(seqColour);
@@ -201,6 +203,7 @@ public class AppletJmol extends EmbmenuFrame implements
     coloursMenu.add(strand);
     coloursMenu.add(turn);
     coloursMenu.add(buried);
+    coloursMenu.add(purinepyrimidine);
     coloursMenu.add(user);
     coloursMenu.add(jmolColour);
     helpMenu.add(jmolHelp);
@@ -383,8 +386,7 @@ public class AppletJmol extends EmbmenuFrame implements
       {
         for (int s = 0; s < jmb.pdbentry.length; s++)
         {
-          sb.append(jmb.printMapping(
-                          jmb.pdbentry[s].getFile()));
+          sb.append(jmb.printMapping(jmb.pdbentry[s].getFile()));
           sb.append("\n");
         }
         cap.setText(sb.toString());
@@ -444,6 +446,10 @@ public class AppletJmol extends EmbmenuFrame implements
       setEnabled(buried);
       jmb.setJalviewColourScheme(new BuriedColourScheme());
     }
+    else if (evt.getSource() == purinepyrimidine)
+    {
+      jmb.setJalviewColourScheme(new PurinePyrimidineColourScheme());
+    }
     else if (evt.getSource() == user)
     {
       setEnabled(user);
@@ -476,8 +482,8 @@ public class AppletJmol extends EmbmenuFrame implements
   }
 
   /**
-   * tick or untick the seqColour menu entry or jmoColour entry depending upon if it was selected
-   * or not.
+   * tick or untick the seqColour menu entry or jmoColour entry depending upon
+   * if it was selected or not.
    * 
    * @param itm
    */
@@ -494,8 +500,8 @@ public class AppletJmol extends EmbmenuFrame implements
     {
       setEnabled(jmolColour);
       jmb.setColourBySequence(false);
-    } else
-    if (evt.getSource() == seqColour)
+    }
+    else if (evt.getSource() == seqColour)
     {
       setEnabled(seqColour);
       jmb.colourBySequence(ap.av.getShowSequenceFeatures(), ap);
@@ -644,11 +650,11 @@ public class AppletJmol extends EmbmenuFrame implements
 
   public AlignmentPanel getAlignmentPanelFor(AlignmentI alignment)
   {
-    for (int i=0;i<_aps.size();i++)
+    for (int i = 0; i < _aps.size(); i++)
     {
-      if (((AlignmentPanel)_aps.get(i)).av.getAlignment()==alignment)
+      if (((AlignmentPanel) _aps.get(i)).av.getAlignment() == alignment)
       {
-        return ((AlignmentPanel)_aps.get(i));
+        return ((AlignmentPanel) _aps.get(i));
       }
     }
     return ap;