import jalview.datamodel.SequenceI;
import jalview.renderer.AnnotationRenderer;
import jalview.renderer.AwtRenderPanelI;
+import jalview.schemes.ResidueProperties;
import jalview.util.Comparison;
import jalview.util.MessageManager;
+import jalview.util.Platform;
import java.awt.Color;
import java.awt.Dimension;
public AnnotationPanel(AlignmentPanel ap)
{
- MAC = new jalview.util.Platform().isAMac();
+ new jalview.util.Platform();
+ MAC = Platform.isAMac();
this.ap = ap;
av = ap.av;
setLayout(null);
if (evt.getActionCommand().equals(REMOVE))
{
- for (int sel : av.getColumnSelection().getSelected())
+ for (int index : av.getColumnSelection().getSelected())
{
- // TODO: JAL-2001 check if applet has faulty 'REMOVE' selected columns
- // of
- // annotation if selection includes hidden columns
- anot[sel] = null;
+ if (av.getColumnSelection().isVisible(index))
+ {
+ anot[index] = null;
+ }
}
}
else if (evt.getActionCommand().equals(LABEL))
else if (evt.getActionCommand().equals(STEM))
{
type = 'S';
- symbol = "(";// "\u03C3"; sigma
+ int column = av.getColumnSelection().getSelectedRanges().get(0)[0];
+ symbol = aa[activeRow].getDefaultRnaHelixSymbol(column);
}
- symbol = getCurrentAnnotationCharacter(anot, symbol);
-
if (!aa[activeRow].hasIcons)
{
aa[activeRow].hasIcons = true;
}
}
- int column = evt.getX() / av.getCharWidth() + av.getStartRes();
+ int column = evt.getX() / av.getCharWidth()
+ + av.getRanges().getStartRes();
if (av.hasHiddenColumns())
{
StringBuilder text = new StringBuilder();
text.append(MessageManager.getString("label.column")).append(" ")
.append(column + 1);
- if (aa[row].annotations[column].description != null)
+ String description = aa[row].annotations[column].description;
+ if (description != null && description.length() > 0)
{
- text.append(" ").append(aa[row].annotations[column].description);
+ text.append(" ").append(description);
}
/*
char residue = seqref.getCharAt(column);
if (!Comparison.isGap(residue))
{
+ text.append(" ");
+ String name;
+ if (av.getAlignment().isNucleotide())
+ {
+ name = ResidueProperties.nucleotideName.get(String
+ .valueOf(residue));
+ text.append(" Nucleotide: ").append(
+ name != null ? name : residue);
+ }
+ else
+ {
+ name = 'X' == residue ? "X" : ('*' == residue ? "STOP"
+ : ResidueProperties.aa2Triplet.get(String
+ .valueOf(residue)));
+ text.append(" Residue: ").append(
+ name != null ? name : residue);
+ }
int residuePos = seqref.findPosition(column);
- text.append(": ").append(residue).append(" (")
- .append(residuePos).append(")");
+ text.append(" (").append(residuePos).append(")");
+ // int residuePos = seqref.findPosition(column);
+ // text.append(residue).append(" (")
+ // .append(residuePos).append(")");
}
}
}
gg.setColor(Color.white);
gg.fillRect(0, 0, getSize().width, getSize().height);
- drawComponent(gg, av.startRes, av.endRes + 1);
+ drawComponent(gg, av.getRanges().getStartRes(), av.getRanges()
+ .getEndRes() + 1);
g.drawImage(image, 0, 0, this);
}
gg.copyArea(0, 0, imgWidth, getSize().height,
-horizontal * av.getCharWidth(), 0);
- int sr = av.startRes, er = av.endRes + 1, transX = 0;
+ int sr = av.getRanges().getStartRes(), er = av.getRanges().getEndRes() + 1, transX = 0;
if (horizontal > 0) // scrollbar pulled right, image to the left
{
return null;
}
}
-
- /**
- * Returns the current annotation symbol (if any) within the visible selected
- * columns (first symbol found left to right in selection). If none is found,
- * the supplied default value is returned.
- *
- * @param annotations
- * @param defaultValue
- * @return
- */
- String getCurrentAnnotationCharacter(Annotation[] annotations,
- String defaultValue)
- {
- String result = defaultValue;
- for (int index : av.getColumnSelection().getSelected())
- {
- if (!av.getColumnSelection().isVisible(index))
- {
- continue;
- }
-
- Annotation annotation = annotations[index];
- if (annotation != null)
- {
- String displayed = annotation.displayCharacter;
- if (displayed != null && displayed.length() > 0)
- {
- result = displayed.substring(0, 1);
- break;
- }
- }
- }
- return result;
- }
}