X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FSeqPanel.java;h=78cb0a739a499342fc70063300d0f1e0833ce13d;hb=24680a271861e9309a2241c8884874656ac111b1;hp=a8397baa2ac7d8bc48f1649e66d8060883db4f4d;hpb=6b929eb6a01039353f35ce94c7606618e8d92284;p=jalview.git diff --git a/src/jalview/appletgui/SeqPanel.java b/src/jalview/appletgui/SeqPanel.java index a8397ba..78cb0a7 100644 --- a/src/jalview/appletgui/SeqPanel.java +++ b/src/jalview/appletgui/SeqPanel.java @@ -25,8 +25,9 @@ import jalview.commands.EditCommand; import jalview.commands.EditCommand.Action; import jalview.datamodel.AlignmentI; import jalview.datamodel.ColumnSelection; +import jalview.datamodel.SearchResultMatchI; import jalview.datamodel.SearchResults; -import jalview.datamodel.SearchResults.Match; +import jalview.datamodel.SearchResultsI; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceGroup; @@ -458,7 +459,7 @@ public class SeqPanel extends Panel implements MouseMotionListener, * @param results * @return true if results were matched, false if not */ - private boolean setStatusMessage(SearchResults results) + private boolean setStatusMessage(SearchResultsI results) { AlignmentI al = this.av.getAlignment(); int sequenceIndex = al.findIndex(results); @@ -467,7 +468,7 @@ public class SeqPanel extends Panel implements MouseMotionListener, return false; } SequenceI ds = al.getSequenceAt(sequenceIndex).getDatasetSequence(); - for (Match m : results.getResults()) + for (SearchResultMatchI m : results.getResults()) { SequenceI seq = m.getSequence(); if (seq.getDatasetSequence() != null) @@ -559,7 +560,7 @@ public class SeqPanel extends Panel implements MouseMotionListener, if (features != null && features.length > 0) { - SearchResults highlight = new SearchResults(); + SearchResultsI highlight = new SearchResults(); highlight.addResult(sequence, features[0].getBegin(), features[0].getEnd()); seqCanvas.highlightSearchResults(highlight); @@ -731,7 +732,7 @@ public class SeqPanel extends Panel implements MouseMotionListener, } @Override - public void highlightSequence(SearchResults results) + public void highlightSequence(SearchResultsI results) { if (av.isFollowHighlight()) { @@ -927,13 +928,6 @@ public class SeqPanel extends Panel implements MouseMotionListener, */ private boolean needOverviewUpdate; // TODO: refactor to avcontroller - /** - * set if av.getSelectionGroup() refers to a group that is defined on the - * alignment view, rather than a transient selection - */ - private boolean editingDefinedGroup = false; // TODO: refactor to avcontroller - // or viewModel - @Override public void mouseDragged(MouseEvent evt) { @@ -1431,21 +1425,12 @@ public class SeqPanel extends Panel implements MouseMotionListener, if (stretchGroup == null) { - stretchGroup = av.getAlignment().findGroup(sequence); - if (stretchGroup != null && res > stretchGroup.getStartRes() - && res < stretchGroup.getEndRes()) - { - av.setSelectionGroup(stretchGroup); - editingDefinedGroup = true; - } - else - { - stretchGroup = null; - editingDefinedGroup = false; - } + stretchGroup = av.getAlignment().findGroup(sequence, res); + av.setSelectionGroup(stretchGroup); } - else if (!stretchGroup.getSequences(null).contains(sequence) + if (stretchGroup == null + || !stretchGroup.getSequences(null).contains(sequence) || stretchGroup.getStartRes() > res || stretchGroup.getEndRes() < res) { @@ -1461,7 +1446,6 @@ public class SeqPanel extends Panel implements MouseMotionListener, && allGroups[i].getEndRes() >= res) { stretchGroup = allGroups[i]; - editingDefinedGroup = true; break; } } @@ -1517,17 +1501,16 @@ public class SeqPanel extends Panel implements MouseMotionListener, sg.setEndRes(res); sg.addSequence(sequence, false); av.setSelectionGroup(sg); - editingDefinedGroup = false; stretchGroup = sg; if (av.getConservationSelected()) { - SliderPanel.setConservationSlider(ap, av.getGlobalColourScheme(), + SliderPanel.setConservationSlider(ap, av.getViewportColourScheme(), "Background"); } if (av.getAbovePIDThreshold()) { - SliderPanel.setPIDSliderSource(ap, av.getGlobalColourScheme(), + SliderPanel.setPIDSliderSource(ap, av.getViewportColourScheme(), "Background"); } @@ -1543,7 +1526,8 @@ public class SeqPanel extends Panel implements MouseMotionListener, // always do this - annotation has own state // but defer colourscheme update until hidden sequences are passed in boolean vischange = stretchGroup.recalcConservation(true); - needOverviewUpdate |= vischange && editingDefinedGroup; + // here we rely on stretchGroup == av.getSelection() + needOverviewUpdate |= vischange && av.isSelectionDefinedGroup(); if (stretchGroup.cs != null) { stretchGroup.cs.alignmentChanged(stretchGroup, @@ -1562,8 +1546,7 @@ public class SeqPanel extends Panel implements MouseMotionListener, } PaintRefresher.Refresh(ap, av.getSequenceSetId()); ap.paintAlignment(needOverviewUpdate); - needOverviewUpdate =false; - editingDefinedGroup = false; + needOverviewUpdate = false; changeEndRes = false; changeStartRes = false; stretchGroup = null; @@ -1618,7 +1601,7 @@ public class SeqPanel extends Panel implements MouseMotionListener, if (res > (stretchGroup.getStartRes() - 1)) { stretchGroup.setEndRes(res); - needOverviewUpdate |= editingDefinedGroup; + needOverviewUpdate |= av.isSelectionDefinedGroup(); } } else if (changeStartRes) @@ -1626,7 +1609,7 @@ public class SeqPanel extends Panel implements MouseMotionListener, if (res < (stretchGroup.getEndRes() + 1)) { stretchGroup.setStartRes(res); - needOverviewUpdate |= editingDefinedGroup; + needOverviewUpdate |= av.isSelectionDefinedGroup(); } } @@ -1660,7 +1643,7 @@ public class SeqPanel extends Panel implements MouseMotionListener, if (stretchGroup.getSequences(null).contains(nextSeq)) { stretchGroup.deleteSequence(seq, false); - needOverviewUpdate |= editingDefinedGroup; + needOverviewUpdate |= av.isSelectionDefinedGroup(); } else { @@ -1670,7 +1653,7 @@ public class SeqPanel extends Panel implements MouseMotionListener, } stretchGroup.addSequence(nextSeq, false); - needOverviewUpdate |= editingDefinedGroup; + needOverviewUpdate |= av.isSelectionDefinedGroup(); } } @@ -1839,9 +1822,12 @@ public class SeqPanel extends Panel implements MouseMotionListener, // do we want to thread this ? (contention with seqsel and colsel locks, I // suspect) - // rules are: colsel is copied if there is a real intersection between - // sequence selection - boolean repaint = false, copycolsel = true; + /* + * only copy colsel if there is a real intersection between + * sequence selection and this panel's alignment + */ + boolean repaint = false; + boolean copycolsel = false; if (av.getSelectionGroup() == null || !av.isSelectionGroupChanged(true)) { SequenceGroup sgroup = null; @@ -1858,11 +1844,9 @@ public class SeqPanel extends Panel implements MouseMotionListener, } sgroup = seqsel.intersect(av.getAlignment(), (av.hasHiddenRows()) ? av.getHiddenRepSequences() : null); - if ((sgroup == null || sgroup.getSize() == 0) - && (colsel == null || colsel.isEmpty())) + if ((sgroup != null && sgroup.getSize() > 0)) { - // don't copy columns if the region didn't intersect. - copycolsel = false; + copycolsel = true; } } if (sgroup != null && sgroup.getSize() > 0) @@ -1990,7 +1974,6 @@ public class SeqPanel extends Panel implements MouseMotionListener, ColumnSelection cs = MappingUtils.mapColumnSelection(colsel, sourceAv, av); av.setColumnSelection(cs); - av.isColSelChanged(true); ap.scalePanelHolder.repaint(); ap.repaint();