From 61f891719b37bdc88c1c48d85ebf8b656c2bdcd0 Mon Sep 17 00:00:00 2001 From: kiramt Date: Tue, 21 Mar 2017 11:26:31 +0000 Subject: [PATCH] JAL-2388 Made ViewportRanges final --- src/jalview/appletgui/AlignViewport.java | 6 ++---- src/jalview/gui/AlignViewport.java | 12 ++++++------ src/jalview/viewmodel/AlignmentViewport.java | 18 +++++++++++++----- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/jalview/appletgui/AlignViewport.java b/src/jalview/appletgui/AlignViewport.java index 065c503..b289be7 100644 --- a/src/jalview/appletgui/AlignViewport.java +++ b/src/jalview/appletgui/AlignViewport.java @@ -39,7 +39,6 @@ import jalview.structure.SelectionSource; import jalview.structure.StructureSelectionManager; import jalview.structure.VamsasSource; import jalview.viewmodel.AlignmentViewport; -import jalview.viewmodel.ViewportRanges; import java.awt.Font; @@ -71,11 +70,10 @@ 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; - ranges = new ViewportRanges(this.alignment); + // we always pad gaps this.setPadGaps(true); diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index 602e3a1..ef3593c 100644 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -51,7 +51,6 @@ import jalview.structure.StructureSelectionManager; import jalview.structure.VamsasSource; import jalview.util.MessageManager; import jalview.viewmodel.AlignmentViewport; -import jalview.viewmodel.ViewportRanges; import jalview.ws.params.AutoCalcSetting; import java.awt.Container; @@ -105,7 +104,7 @@ public class AlignViewport extends AlignmentViewport implements */ public AlignViewport(AlignmentI al) { - setAlignment(al); + super(al); init(); } @@ -123,6 +122,7 @@ public class AlignViewport extends AlignmentViewport implements public AlignViewport(AlignmentI al, String seqsetid, String viewid) { + super(al); sequenceSetID = seqsetid; viewId = viewid; // TODO remove these once 2.4.VAMSAS release finished @@ -135,8 +135,8 @@ public class AlignViewport extends AlignmentViewport implements { Cache.log.debug("Setting viewport's view id : " + viewId); } - setAlignment(al); init(); + } /** @@ -149,7 +149,7 @@ public class AlignViewport extends AlignmentViewport implements */ public AlignViewport(AlignmentI al, ColumnSelection hiddenColumns) { - setAlignment(al); + super(al); if (hiddenColumns != null) { colSel = hiddenColumns; @@ -184,6 +184,7 @@ public class AlignViewport extends AlignmentViewport implements public AlignViewport(AlignmentI al, ColumnSelection hiddenColumns, String seqsetid, String viewid) { + super(al); sequenceSetID = seqsetid; viewId = viewid; // TODO remove these once 2.4.VAMSAS release finished @@ -196,7 +197,7 @@ public class AlignViewport extends AlignmentViewport implements { Cache.log.debug("Setting viewport's view id : " + viewId); } - setAlignment(al); + if (hiddenColumns != null) { colSel = hiddenColumns; @@ -238,7 +239,6 @@ public class AlignViewport extends AlignmentViewport implements void init() { - ranges = new ViewportRanges(this.alignment); applyViewProperties(); String fontName = Cache.getDefault("FONT_NAME", "SansSerif"); diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index 5f84a5d..d1b593e 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -78,7 +78,7 @@ import java.util.Map; public abstract class AlignmentViewport implements AlignViewportI, CommandListener, VamsasSource { - protected ViewportRanges ranges; + final protected ViewportRanges ranges; protected ViewStyleI viewStyle = new ViewStyle(); @@ -95,6 +95,17 @@ public abstract class AlignmentViewport implements AlignViewportI, protected Deque redoList = new ArrayDeque(); /** + * alignment displayed in the viewport. Please use get/setter + */ + protected AlignmentI alignment; + + public AlignmentViewport(AlignmentI al) + { + setAlignment(al); + ranges = new ViewportRanges(al); + } + + /** * @param name * @see jalview.api.ViewStyleI#setFontName(java.lang.String) */ @@ -554,10 +565,7 @@ public abstract class AlignmentViewport implements AlignViewportI, viewStyle.setSeqNameItalics(default1); } - /** - * alignment displayed in the viewport. Please use get/setter - */ - protected AlignmentI alignment; + @Override public AlignmentI getAlignment() -- 1.7.10.2