Update PID or conservationSlider if necessary
authoramwaterhouse <Andrew Waterhouse>
Tue, 1 Feb 2005 19:03:56 +0000 (19:03 +0000)
committeramwaterhouse <Andrew Waterhouse>
Tue, 1 Feb 2005 19:03:56 +0000 (19:03 +0000)
src/jalview/gui/SeqPanel.java

index 7b3fae3..ab2e1ef 100755 (executable)
@@ -12,7 +12,7 @@ public class SeqPanel extends JPanel
 {\r
 \r
   public    SeqCanvas         seqCanvas;\r
-  public    AlignmentPanel    parent;\r
+  public    AlignmentPanel    ap;\r
 \r
   protected int startres;\r
   protected int lastres;\r
@@ -33,7 +33,7 @@ public class SeqPanel extends JPanel
     setLayout(new BorderLayout());\r
     add(seqCanvas, BorderLayout.CENTER);\r
 \r
-    parent = p;\r
+    ap = p;\r
 \r
     addMouseMotionListener( new MouseMotionAdapter()\r
     {\r
@@ -86,13 +86,13 @@ public class SeqPanel extends JPanel
 \r
     seqEditOccurred = -1;\r
 \r
-    parent.RefreshPanels();\r
+    ap.RefreshPanels();\r
     repaint();\r
 \r
   }\r
 \r
   public void doMousePressed(MouseEvent evt) {\r
-    parent.alignFrame.addHistoryItem("sequence edit");\r
+    ap.alignFrame.addHistoryItem("sequence edit");\r
     int seq;\r
     int res;\r
 \r
@@ -168,7 +168,7 @@ public class SeqPanel extends JPanel
     if(aa!="")\r
       text.append("  Residue: "+aa+" ("+  av.getAlignment().getSequenceAt(seq).findPosition(res)+")");\r
 \r
-    parent.alignFrame.statusBar.setText(text.toString());\r
+    ap.alignFrame.statusBar.setText(text.toString());\r
 \r
   }\r
 \r
@@ -362,10 +362,21 @@ public class SeqPanel extends JPanel
       sg.addSequence( (Sequence)av.getAlignment().getSequenceAt(seq) );\r
       av.setRubberbandGroup( sg );\r
       stretchGroup = sg;\r
+\r
+      if(av.getConservationSelected())\r
+        Desktop.setConservationSliderSource(ap, av.getGlobalColourScheme(), "Background");\r
+      else if(av.getGlobalColourScheme()!=null && av.getGlobalColourScheme().canThreshold())\r
+      {\r
+        ResidueColourScheme rcs = (ResidueColourScheme) av.getGlobalColourScheme();\r
+        int threshold = rcs.getThreshold();\r
+        if (threshold > 0)\r
+          Desktop.setPIDSliderSource(ap, av.getGlobalColourScheme(), "Background");\r
+      }\r
+\r
     }\r
     else if( javax.swing.SwingUtilities.isRightMouseButton(evt))\r
     {\r
-        jalview.gui.PopupMenu pop = new jalview.gui.PopupMenu( parent , null);\r
+        jalview.gui.PopupMenu pop = new jalview.gui.PopupMenu( ap , null);\r
         pop.show(this, evt.getX(), evt.getY());\r
 \r
     // edit the properties of existing group\r
@@ -393,6 +404,47 @@ public class SeqPanel extends JPanel
 \r
   public void doMouseReleasedDefineMode(MouseEvent evt)\r
   {\r
+\r
+    if(stretchGroup.cs instanceof ClustalxColourScheme)\r
+    {\r
+      stretchGroup.cs = new ClustalxColourScheme(stretchGroup.sequences, av.alignment.getWidth());\r
+      seqCanvas.paintFlag = true;\r
+      repaint();\r
+    }\r
+\r
+    else if(stretchGroup.cs instanceof ConservationColourScheme)\r
+    {\r
+      ConservationColourScheme ccs = (ConservationColourScheme)stretchGroup.cs;\r
+\r
+      Conservation c = new Conservation("Group",\r
+                                        ResidueProperties.propHash, 3, stretchGroup.sequences, 0,\r
+                                        av.alignment.getWidth() );\r
+\r
+       c.calculate();\r
+       c.verdict(false, 100);\r
+       ccs = new ConservationColourScheme(c, ccs.cs);\r
+\r
+       stretchGroup.cs = ccs;\r
+\r
+\r
+       Desktop.setConservationSliderSource(ap, stretchGroup.cs, stretchGroup.getName()) ;\r
+\r
+       seqCanvas.paintFlag = true;\r
+       repaint();\r
+    }\r
+    else\r
+    {\r
+      if(stretchGroup.cs !=null && stretchGroup.cs.canThreshold())\r
+      {\r
+        ResidueColourScheme rcs =  (ResidueColourScheme) stretchGroup.cs;\r
+        int threshold = rcs.getThreshold();\r
+        if(threshold>0)\r
+          Desktop.setPIDSliderSource(ap, stretchGroup.cs, stretchGroup.getName());\r
+      }\r
+\r
+    }\r
+\r
+\r
     changeEndRes = false;\r
     changeStartRes = false;\r
     stretchGroup = null;\r
@@ -411,7 +463,7 @@ public class SeqPanel extends JPanel
       changeEndRes = true;\r
 \r
     else if(stretchGroup.getStartRes()==res)\r
-      // Edit end res position of selected group\r
+      // Edit start res position of selected group\r
       changeStartRes = true;\r
 \r
 \r