X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FAlignViewport.java;h=a894d0b48a02e4f18879ca87456cdc7c4602b1e5;hb=4d68dde4cec0aec2293d99dc7d00a38755fb5c06;hp=f927e638c2d175394f06716bdfd85be15627e36a;hpb=d559b47886de6427219011e6e355320a0babd757;p=jalview.git diff --git a/src/jalview/appletgui/AlignViewport.java b/src/jalview/appletgui/AlignViewport.java index f927e63..a894d0b 100644 --- a/src/jalview/appletgui/AlignViewport.java +++ b/src/jalview/appletgui/AlignViewport.java @@ -20,13 +20,15 @@ */ 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; @@ -41,6 +43,7 @@ import jalview.structure.VamsasSource; import jalview.viewmodel.AlignmentViewport; import java.awt.Font; +import java.awt.FontMetrics; public class AlignViewport extends AlignmentViewport implements SelectionSource @@ -51,7 +54,7 @@ public class AlignViewport extends AlignmentViewport implements boolean validCharWidth = true; - NJTree currentTree = null; + TreeModel currentTree = null; public jalview.bin.JalviewLite applet; @@ -70,16 +73,13 @@ public class AlignViewport extends AlignmentViewport implements 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 @@ -130,7 +130,7 @@ public class AlignViewport extends AlignmentViewport implements } } } - setFont(font); + setFont(font, true); MAC = new jalview.util.Platform().isAMac(); @@ -150,6 +150,9 @@ public class AlignViewport extends AlignmentViewport implements showConsensus = applet.getDefaultParameter("showConsensus", showConsensus); + showOccupancy = applet.getDefaultParameter("showOccupancy", + showOccupancy); + setShowUnconserved(applet.getDefaultParameter("showUnconserved", getShowUnconserved())); @@ -246,15 +249,18 @@ public class AlignViewport extends AlignmentViewport implements 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); } } } @@ -270,7 +276,11 @@ public class AlignViewport extends AlignmentViewport implements 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) @@ -279,14 +289,17 @@ public class AlignViewport extends AlignmentViewport implements 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))); } } @@ -298,15 +311,15 @@ public class AlignViewport extends AlignmentViewport implements 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; } @@ -334,7 +347,8 @@ public class AlignViewport extends AlignmentViewport implements { getStructureSelectionManager().sendSelection( new SequenceGroup(getSelectionGroup()), - new ColumnSelection(getColumnSelection()), this); + new ColumnSelection(getColumnSelection()), + new HiddenColumns(getAlignment().getHiddenColumns()), this); } /** @@ -439,8 +453,9 @@ public class AlignViewport extends AlignmentViewport implements int seqOffset = findComplementScrollTarget(sr); if (!sr.isEmpty()) { - complementPanel.setFollowingComplementScroll(true); + complementPanel.setToScrollComplementPanel(false); complementPanel.scrollToCentre(sr, seqOffset); + complementPanel.setToScrollComplementPanel(true); } }