Jar file 20% smaller
authoramwaterhouse <Andrew Waterhouse>
Thu, 22 Dec 2005 16:01:52 +0000 (16:01 +0000)
committeramwaterhouse <Andrew Waterhouse>
Thu, 22 Dec 2005 16:01:52 +0000 (16:01 +0000)
src/MCview/AppletPDBCanvas.java
src/MCview/AppletPDBViewer.java
src/MCview/Zsort.java

index d91d43e..b2b2c61 100755 (executable)
@@ -118,7 +118,7 @@ public class AppletPDBCanvas extends Panel implements MouseListener, MouseMotion
                     ((PDBChain) pdb.chains.elementAt(i)).sequence, "pep");\r
             as.calcScoreMatrix();\r
             as.traceAlignment();\r
-            PrintStream  ps = new PrintStream(System.out)\r
+            PrintStream ps = new PrintStream(System.out)\r
            {\r
               public void print(String x) {\r
                    mappingDetails.append(x);\r
index 2c0080e..e80178a 100755 (executable)
@@ -28,18 +28,13 @@ import java.awt.event.ActionListener;
 import java.awt.event.ActionEvent;\r
 \r
 \r
-public class AppletPDBViewer extends Frame\r
+public class AppletPDBViewer extends Frame implements ActionListener, ItemListener\r
 {\r
-      PDBEntry pdb;\r
-      Sequence sequence;\r
       AppletPDBCanvas pdbcanvas;\r
-\r
-\r
       public AppletPDBViewer(String pdbtext,String type,\r
                        Sequence seq,\r
                        SeqCanvas seqcanvas)\r
       {\r
-        sequence = seq;\r
 \r
         try\r
         {\r
@@ -54,7 +49,7 @@ public class AppletPDBViewer extends Frame
 \r
         add(pdbcanvas, BorderLayout.CENTER);\r
 \r
-        StringBuffer title = new StringBuffer(sequence.getName() + ":");\r
+        StringBuffer title = new StringBuffer(seq.getName() + ":");\r
 \r
         jalview.bin.JalviewLite.addFrame(this,title.toString(),400, 400);\r
 \r
@@ -68,144 +63,98 @@ public class AppletPDBViewer extends Frame
         }\r
       }\r
 \r
+      public void actionPerformed(ActionEvent evt)\r
+      {\r
+        if(evt.getSource()==mapping)\r
+               mapping_actionPerformed();\r
+       else if(evt.getSource()==wire)\r
+               wire_actionPerformed();\r
+       else if(evt.getSource()==depth)\r
+               depth_actionPerformed();\r
+       else if(evt.getSource()==zbuffer)\r
+               zbuffer_actionPerformed();\r
+       else if(evt.getSource()==charge)\r
+               charge_actionPerformed();\r
+\r
+       else if(evt.getSource()==chain)\r
+               chain_actionPerformed();\r
+       else if(evt.getSource()==seqButton)\r
+               seqButton_actionPerformed();\r
+       else if(evt.getSource()==zappo)\r
+                pdbcanvas.setColours(new ZappoColourScheme());\r
+       else if(evt.getSource()==taylor)\r
+               pdbcanvas.setColours(new TaylorColourScheme());\r
+      else if(evt.getSource()==hydro)\r
+               pdbcanvas.setColours(new HydrophobicColourScheme());\r
+      else if(evt.getSource()==helix)\r
+               pdbcanvas.setColours(new HelixColourScheme());\r
+       else if(evt.getSource()==strand)\r
+               pdbcanvas.setColours(new StrandColourScheme());\r
+       else if(evt.getSource()==turn)\r
+               pdbcanvas.setColours(new TurnColourScheme());\r
+       else if(evt.getSource()==buried)\r
+              pdbcanvas.setColours(new BuriedColourScheme());\r
+       else if(evt.getSource()==user)\r
+       {\r
+         pdbcanvas.bysequence = false;\r
+         new jalview.appletgui.UserDefinedColours(pdbcanvas);\r
+       }\r
+      }\r
+\r
+      public void itemStateChanged(ItemEvent evt)\r
+      {\r
+        if (evt.getSource() == allchains)\r
+          allchains_itemStateChanged();\r
+        else if (evt.getSource() == wire)\r
+          wire_actionPerformed();\r
+        else if (evt.getSource() == depth)\r
+          depth_actionPerformed();\r
+        else if (evt.getSource() == zbuffer)\r
+          zbuffer_actionPerformed();\r
+      }\r
+\r
 \r
       private void jbInit()\r
           throws Exception\r
       {\r
-        this.setMenuBar(jMenuBar1);\r
+        setMenuBar(jMenuBar1);\r
         fileMenu.setLabel("File");\r
         coloursMenu.setLabel("Colours");\r
         mapping.setLabel("View Mapping");\r
-        mapping.addActionListener(new ActionListener()\r
-        {\r
-          public void actionPerformed(ActionEvent e)\r
-          {\r
-            mapping_actionPerformed();\r
-          }\r
-        });\r
+        mapping.addActionListener(this);\r
         wire.setLabel("Wireframe");\r
-        wire.addItemListener(new ItemListener()\r
-        {\r
-          public void itemStateChanged(ItemEvent e)\r
-          {\r
-            wire_actionPerformed();\r
-          }\r
-        });\r
+        wire.addItemListener(this);\r
         depth.setState(true);\r
         depth.setLabel("Depthcue");\r
-        depth.addItemListener(new ItemListener()\r
-        {\r
-          public void itemStateChanged(ItemEvent e)\r
-          {\r
-            depth_actionPerformed();\r
-          }\r
-        });\r
+        depth.addItemListener(this);\r
         zbuffer.setState(true);\r
         zbuffer.setLabel("Z Buffering");\r
-        zbuffer.addItemListener(new ItemListener()\r
-        {\r
-          public void itemStateChanged(ItemEvent e)\r
-          {\r
-            zbuffer_actionPerformed();\r
-          }\r
-        });\r
+        zbuffer.addItemListener(this);\r
         charge.setLabel("Charge & Cysteine");\r
-        charge.addActionListener(new ActionListener()\r
-        {\r
-          public void actionPerformed(ActionEvent e)\r
-          {\r
-            charge_actionPerformed();\r
-          }\r
-        });\r
+        charge.addActionListener(this);\r
         hydro.setLabel("Hydrophobicity");\r
-        hydro.addActionListener(new ActionListener()\r
-        {\r
-          public void actionPerformed(ActionEvent e)\r
-          {\r
-            pdbcanvas.setColours(new HydrophobicColourScheme());\r
-          }\r
-        });\r
+        hydro.addActionListener(this);\r
         chain.setLabel("By Chain");\r
-        chain.addActionListener(new ActionListener()\r
-        {\r
-          public void actionPerformed(ActionEvent e)\r
-          {\r
-            chain_actionPerformed();\r
-          }\r
-        });\r
+        chain.addActionListener(this);\r
         seqButton.setLabel("By Sequence");\r
-        seqButton.addActionListener(new ActionListener()\r
-        {\r
-          public void actionPerformed(ActionEvent e){\r
-            seqButton_actionPerformed();\r
-          }\r
-        });\r
+        seqButton.addActionListener(this);\r
     allchains.setLabel("All Chains Visible");\r
-    allchains.addItemListener(new ItemListener()\r
-    {\r
-      public void itemStateChanged(ItemEvent itemEvent)\r
-      {\r
-        allchains_itemStateChanged(itemEvent);\r
-      }\r
-    });\r
+    allchains.addItemListener(this);\r
     viewMenu.setLabel("View");\r
     zappo.setLabel("Zappo");\r
-    zappo.addActionListener(new ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent actionEvent)\r
-      {\r
-        pdbcanvas.setColours(new ZappoColourScheme());\r
-      }\r
-    });\r
+    zappo.addActionListener(this);\r
     taylor.setLabel("Taylor");\r
-    taylor.addActionListener(new ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent actionEvent)\r
-      {\r
-        pdbcanvas.setColours(new TaylorColourScheme());\r
-      }\r
-    });\r
+    taylor.addActionListener(this);\r
     helix.setLabel("Helix Propensity");\r
