*/
public void highlightSearchResults(SearchResults results)
{
+ scrollToPosition(results);
seqPanel.seqCanvas.highlightSearchResults(results);
}
/**
* scroll the view to show the position of the highlighted region in results
+ * (if any) and redraw the overview
+ *
+ * @param results
+ * @return false if results were not found
+ */
+ public boolean scrollToPosition(SearchResults results)
+ {
+ return scrollToPosition(results, true);
+ }
+
+ /**
+ * scroll the view to show the position of the highlighted region in results
* (if any)
*
* @param results
+ * @param redrawOverview
+ * - when set, the overview will be recalculated (takes longer)
+ * @return false if results were not found
*/
- public void scrollToPosition(SearchResults results)
+ public boolean scrollToPosition(SearchResults results,
+ boolean redrawOverview)
{
// do we need to scroll the panel?
if (results != null && results.getSize() > 0)
int seqIndex = av.alignment.findIndex(results);
if (seqIndex == -1)
{
- return;
+ return false;
}
SequenceI seq = av.alignment.getSequenceAt(seqIndex);
int[] r = results.getResults(seq, seq.getStart(), seq.getEnd());
if (r == null)
{
- return;
+ return false;
}
int start = r[0];
int end = r[1];
if (start < 0)
{
- return;
+ return false;
}
if (end == seq.getEnd())
{
- return;
+ return false;
}
if (av.hasHiddenColumns)
{
start = av.getColumnSelection().findColumnPosition(start);
end = av.getColumnSelection().findColumnPosition(end);
- if (start==end)
+ if (start == end)
{
if (!av.colSel.isVisible(r[0]))
{
// don't scroll - position isn't visible
- return;
+ return false;
}
}
}
scrollToWrappedVisible(start);
}
}
-
- repaint();
+ if (redrawOverview && overviewPanel != null)
+ {
+ overviewPanel.setBoxPosition();
+ }
+ paintAlignment(redrawOverview);
+ return true;
}
void scrollToWrappedVisible(int res)