X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fgui%2FSeqPanel.java;h=1432fcb4e6688b30b4d7259b20ab882e37f1993c;hb=e0aacff0a162fdf1beb71cd5965b6ff4f8c9de0d;hp=e0b80fe73968e3b4a091d6db40d879e265418adb;hpb=76c239505d13a123cc83621623aaca16e47ddb12;p=jalview.git diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index e0b80fe..1432fcb 100644 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -59,6 +59,7 @@ import java.awt.event.MouseMotionListener; import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelListener; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import javax.swing.JPanel; @@ -1484,6 +1485,11 @@ public class SeqPanel extends JPanel implements MouseListener, } } + /** + * Handler for double-click on a position with one or more sequence features. + * Opens the Amend Features dialog to allow feature details to be amended, or + * the feature deleted. + */ @Override public void mouseClicked(MouseEvent evt) { @@ -1502,20 +1508,23 @@ public class SeqPanel extends JPanel implements MouseListener, .findFeaturesAtRes(sequence.getDatasetSequence(), sequence.findPosition(findRes(evt))); - if (features != null && features.size() > 0) + if (!features.isEmpty()) { + /* + * highlight the first feature at the position on the alignment + */ SearchResultsI highlight = new SearchResults(); highlight.addResult(sequence, features.get(0).getBegin(), features .get(0).getEnd()); seqCanvas.highlightSearchResults(highlight); - } - if (features != null && features.size() > 0) - { - seqCanvas.getFeatureRenderer().amendFeatures( - new SequenceI[] { sequence }, - features.toArray(new SequenceFeature[features.size()]), - false, ap); + /* + * open the Amend Features dialog; clear highlighting afterwards, + * whether changes were made or not + */ + List seqs = Collections.singletonList(sequence); + seqCanvas.getFeatureRenderer().amendFeatures(seqs, features, false, + ap, null); seqCanvas.highlightSearchResults(null); } } @@ -1956,9 +1965,20 @@ public class SeqPanel extends JPanel implements MouseListener, // shared between viewports. boolean iSentTheSelection = (av == source || (source instanceof AlignViewport && ((AlignmentViewport) source) .getSequenceSetId().equals(av.getSequenceSetId()))); - if (iSentTheSelection || !av.followSelection) + + if (iSentTheSelection) { - return; + // respond to our own event by updating dependent dialogs + if (ap.getCalculationDialog() != null) + { + ap.getCalculationDialog().validateCalcTypes(); + } + + // process further ? + if (!av.followSelection) + { + return; + } } /* @@ -2056,6 +2076,13 @@ public class SeqPanel extends JPanel implements MouseListener, PaintRefresher.Refresh(this, av.getSequenceSetId()); // ap.paintAlignment(false); } + + // lastly, update dependent dialogs + if (ap.getCalculationDialog() != null) + { + ap.getCalculationDialog().validateCalcTypes(); + } + } /** @@ -2095,6 +2122,12 @@ public class SeqPanel extends JPanel implements MouseListener, av); av.setColumnSelection(cs); + // lastly, update any dependent dialogs + if (ap.getCalculationDialog() != null) + { + ap.getCalculationDialog().validateCalcTypes(); + } + PaintRefresher.Refresh(this, av.getSequenceSetId()); return true;