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;
}
}
+ /**
+ * 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)
{
.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<SequenceI> seqs = Collections.singletonList(sequence);
+ seqCanvas.getFeatureRenderer().amendFeatures(seqs, features, false,
+ ap, null);
seqCanvas.highlightSearchResults(null);
}
}
*
* @param evt
* @param res
- * @param sequence
+ * @param sequences
*/
void showPopupMenu(MouseEvent evt)
{
// 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;
+ }
}
/*
PaintRefresher.Refresh(this, av.getSequenceSetId());
// ap.paintAlignment(false);
}
+
+ // lastly, update dependent dialogs
+ if (ap.getCalculationDialog() != null)
+ {
+ ap.getCalculationDialog().validateCalcTypes();
+ }
+
}
/**
av);
av.setColumnSelection(cs);
+ // lastly, update any dependent dialogs
+ if (ap.getCalculationDialog() != null)
+ {
+ ap.getCalculationDialog().validateCalcTypes();
+ }
+
PaintRefresher.Refresh(this, av.getSequenceSetId());
return true;