From ddf3aca722d27da4bd2c58e9f0ab0909ba9639c0 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Tue, 21 Nov 2006 12:48:29 +0000 Subject: [PATCH] Highlight feature to edit --- src/jalview/gui/FeatureRenderer.java | 20 +++++++++++++++----- src/jalview/gui/SeqPanel.java | 4 ++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/jalview/gui/FeatureRenderer.java b/src/jalview/gui/FeatureRenderer.java index eb09af6..b584d89 100755 --- a/src/jalview/gui/FeatureRenderer.java +++ b/src/jalview/gui/FeatureRenderer.java @@ -423,13 +423,14 @@ public class FeatureRenderer public boolean createNewFeatures(SequenceI[] sequences, SequenceFeature [] features) { - return amendFeatures(sequences, features, true); + return amendFeatures(sequences, features, true, null); } int featureIndex = 0; - boolean amendFeatures(SequenceI[] sequences, - final SequenceFeature [] features, - boolean newFeatures) + boolean amendFeatures(final SequenceI[] sequences, + final SequenceFeature[] features, + boolean newFeatures, + final AlignmentPanel ap) { JPanel bigPanel = new JPanel(new BorderLayout()); final JComboBox name = new JComboBox(); @@ -567,6 +568,14 @@ public class FeatureRenderer getColour(name.getSelectedItem().toString())); colour.setForeground( getColour(name.getSelectedItem().toString())); + + SearchResults highlight = new SearchResults(); + highlight.addResult(sequences[0], + features[index].getBegin(), + features[index].getEnd()); + + ap.seqPanel.seqCanvas.highlightSearchResults(highlight); + } } }); @@ -581,7 +590,8 @@ public class FeatureRenderer options = new Object[]{"OK", "Cancel"}; String title = newFeatures ? "Create New Sequence Feature(s)" : - "Amend/Delete Features"; + "Amend/Delete Features for " + +sequences[0].getName(); int reply = JOptionPane.showInternalOptionDialog(Desktop.desktop, bigPanel, diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index 3349825..06aa087 100755 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -1232,7 +1232,7 @@ public class SeqPanel extends JPanel implements MouseListener, sequence.findPosition( findRes(evt) ) ); - if(features!=null && features.length==1) + if(features!=null && features.length>0) { SearchResults highlight = new SearchResults(); highlight.addResult(sequence, @@ -1244,7 +1244,7 @@ public class SeqPanel extends JPanel implements MouseListener, { seqCanvas.getFeatureRenderer().amendFeatures( new SequenceI[] - {sequence}, features, false); + {sequence}, features, false, ap); seqCanvas.highlightSearchResults(null); } -- 1.7.10.2