-    helix.addActionListener(new ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent actionEvent)\r
-      {\r
-       pdbcanvas.setColours(new HelixColourScheme());\r
-      }\r
-    });\r
+    helix.addActionListener(this);\r
     strand.setLabel("Strand Propensity");\r
-    strand.addActionListener(new ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent actionEvent)\r
-      {\r
-        pdbcanvas.setColours(new StrandColourScheme());\r
-      }\r
-    });\r
+    strand.addActionListener(this);\r
     turn.setLabel("Turn Propensity");\r
-    turn.addActionListener(new ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent actionEvent)\r
-      {\r
-        pdbcanvas.setColours(new TurnColourScheme());\r
-      }\r
-    });\r
+    turn.addActionListener(this);\r
     buried.setLabel("Buried Index");\r
-    buried.addActionListener(new ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent actionEvent)\r
-      {\r
-        pdbcanvas.setColours(new BuriedColourScheme());\r
-      }\r
-    });\r
+    buried.addActionListener(this);\r
     user.setLabel("User Defined...");\r
-    user.addActionListener(new ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent actionEvent)\r
-      {\r
-        pdbcanvas.bysequence = false;\r
-        new jalview.appletgui.UserDefinedColours(pdbcanvas);\r
-      }\r
-    });\r
+    user.addActionListener(this);\r
     jMenuBar1.add(fileMenu);\r
         jMenuBar1.add(coloursMenu);\r
     jMenuBar1.add(viewMenu);\r
@@ -308,7 +257,7 @@ public class AppletPDBViewer extends Frame
         cap.setText(pdbcanvas.mappingDetails.toString());\r
       }\r
 \r
-      public void allchains_itemStateChanged(ItemEvent itemEvent)\r
+      public void allchains_itemStateChanged()\r
       {\r
         pdbcanvas.setAllchainsVisible(allchains.getState());\r
       }\r
index 322fd2a..1e7ac41 100755 (executable)
@@ -40,7 +40,7 @@ public class Zsort {
         float x = ((Bond) bonds.elementAt(p)).start[2];\r
         int i = p - 1;\r
         int j = r + 1;\r
-\r
+        Bond tmp;\r
         while (true) {\r
             do {\r
                 j = j - 1;\r
@@ -52,7 +52,7 @@ public class Zsort {
                     (((Bond) bonds.elementAt(i)).start[2] < x));\r
 \r
             if (i < j) {\r
-                Bond tmp = (Bond) bonds.elementAt(i);\r
+                tmp = (Bond) bonds.elementAt(i);\r
                 bonds.setElementAt(bonds.elementAt(j), i);\r
                 bonds.setElementAt(tmp, j);\r
             } else {\r