Set as feature, not new group
authoramwaterhouse <Andrew Waterhouse>
Wed, 15 Feb 2006 15:24:50 +0000 (15:24 +0000)
committeramwaterhouse <Andrew Waterhouse>
Wed, 15 Feb 2006 15:24:50 +0000 (15:24 +0000)
src/jalview/gui/Finder.java

index 5f215ed..5d800ce 100755 (executable)
@@ -42,7 +42,6 @@ public class Finder extends GFinder
     AlignViewport av;\r
     AlignmentPanel ap;\r
     JInternalFrame frame;\r
-    SuperGroup searchGroup;\r
     int seqIndex = 0;\r
     int resIndex = 0;\r
 \r
@@ -109,34 +108,36 @@ public class Finder extends GFinder
      */\r
     public void createNewGroup_actionPerformed(ActionEvent e)\r
     {\r
-        Color[] newColors = new Color[24];\r
-\r
-        for (int i = 0; i < 24; i++)\r
-        {\r
-            newColors[i] = new Color(60, 160, 115);\r
-        }\r
+        JLabel label = new JLabel("Enter name of new sequence feature");\r
+        JTextField textinput = new JTextField(textfield.getText());\r
+        JPanel panel = new JPanel(new BorderLayout());\r
+        panel.add(label, BorderLayout.NORTH);\r
+        panel.add(textinput, BorderLayout.SOUTH);\r
 \r
-        jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme(newColors);\r
-        String searchString = textfield.getText();\r
+         int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop,\r
+            panel, "New Sequence Feature Name",\r
+          JOptionPane.OK_CANCEL_OPTION );\r
 \r
-        searchGroup = new SuperGroup(searchString, ucs, true, true, false);\r
+         if(reply != JOptionPane.OK_OPTION)\r
+           return;\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
             SequenceI seq = searchResults.getResultSequence(i);\r
-            int startRes = seq.findIndex(searchResults.getResultStart(i)) - 1;\r
-            int endRes = seq.findIndex(searchResults.getResultEnd(i)) - 1;\r
-\r
-            SequenceGroup sg = new SequenceGroup(searchString, ucs, true, true,\r
-                    false, startRes, endRes);\r
-            sg.addSequence(seq, false);\r
-            av.alignment.addGroup(sg);\r
-            searchGroup.addGroup(sg);\r
+\r
+            SequenceFeature sf = new SequenceFeature(textinput.getText(),\r
+                "Search Results", null,\r
+                searchResults.getResultStart(i),\r
+               searchResults.getResultEnd(i));\r
+\r
+            ap.seqPanel.seqCanvas.getFeatureRenderer().addNewFeature(\r
+                textinput.getText(), new Color(60,160,115));\r
+\r
+            seq.getDatasetSequence().addSequenceFeature(sf);\r
         }\r
 \r
-        ap.av.alignment.addSuperGroup(searchGroup);\r
+        ap.alignFrame.sequenceFeatures.setSelected(true);\r
+        ap.alignFrame.sequenceFeatures_actionPerformed(null);\r
         ap.highlightSearchResults(null);\r
     }\r
 \r
@@ -191,7 +192,7 @@ public class Finder extends GFinder
 \r
         jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme(newColors);\r
 \r
-        searchGroup = new SuperGroup(searchString, ucs, true, true, false);\r
+      //SG  searchGroup = new SuperGroup(searchString, ucs, true, true, false);\r
 \r
         int end = av.alignment.getHeight();\r
 \r