From: amwaterhouse Date: Wed, 15 Feb 2006 15:24:50 +0000 (+0000) Subject: Set as feature, not new group X-Git-Tag: Root_VamJalview_2_07b+~130 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=8302463adc038c6385cde595bcb3a7ef5b2fd07c;p=jalview.git Set as feature, not new group --- diff --git a/src/jalview/gui/Finder.java b/src/jalview/gui/Finder.java index 5f215ed..5d800ce 100755 --- a/src/jalview/gui/Finder.java +++ b/src/jalview/gui/Finder.java @@ -42,7 +42,6 @@ public class Finder extends GFinder AlignViewport av; AlignmentPanel ap; JInternalFrame frame; - SuperGroup searchGroup; int seqIndex = 0; int resIndex = 0; @@ -109,34 +108,36 @@ public class Finder extends GFinder */ public void createNewGroup_actionPerformed(ActionEvent e) { - Color[] newColors = new Color[24]; - - for (int i = 0; i < 24; i++) - { - newColors[i] = new Color(60, 160, 115); - } + JLabel label = new JLabel("Enter name of new sequence feature"); + JTextField textinput = new JTextField(textfield.getText()); + JPanel panel = new JPanel(new BorderLayout()); + panel.add(label, BorderLayout.NORTH); + panel.add(textinput, BorderLayout.SOUTH); - jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme(newColors); - String searchString = textfield.getText(); + int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop, + panel, "New Sequence Feature Name", + JOptionPane.OK_CANCEL_OPTION ); - searchGroup = new SuperGroup(searchString, ucs, true, true, false); + if(reply != JOptionPane.OK_OPTION) + return; for (int i = 0; i < searchResults.getSize(); i ++ ) { - // its possible edits may have occurred since search was performed - // account for this here SequenceI seq = searchResults.getResultSequence(i); - int startRes = seq.findIndex(searchResults.getResultStart(i)) - 1; - int endRes = seq.findIndex(searchResults.getResultEnd(i)) - 1; - - SequenceGroup sg = new SequenceGroup(searchString, ucs, true, true, - false, startRes, endRes); - sg.addSequence(seq, false); - av.alignment.addGroup(sg); - searchGroup.addGroup(sg); + + SequenceFeature sf = new SequenceFeature(textinput.getText(), + "Search Results", null, + searchResults.getResultStart(i), + searchResults.getResultEnd(i)); + + ap.seqPanel.seqCanvas.getFeatureRenderer().addNewFeature( + textinput.getText(), new Color(60,160,115)); + + seq.getDatasetSequence().addSequenceFeature(sf); } - ap.av.alignment.addSuperGroup(searchGroup); + ap.alignFrame.sequenceFeatures.setSelected(true); + ap.alignFrame.sequenceFeatures_actionPerformed(null); ap.highlightSearchResults(null); } @@ -191,7 +192,7 @@ public class Finder extends GFinder jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme(newColors); - searchGroup = new SuperGroup(searchString, ucs, true, true, false); + //SG searchGroup = new SuperGroup(searchString, ucs, true, true, false); int end = av.alignment.getHeight();