void setCursorPosition()
{
- SequenceI sequence = av.getAlignment().getSequenceAt(
- seqCanvas.cursorY);
+ SequenceI sequence = av.getAlignment().getSequenceAt(seqCanvas.cursorY);
seqCanvas.cursorX = sequence.findIndex(getKeyboardNo1()) - 1;
scrollToVisible();
void setSelectionAreaAtCursor(boolean topLeft)
{
- SequenceI sequence = av.getAlignment().getSequenceAt(
- seqCanvas.cursorY);
+ SequenceI sequence = av.getAlignment().getSequenceAt(seqCanvas.cursorY);
if (av.getSelectionGroup() != null)
{
mouseOverSequence(sequence, res, respos);
}
- StringBuffer text = new StringBuffer("Sequence " + (seq + 1) + " ID: "
- + sequence.getName());
+ StringBuilder text = new StringBuilder();
+ text.append("Sequence ").append(Integer.toString(seq + 1))
+ .append(" ID: ").append(sequence.getName());
- Object obj = null;
+ String obj = null;
+ final String ch = String.valueOf(sequence.getCharAt(res));
if (av.getAlignment().isNucleotide())
{
- obj = ResidueProperties.nucleotideName.get(sequence.getCharAt(res)
- + "");
+ obj = ResidueProperties.nucleotideName.get(ch);
if (obj != null)
{
- text.append(" Nucleotide: ");
+ text.append(" Nucleotide: ").append(obj);
}
}
else
{
- obj = ResidueProperties.aa2Triplet.get(sequence.getCharAt(res) + "");
+ obj = "X".equalsIgnoreCase(ch) ? "STOP"
+ : ResidueProperties.aa2Triplet.get(ch);
if (obj != null)
{
- text.append(" Residue: ");
+ text.append(" Residue: ").append(obj);
}
}
if (obj != null)
{
- if (obj != "")
- {
- text.append(obj + " (" + respos + ")");
- }
+ text.append(" (").append(Integer.toString(respos)).append(")");
}
ap.alignFrame.statusBar.setText(text.toString());
- StringBuffer tooltipText = new StringBuffer();
+ StringBuilder tooltipText = new StringBuilder();
SequenceGroup[] groups = av.getAlignment().findAllGroups(sequence);
if (groups != null)
{
if (!groups[g].getName().startsWith("JTreeGroup")
&& !groups[g].getName().startsWith("JGroup"))
{
- tooltipText.append(groups[g].getName() + " ");
+ tooltipText.append(groups[g].getName()).append(" ");
}
if (groups[g].getDescription() != null)
{
StringBuffer message = new StringBuffer();
if (groupEditing)
{
- message.append(MessageManager.getString("action.edit_group")).append(":");
+ message.append(MessageManager.getString("action.edit_group")).append(
+ ":");
if (editCommand == null)
{
- editCommand = new EditCommand(MessageManager.getString("action.edit_group"));
+ editCommand = new EditCommand(
+ MessageManager.getString("action.edit_group"));
}
}
else
{
- message.append(MessageManager.getString("label.edit_sequence")).append(" " + seq.getName());
+ message.append(MessageManager.getString("label.edit_sequence"))
+ .append(" " + seq.getName());
String label = seq.getName();
if (label.length() > 10)
{
}
if (editCommand == null)
{
- editCommand = new EditCommand(MessageManager.formatMessage("label.edit_params", new String[]{label}));
+ editCommand = new EditCommand(MessageManager.formatMessage(
+ "label.edit_params", new String[]
+ { label }));
}
}
}
else
{
- editCommand.appendEdit(Action.INSERT_GAP, groupSeqs,
- startres, startres - lastres, av.getAlignment(), true);
+ editCommand.appendEdit(Action.INSERT_GAP, groupSeqs, startres,
+ startres - lastres, av.getAlignment(), true);
}
}
else
}
else
{
- editCommand.appendEdit(Action.DELETE_GAP, groupSeqs,
- startres, lastres - startres, av.getAlignment(), true);
+ editCommand.appendEdit(Action.DELETE_GAP, groupSeqs, startres,
+ lastres - startres, av.getAlignment(), true);
}
}
editCommand.appendEdit(Action.DELETE_GAP, seq, blankColumn, 1,
av.getAlignment(), true);
- editCommand.appendEdit(Action.INSERT_GAP, seq, j, 1,
- av.getAlignment(), true);
+ editCommand.appendEdit(Action.INSERT_GAP, seq, j, 1, av.getAlignment(),
+ true);
}
void deleteChar(int j, SequenceI[] seq, int fixedColumn)
{
- editCommand.appendEdit(Action.DELETE_GAP, seq, j, 1,
- av.getAlignment(), true);
+ editCommand.appendEdit(Action.DELETE_GAP, seq, j, 1, av.getAlignment(),
+ true);
editCommand.appendEdit(Action.INSERT_GAP, seq, fixedColumn, 1,
av.getAlignment(), true);
int setStatusMessage(SequenceI sequence, int res, int seq)
{
int pos = -1;
- StringBuffer text = new StringBuffer("Sequence " + (seq + 1) + " ID: "
- + sequence.getName());
+ StringBuilder text = new StringBuilder(32);
+ text.append("Sequence " + (seq + 1) + " ID: " + sequence.getName());
- Object obj = null;
+ String residue = null;
+ /*
+ * Try to translate the display character to residue name (null for gap).
+ */
+ final String displayChar = String.valueOf(sequence.getCharAt(res));
if (av.getAlignment().isNucleotide())
{
- obj = ResidueProperties.nucleotideName.get(sequence.getCharAt(res)
- + "");
- if (obj != null)
+ residue = ResidueProperties.nucleotideName.get(displayChar);
+ if (residue != null)
{
- text.append(" Nucleotide: ");
+ text.append(" Nucleotide: ").append(residue);
}
}
else
{
- obj = ResidueProperties.aa2Triplet.get(sequence.getCharAt(res) + "");
- if (obj != null)
+ residue = "X".equalsIgnoreCase(displayChar) ? "STOP"
+ : ResidueProperties.aa2Triplet.get(displayChar);
+ if (residue != null)
{
- text.append(" Residue: ");
+ text.append(" Residue: ").append(residue);
}
}
- if (obj != null)
+ if (residue != null)
{
pos = sequence.findPosition(res);
- if (obj != "")
- {
- text.append(obj + " (" + pos + ")");
- }
+ text.append(" (").append(Integer.toString(pos)).append(")");
}
ap.alignFrame.statusBar.setText(text.toString());
return pos;