Conservation and PID colouring methods updated, also remove group added
authoramwaterhouse <Andrew Waterhouse>
Tue, 1 Feb 2005 19:03:04 +0000 (19:03 +0000)
committeramwaterhouse <Andrew Waterhouse>
Tue, 1 Feb 2005 19:03:04 +0000 (19:03 +0000)
src/jalview/gui/PopupMenu.java

index 722bad1..4ad7090 100755 (executable)
@@ -40,6 +40,7 @@ public class PopupMenu extends JPopupMenu
   JMenuItem annotateResidue = new JMenuItem();\r
 \r
   SequenceI sequence;\r
+  JMenuItem unGroupMenuItem = new JMenuItem();\r
 \r
   public PopupMenu(AlignmentPanel ap, SequenceI seq)\r
   {\r
@@ -104,9 +105,9 @@ public class PopupMenu extends JPopupMenu
 \r
       if (sg.cs instanceof ConservationColourScheme)\r
         conservationMenuItem.setSelected(true);\r
-\r
     }\r
 \r
+\r
     if(seq!=null)\r
     {\r
       residueMenu.setVisible(false);\r
@@ -180,10 +181,19 @@ public class PopupMenu extends JPopupMenu
     residueMenu.setText("Residue");\r
     annotateResidue.setText("annotate residue???");\r
     PIDColour.setFocusPainted(false);\r
+    unGroupMenuItem.setText("Remove Group");\r
+    unGroupMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+    {\r
+      public void actionPerformed(ActionEvent e)\r
+      {\r
+        unGroupMenuItem_actionPerformed(e);\r
+      }\r
+    });\r
     add(groupMenu);\r
     this.add(sequenceMenu);\r
     this.add(residueMenu);\r
     groupMenu.add(defineMenu);\r
+    groupMenu.add(unGroupMenuItem);\r
     groupMenu.addSeparator();\r
     groupMenu.add(copyGroup);\r
     groupMenu.add(moveGroup);\r
@@ -343,7 +353,8 @@ public class PopupMenu extends JPopupMenu
 \r
   protected void clustalColour_actionPerformed(ActionEvent e)\r
   {\r
-    getGroup().cs = new ClustalxColourScheme();\r
+    SequenceGroup sg = getGroup();\r
+    sg.cs = new ClustalxColourScheme(sg.sequences, ap.av.alignment.getWidth());\r
     refresh();\r
   }\r
 \r
@@ -391,26 +402,9 @@ public class PopupMenu extends JPopupMenu
   }\r
 \r
 \r
-/*\r
-public void conservationColourIncMenuItem_actionPerformed(ActionEvent e)\r
-{\r
-ConservationIncrementPanel cip = new ConservationIncrementPanel(viewport, alignPanel);\r
-JInternalFrame frame = new JInternalFrame();\r
-frame.setContentPane(cip);\r
-Desktop.addInternalFrame(frame, "Conservation Colour Increment", 400,90);\r
-frame.setMaximizable(false);\r
-\r
- }*/\r
-\r
-\r
   protected void abovePIDColour_actionPerformed(ActionEvent e)\r
   {\r
-    SliderPanel sp = new SliderPanel(ap, 70, false, getGroup().cs );\r
-    JInternalFrame frame = new JInternalFrame();\r
-    frame.setContentPane(sp);\r
-    Desktop.addInternalFrame(frame, "Percentage Identity Threshold ("+getGroup().getName()+")" , 400,90);\r
-    frame.setMaximizable(false);\r
-\r
+    Desktop.setPIDSliderSource(ap, getGroup().cs, getGroup().getName());\r
   }\r
 \r
 \r
@@ -448,15 +442,28 @@ frame.setMaximizable(false);
   {\r
     SequenceGroup sg = getGroup();\r
 \r
-    Conservation c = new Conservation("Group",\r
-                          ResidueProperties.propHash, 3, sg.sequences, sg.getStartRes(),\r
-                          sg.getEndRes() );\r
+    if(conservationMenuItem.isSelected())\r
+    {\r
+\r
+        Conservation c = new Conservation("Group",\r
+                                          ResidueProperties.propHash, 3,\r
+                                          sg.sequences, 0,\r
+                                          ap.av.alignment.getWidth());\r
 \r
-     c.calculate();\r
-     c.verdict(false, 100);\r
-     ConservationColourScheme ccs = new ConservationColourScheme(c, sg.cs);\r
+        c.calculate();\r
+        c.verdict(false, 100);\r
+        ConservationColourScheme ccs = new ConservationColourScheme(c, sg.cs);\r
 \r
-     sg.cs = ccs;\r
+\r
+      sg.cs = ccs;\r
+\r
+      Desktop.setConservationSliderSource(ap, ccs, sg.getName());\r
+    }\r
+    else // remove ConservationColouring\r
+    {\r
+        ConservationColourScheme ccs = (ConservationColourScheme)sg.cs;\r
+        sg.cs = ccs.cs;\r
+    }\r
 \r
      refresh();\r
   }\r
@@ -528,7 +535,7 @@ frame.setMaximizable(false);
 \r
     ap.av.alignment.deleteGroup(sg);\r
     ap.av.resetSeqLimits(ap.seqPanel.seqCanvas.getHeight());\r
-    ap.seqPanel.parent.RefreshPanels();\r
+    ap.RefreshPanels();\r
 \r
   }\r
 \r
@@ -582,4 +589,12 @@ frame.setMaximizable(false);
     }\r
 \r
   }\r
+\r
+  void unGroupMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+     SequenceGroup sg = ap.av.getRubberbandGroup();\r
+     ap.av.alignment.deleteGroup(sg);\r
+     ap.av.setRubberbandGroup(null);\r
+     ap.RefreshPanels();\r
+  }\r
 }\r