*/
package jalview.appletgui;
-import jalview.analysis.NJTree;
+import jalview.analysis.TreeModel;
import jalview.api.AlignViewportI;
import jalview.api.FeatureSettingsModelI;
import jalview.bin.JalviewLite;
import jalview.commands.CommandI;
import jalview.datamodel.AlignmentI;
+import jalview.datamodel.Annotation;
import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.HiddenColumns;
import jalview.datamodel.SearchResults;
import jalview.datamodel.SearchResultsI;
import jalview.datamodel.Sequence;
import jalview.viewmodel.AlignmentViewport;
import java.awt.Font;
+import java.awt.FontMetrics;
public class AlignViewport extends AlignmentViewport implements
SelectionSource
boolean validCharWidth = true;
- NJTree currentTree = null;
+ TreeModel currentTree = null;
public jalview.bin.JalviewLite applet;
public AlignViewport(AlignmentI al, JalviewLite applet)
{
- super();
+ super(al);
calculator = new jalview.workers.AlignCalcManager();
this.applet = applet;
- alignment = al;
+
// we always pad gaps
this.setPadGaps(true);
- this.setStartRes(0);
- this.setEndRes(al.getWidth() - 1);
- this.setStartSeq(0);
- this.setEndSeq(al.getHeight() - 1);
+
if (applet != null)
{
// get the width and height scaling factors if they were specified
}
}
}
- setFont(font);
+ setFont(font, true);
MAC = new jalview.util.Platform().isAMac();
showConsensus = applet.getDefaultParameter("showConsensus",
showConsensus);
+ showOccupancy = applet.getDefaultParameter("showOccupancy",
+ showOccupancy);
+
setShowUnconserved(applet.getDefaultParameter("showUnconserved",
getShowUnconserved()));
StringBuilder seqs = new StringBuilder(consensus.annotations.length);
for (int i = 0; i < consensus.annotations.length; i++)
{
- if (consensus.annotations[i] != null)
+ Annotation annotation = consensus.annotations[i];
+ if (annotation != null)
{
- if (consensus.annotations[i].description.charAt(0) == '[')
+ String description = annotation.description;
+ if (description != null && description.startsWith("["))
{
- seqs.append(consensus.annotations[i].description.charAt(1));
+ // consensus is a tie - just pick the first one
+ seqs.append(annotation.description.charAt(1));
}
else
{
- seqs.append(consensus.annotations[i].displayCharacter);
+ seqs.append(annotation.displayCharacter);
}
}
}
private float heightScale = 1, widthScale = 1;
- public void setFont(Font f)
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setFont(Font f, boolean setGrid)
{
font = f;
if (nullFrame == null)
nullFrame.addNotify();
}
- java.awt.FontMetrics fm = nullFrame.getGraphics().getFontMetrics(font);
- setCharHeight((int) (heightScale * fm.getHeight()));
- setCharWidth((int) (widthScale * fm.charWidth('M')));
+ if (setGrid)
+ {
+ FontMetrics fm = nullFrame.getGraphics().getFontMetrics(font);
+ setCharHeight((int) (heightScale * fm.getHeight()));
+ setCharWidth((int) (widthScale * fm.charWidth('M')));
+ }
if (isUpperCasebold())
{
Font f2 = new Font(f.getName(), Font.BOLD, f.getSize());
- fm = nullFrame.getGraphics().getFontMetrics(f2);
+ FontMetrics fm = nullFrame.getGraphics().getFontMetrics(f2);
setCharWidth((int) (widthScale * (fm.stringWidth("MMMMMMMMMMM") / 10)));
}
}
public void resetSeqLimits(int height)
{
- setEndSeq(height / getCharHeight());
+ ranges.setEndSeq(height / getCharHeight());
}
- public void setCurrentTree(NJTree tree)
+ public void setCurrentTree(TreeModel tree)
{
currentTree = tree;
}
- public NJTree getCurrentTree()
+ public TreeModel getCurrentTree()
{
return currentTree;
}
{
getStructureSelectionManager().sendSelection(
new SequenceGroup(getSelectionGroup()),
- new ColumnSelection(getColumnSelection()), this);
+ new ColumnSelection(getColumnSelection()),
+ new HiddenColumns(getAlignment().getHiddenColumns()), this);
}
/**
int seqOffset = findComplementScrollTarget(sr);
if (!sr.isEmpty())
{
- complementPanel.setFollowingComplementScroll(true);
+ complementPanel.setToScrollComplementPanel(false);
complementPanel.scrollToCentre(sr, seqOffset);
+ complementPanel.setToScrollComplementPanel(true);
}
}