Feature replaces new superGroup
authoramwaterhouse <Andrew Waterhouse>
Wed, 15 Feb 2006 15:18:41 +0000 (15:18 +0000)
committeramwaterhouse <Andrew Waterhouse>
Wed, 15 Feb 2006 15:18:41 +0000 (15:18 +0000)
src/jalview/appletgui/Finder.java

index ac7bc2c..fb8c280 100755 (executable)
@@ -31,7 +31,6 @@ public class Finder extends Panel implements ActionListener
   AlignViewport av;\r
   AlignmentPanel ap;\r
   Frame frame;\r
-  SuperGroup searchGroup;\r
 \r
   SearchResults searchResults;\r
 \r
@@ -84,36 +83,23 @@ public class Finder extends Panel implements ActionListener
 \r
   public void createNewGroup_actionPerformed()\r
   {\r
-    Color[] newColors = new Color[24];\r
-    for (int i = 0; i < 24; i++)\r
-    {\r
-      newColors[i] = new Color(60, 160, 115);\r
-    }\r
-\r
-    jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme(\r
-        newColors);\r
-    String searchString = textfield.getText();\r
-\r
-    searchGroup = new SuperGroup(searchString, ucs, true, true, false);\r
 \r
     for (int i = 0; i < searchResults.getSize(); i ++ )\r
     {\r
-      // its possible edits may have occurred since search was performed\r
-      // account for this here\r
-\r
-      SequenceI seq = searchResults.getResultSequence(i);\r
-      int startRes = seq.findIndex(searchResults.getResultStart(i)) - 1;\r
-            int endRes = seq.findIndex(searchResults.getResultEnd(i)) - 1;\r
+        SequenceI seq = searchResults.getResultSequence(i);\r
 \r
-      SequenceGroup sg = new SequenceGroup(searchString, ucs, true, true, false,\r
-                                           startRes, endRes);\r
-      sg.addSequence(seq, false);\r
-      av.alignment.addGroup(sg);\r
-      searchGroup.addGroup(sg);\r
+        SequenceFeature sf = new SequenceFeature(textfield.getText(),\r
+            "Search Results", null,\r
+            searchResults.getResultStart(i),\r
+           searchResults.getResultEnd(i));\r
 \r
+        ap.seqPanel.seqCanvas.getFeatureRenderer().addNewFeature(\r
+            textfield.getText(), new Color(60,160,115));\r
+        seq.addSequenceFeature(sf);\r
     }\r
 \r
-    ap.av.alignment.addSuperGroup(searchGroup);\r
+    ap.alignFrame.sequenceFeatures.setState(true);\r
+    av.showSequenceFeatures(true);\r
     ap.highlightSearchResults(null);\r
   }\r
 \r
@@ -321,7 +307,7 @@ public class Finder extends Panel implements ActionListener
       gridLayout1.setVgap(2);\r
       createNewGroup.setEnabled(false);\r
       createNewGroup.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
-      createNewGroup.setLabel("Create new group");\r
+      createNewGroup.setLabel("New Feature");\r
       createNewGroup.addActionListener(this);\r
       jPanel1.add(findNext, null);\r
       jPanel1.add(findAll, null);\r