/*
- * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
- * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9.0b1)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
*/
package jalview.appletgui;
-import java.awt.Font;
-
import jalview.analysis.NJTree;
import jalview.api.AlignViewportI;
import jalview.bin.JalviewLite;
import jalview.commands.CommandI;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SearchResults;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
import jalview.structure.VamsasSource;
import jalview.viewmodel.AlignmentViewport;
+import java.awt.Font;
+
public class AlignViewport extends AlignmentViewport implements
- AlignViewportI, SelectionSource, VamsasSource, CommandListener
+ SelectionSource, VamsasSource, CommandListener
{
- int startRes;
-
- int endRes;
-
- int startSeq;
-
- int endSeq;
-
boolean cursorMode = false;
Font font = new Font("SansSerif", Font.PLAIN, 10);
+ widthScale + "). Ignoring.");
widthScale = 1;
}
- if (applet.debug)
+ if (JalviewLite.debug)
{
System.err
.println("Alignment character width scaling factor is now "
+ heightScale + "). Ignoring.");
heightScale = 1;
}
- if (applet.debug)
+ if (JalviewLite.debug)
{
System.err
.println("Alignment character height scaling factor is now "
setShowUnconserved(applet.getDefaultParameter("showUnconserved",
getShowUnconserved()));
+ setScaleProteinAsCdna(applet.getDefaultParameter(
+ "scaleProteinAsCdna", isScaleProteinAsCdna()));
+
String param = applet.getParameter("upperCase");
if (param != null)
{
}
sortByTree = applet.getDefaultParameter("sortByTree", sortByTree);
- followHighlight = applet.getDefaultParameter("automaticScrolling",
- followHighlight);
- followSelection = followHighlight;
+ setFollowHighlight(applet.getDefaultParameter("automaticScrolling",
+ isFollowHighlight()));
+ followSelection = isFollowHighlight();
showSequenceLogo = applet.getDefaultParameter("showSequenceLogo",
showSequenceLogo);
if (applet != null)
{
- String colour = applet.getParameter("defaultColour");
-
+ String colour = al.isNucleotide() ? applet
+ .getParameter("defaultColourNuc") : applet
+ .getParameter("defaultColourProt");
+ if (colour == null)
+ {
+ colour = applet.getParameter("defaultColour");
+ }
if (colour == null)
{
colour = applet.getParameter("userDefinedColour");
return sq;
}
- public int getStartRes()
- {
- return startRes;
- }
-
- public int getEndRes()
- {
- return endRes;
- }
-
- public int getStartSeq()
- {
- return startSeq;
- }
-
- public void setStartRes(int res)
- {
- this.startRes = res;
- }
-
- public void setStartSeq(int seq)
- {
- this.startSeq = seq;
- }
-
- public void setEndRes(int res)
- {
- if (res > alignment.getWidth() - 1)
- {
- // log.System.out.println(" Corrected res from " + res + " to maximum " +
- // (alignment.getWidth()-1));
- res = alignment.getWidth() - 1;
- }
- if (res < 0)
- {
- res = 0;
- }
- this.endRes = res;
- }
-
- public void setEndSeq(int seq)
- {
- if (seq > alignment.getHeight())
- {
- seq = alignment.getHeight();
- }
- if (seq < 0)
- {
- seq = 0;
- }
- this.endSeq = seq;
- }
-
- public int getEndSeq()
- {
- return endSeq;
- }
-
java.awt.Frame nullFrame;
protected FeatureSettings featureSettings = null;
return font;
}
-
public void resetSeqLimits(int height)
{
setEndSeq(height / getCharHeight());
return currentTree;
}
-
boolean centreColumnLabels;
public boolean getCentreColumnLabels()
return centreColumnLabels;
}
- public boolean followHighlight = true;
-
- public boolean getFollowHighlight()
- {
- return followHighlight;
- }
-
public boolean followSelection = true;
/**
public void sendSelection()
{
getStructureSelectionManager().sendSelection(
- new SequenceGroup(getSelectionGroup()),
- new ColumnSelection(getColumnSelection()), this);
+ new SequenceGroup(getSelectionGroup()),
+ new ColumnSelection(getColumnSelection()), this);
}
/**
return this;
}
+ /**
+ * If this viewport has a (Protein/cDNA) complement, then scroll the
+ * complementary alignment to match this one.
+ */
+ public void scrollComplementaryAlignment(AlignmentPanel complementPanel)
+ {
+ if (complementPanel == null)
+ {
+ return;
+ }
+
+ /*
+ * Populate a SearchResults object with the mapped location to scroll to. If
+ * there is no complement, or it is not following highlights, or no mapping
+ * is found, the result will be empty.
+ */
+ SearchResults sr = new SearchResults();
+ int seqOffset = findComplementScrollTarget(sr);
+ if (!sr.isEmpty())
+ {
+ complementPanel.setFollowingComplementScroll(true);
+ complementPanel.scrollToCentre(sr, seqOffset);
+ }
+ }
+
}