/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
- * Copyright (C) 2014 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
*
* This file is part of Jalview.
*
import jalview.commands.EditCommand.Edit;
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.SearchResults;
+import jalview.datamodel.SearchResults.Match;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceGroup;
seqCanvas.revalidate();
}
}
+ setStatusMessage(results);
seqCanvas.highlightSearchResults(results);
}
*/
int setStatusMessage(SequenceI sequence, int res, int seq)
{
- int pos = -1;
StringBuilder text = new StringBuilder(32);
- text.append("Sequence " + (seq + 1) + " ID: " + sequence.getName());
+
+ /*
+ * Sequence number (if known), and sequence name.
+ */
+ String seqno = seq == -1 ? "" : " " + (seq + 1);
+ text.append("Sequence" + seqno + " ID: " + sequence.getName());
String residue = null;
/*
}
else
{
- residue = "X".equalsIgnoreCase(displayChar) ? "STOP"
+ residue = "X".equalsIgnoreCase(displayChar) ? "X"
: ResidueProperties.aa2Triplet.get(displayChar);
if (residue != null)
{
}
}
+ int pos = -1;
if (residue != null)
{
pos = sequence.findPosition(res);
}
/**
+ * Set the status bar message to highlight the first matched position in
+ * search results.
+ *
+ * @param results
+ */
+ private void setStatusMessage(SearchResults results)
+ {
+ List<Match> matches = results.getResults();
+ if (!matches.isEmpty())
+ {
+ Match m = matches.get(0);
+ SequenceI seq = m.getSequence();
+ int sequenceIndex = this.av.getAlignment().findIndex(seq);
+
+ /*
+ * Convert position in sequence (base 1) to sequence character array index
+ * (base 0)
+ */
+ int start = m.getStart() - 1;
+ setStatusMessage(seq, start, sequenceIndex);
+ }
+ }
+
+ /**
* DOCUMENT ME!
*
* @param evt
fontSize = 1;
}
- av.setFont(new Font(av.font.getName(), av.font.getStyle(), fontSize));
+ av.setFont(
+ new Font(av.font.getName(), av.font.getStyle(), fontSize),
+ true);
av.setCharWidth(oldWidth);
ap.fontChanged();
}