From 8302463adc038c6385cde595bcb3a7ef5b2fd07c Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Wed, 15 Feb 2006 15:24:50 +0000 Subject: [PATCH] Set as feature, not new group --- src/jalview/gui/Finder.java | 45 ++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 22 deletions(-) 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(); -- 1.7.10.2