use of eu.isas.peptideshaker.utils.DisplayFeaturesGenerator in project peptide-shaker by compomics.
the class SpectrumIdentificationPanel method spectrumTableMouseMoved.
// GEN-LAST:event_spectrumTableKeyReleased
/**
* Changes the cursor into a hand cursor if the table cell contains an HTML
* link. Or shows a tooltip with modification details is over the sequence
* column.
*
* @param evt
*/
private void spectrumTableMouseMoved(java.awt.event.MouseEvent evt) {
// GEN-FIRST:event_spectrumTableMouseMoved
int row = spectrumTable.rowAtPoint(evt.getPoint());
int column = spectrumTable.columnAtPoint(evt.getPoint());
if (spectrumTable.getValueAt(row, column) != null) {
if (column == spectrumTable.getColumn("Protein(s)").getModelIndex()) {
String tempValue = (String) spectrumTable.getValueAt(row, column);
if (tempValue.lastIndexOf("a href=") != -1) {
this.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
} else {
this.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
}
spectrumTable.setToolTipText(null);
} else if (column == spectrumTable.getColumn("Sequence").getModelIndex()) {
this.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
int spectrumIndex = spectrumTable.convertRowIndexToModel(row);
String spectrumTitle = peptideShakerGUI.getSpectrumProvider().getSpectrumTitles(fileSelected)[spectrumIndex];
long spectrumMatchKey = SpectrumMatch.getKey(fileSelected, spectrumTitle);
// check if we ought to show a tooltip with mod details
DisplayFeaturesGenerator displayFeaturesGenerator = peptideShakerGUI.getDisplayFeaturesGenerator();
SpectrumMatch spectrumMatch = identification.getSpectrumMatch(spectrumMatchKey);
if (spectrumMatch.getBestPeptideAssumption() != null) {
String tooltip = displayFeaturesGenerator.getPeptideModificationTooltipAsHtml(spectrumMatch);
spectrumTable.setToolTipText(tooltip);
} else if (spectrumMatch.getBestTagAssumption() != null) {
TagAssumption tagAssumption = spectrumMatch.getBestTagAssumption();
spectrumTable.setToolTipText(peptideShakerGUI.getDisplayFeaturesGenerator().getTagModificationTooltipAsHtml(tagAssumption.getTag()));
} else {
throw new IllegalArgumentException("No best match found for spectrum " + spectrumMatch.getKey() + ".");
}
} else {
this.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
spectrumTable.setToolTipText(null);
}
}
}
Aggregations