import jalview.util.MessageManager;
import jalview.util.Platform;
import jalview.viewmodel.ViewportListenerI;
+ import jalview.viewmodel.ViewportRanges;
import java.awt.Color;
import java.awt.Dimension;
// ap.annotationScroller.getVAdjustable().addAdjustmentListener( this );
renderer = new AnnotationRenderer();
+
+ av.getRanges().addPropertyChangeListener(this);
}
public AnnotationPanel(AlignViewport av)
{
this.av = av;
renderer = new AnnotationRenderer();
- av.getRanges().addPropertyChangeListener(this);
+
}
@Override
{
activeRow = i;
}
- else if (aa[i].graph > 0)
+ else if (aa[i].graph != AlignmentAnnotation.NO_GRAPH)
{
// Stretch Graph
graphStretch = i;
public void propertyChange(PropertyChangeEvent evt)
{
// Respond to viewport range changes (e.g. alignment panel was scrolled)
- if (evt.getPropertyName().equals("startres")
- || evt.getPropertyName().equals("endres"))
+ // Both scrolling and resizing change viewport ranges: scrolling changes
+ // both start and end points, but resize only changes end values.
+ // Here we only want to fastpaint on a scroll, with resize using a normal
+ // paint, so scroll events are identified as changes to the horizontal or
+ // vertical start value.
+ if (evt.getPropertyName().equals(ViewportRanges.STARTRES))
{
fastPaint((int) evt.getNewValue() - (int) evt.getOldValue());
}
import jalview.util.Comparison;
import jalview.util.MessageManager;
import jalview.viewmodel.ViewportListenerI;
+ import jalview.viewmodel.ViewportRanges;
import java.awt.AlphaComposite;
import java.awt.Color;
* the selection list (read-only view) is in selection order, not
* column order; make a copy so we can sort it
*/
- List<Integer> selected = new ArrayList<Integer>(viscols.getSelected());
+ List<Integer> selected = new ArrayList<>(viscols.getSelected());
Collections.sort(selected);
for (int index : selected)
{
{
activeRow = i;
}
- else if (aa[i].graph > 0)
+ else if (aa[i].graph != 0)
{
// Stretch Graph
graphStretch = i;
repaint();
return;
}
+
+ int sr = av.getRanges().getStartRes();
+ int er = av.getRanges().getEndRes() + 1;
+ int transX = 0;
+
long stime = System.currentTimeMillis();
gg.copyArea(0, 0, imgWidth, getHeight(),
-horizontal * av.getCharWidth(), 0);
long mtime = System.currentTimeMillis();
- int sr = av.getRanges().getStartRes();
- int er = av.getRanges().getEndRes() + 1;
- int transX = 0;
if (horizontal > 0) // scrollbar pulled right, image to the left
{
public void propertyChange(PropertyChangeEvent evt)
{
// Respond to viewport range changes (e.g. alignment panel was scrolled)
- if (evt.getPropertyName().equals("startres")
- || evt.getPropertyName().equals("endres"))
+ // Both scrolling and resizing change viewport ranges: scrolling changes
+ // both start and end points, but resize only changes end values.
+ // Here we only want to fastpaint on a scroll, with resize using a normal
+ // paint, so scroll events are identified as changes to the horizontal or
+ // vertical start value.
+ if (evt.getPropertyName().equals(ViewportRanges.STARTRES))
{
fastPaint((int) evt.getNewValue() - (int) evt.getOldValue());
}
import jalview.datamodel.Annotation;
import jalview.datamodel.CigarArray;
import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.ContactListI;
import jalview.datamodel.HiddenColumns;
import jalview.datamodel.HiddenSequences;
import jalview.datamodel.ProfilesI;
@Override
public boolean hasHiddenColumns()
{
- return colSel != null
+ return alignment.getHiddenColumns() != null
&& alignment.getHiddenColumns().hasHiddenColumns();
}
return searchResults;
}
+ @Override
+ public ContactListI getContactList(AlignmentAnnotation _aa, int column)
+ {
+ return alignment.getContactListFor(_aa, column);
+ }
++
+ /**
+ * get the consensus sequence as displayed under the PID consensus annotation
+ * row.
+ *
+ * @return consensus sequence as a new sequence object
+ */
+ public SequenceI getConsensusSeq()
+ {
+ if (consensus == null)
+ {
+ updateConsensus(null);
+ }
+ if (consensus == null)
+ {
+ return null;
+ }
+ StringBuffer seqs = new StringBuffer();
+ for (int i = 0; i < consensus.annotations.length; i++)
+ {
+ Annotation annotation = consensus.annotations[i];
+ if (annotation != null)
+ {
+ String description = annotation.description;
+ if (description != null && description.startsWith("["))
+ {
+ // consensus is a tie - just pick the first one
+ seqs.append(description.charAt(1));
+ }
+ else
+ {
+ seqs.append(annotation.displayCharacter);
+ }
+ }
+ }
+
+ SequenceI sq = new Sequence("Consensus", seqs.toString());
+ sq.setDescription("Percentage Identity Consensus "
+ + ((ignoreGapsInConsensusCalculation) ? " without gaps" : ""));
+ return sq;
+ }
}