From 173f77ac7161e8866ddfe6b5689d61a83f459cfc Mon Sep 17 00:00:00 2001 From: gmungoc Date: Thu, 14 Sep 2017 10:05:43 +0100 Subject: [PATCH] JAL-2727 null more fields in AlignmentViewport.dispose(); pull up currentTree --- src/jalview/api/AlignViewportI.java | 5 +++++ src/jalview/appletgui/AlignViewport.java | 13 ------------- src/jalview/gui/AlignViewport.java | 24 ------------------------ src/jalview/gui/Jalview2XML.java | 4 ++-- src/jalview/viewmodel/AlignmentViewport.java | 17 +++++++++++++++++ 5 files changed, 24 insertions(+), 39 deletions(-) diff --git a/src/jalview/api/AlignViewportI.java b/src/jalview/api/AlignViewportI.java index 9e6d1c0..248bae2 100644 --- a/src/jalview/api/AlignViewportI.java +++ b/src/jalview/api/AlignViewportI.java @@ -21,6 +21,7 @@ package jalview.api; import jalview.analysis.Conservation; +import jalview.analysis.TreeModel; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.AlignmentView; @@ -494,4 +495,8 @@ public interface AlignViewportI extends ViewStyleI * @return */ void setProteinFontAsCdna(boolean b); + + public abstract TreeModel getCurrentTree(); + + public abstract void setCurrentTree(TreeModel tree); } diff --git a/src/jalview/appletgui/AlignViewport.java b/src/jalview/appletgui/AlignViewport.java index b07666e..c83f93f 100644 --- a/src/jalview/appletgui/AlignViewport.java +++ b/src/jalview/appletgui/AlignViewport.java @@ -20,7 +20,6 @@ */ package jalview.appletgui; -import jalview.analysis.TreeModel; import jalview.api.AlignViewportI; import jalview.api.FeatureSettingsModelI; import jalview.bin.JalviewLite; @@ -54,8 +53,6 @@ public class AlignViewport extends AlignmentViewport boolean validCharWidth = true; - TreeModel currentTree = null; - public jalview.bin.JalviewLite applet; boolean MAC = false; @@ -274,16 +271,6 @@ public class AlignViewport extends AlignmentViewport ranges.setEndSeq(height / getCharHeight()); } - public void setCurrentTree(TreeModel tree) - { - currentTree = tree; - } - - public TreeModel getCurrentTree() - { - return currentTree; - } - boolean centreColumnLabels; public boolean getCentreColumnLabels() diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index c22a37d..90271c8 100644 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -76,8 +76,6 @@ public class AlignViewport extends AlignmentViewport { Font font; - TreeModel currentTree = null; - boolean cursorMode = false; boolean antiAlias = false; @@ -448,27 +446,6 @@ public class AlignViewport extends AlignmentViewport } /** - * DOCUMENT ME! - * - * @param tree - * DOCUMENT ME! - */ - public void setCurrentTree(TreeModel tree) - { - currentTree = tree; - } - - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public TreeModel getCurrentTree() - { - return currentTree; - } - - /** * returns the visible column regions of the alignment * * @param selectedRegionOnly @@ -1110,5 +1087,4 @@ public class AlignViewport extends AlignmentViewport } fr.setTransparency(featureSettings.getTransparency()); } - } diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index 1658f0f88..4fffe6f 100644 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -1084,7 +1084,7 @@ public class Jalview2XML // SAVE TREES // ///////////////////////////////// - if (!storeDS && av.currentTree != null) + if (!storeDS && av.getCurrentTree() != null) { // FIND ANY ASSOCIATED TREES // NOT IMPLEMENTED FOR HEADLESS STATE AT PRESENT @@ -1102,7 +1102,7 @@ public class Jalview2XML { Tree tree = new Tree(); tree.setTitle(tp.getTitle()); - tree.setCurrentTree((av.currentTree == tp.getTree())); + tree.setCurrentTree((av.getCurrentTree() == tp.getTree())); tree.setNewick(tp.getTree().print()); tree.setThreshold(tp.treeCanvas.threshold); diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index a8afe9a..8e949a5 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -22,6 +22,7 @@ package jalview.viewmodel; import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder; import jalview.analysis.Conservation; +import jalview.analysis.TreeModel; import jalview.api.AlignCalcManagerI; import jalview.api.AlignViewportI; import jalview.api.AlignmentViewPanel; @@ -955,6 +956,8 @@ public abstract class AlignmentViewport residueShading = null; // may hold a reference to Consensus changeSupport = null; ranges = null; + currentTree = null; + selectionGroup = null; setAlignment(null); } @@ -2879,6 +2882,8 @@ public abstract class AlignmentViewport */ private SearchResultsI searchResults = null; + protected TreeModel currentTree = null; + @Override public boolean hasSearchResults() { @@ -2937,4 +2942,16 @@ public abstract class AlignmentViewport + ((ignoreGapsInConsensusCalculation) ? " without gaps" : "")); return sq; } + + @Override + public void setCurrentTree(TreeModel tree) + { + currentTree = tree; + } + + @Override + public TreeModel getCurrentTree() + { + return currentTree; + } } -- 1.7.10.2