X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FTreePanel.java;h=35998eb440506407485b5a82bb243bcf1ed361c9;hb=268dfe33ea14bbcdfb0671a1ec8acc5e9c423426;hp=d4c6009acdd70d964de8b8d5d5546d3139374c70;hpb=2ff143c5a47bd7bde7409ce1457bf84e332660a8;p=jalview.git diff --git a/src/jalview/gui/TreePanel.java b/src/jalview/gui/TreePanel.java index d4c6009..35998eb 100755 --- a/src/jalview/gui/TreePanel.java +++ b/src/jalview/gui/TreePanel.java @@ -25,9 +25,9 @@ import jalview.analysis.AverageDistanceTree; import jalview.analysis.NJTree; import jalview.analysis.TreeBuilder; import jalview.analysis.TreeModel; +import jalview.analysis.scoremodels.ScoreModels; import jalview.api.analysis.ScoreModelI; import jalview.api.analysis.SimilarityParamsI; -import jalview.api.analysis.ViewBasedAnalysisI; import jalview.bin.Cache; import jalview.commands.CommandI; import jalview.commands.OrderCommand; @@ -35,8 +35,8 @@ import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentI; import jalview.datamodel.AlignmentView; import jalview.datamodel.BinaryNode; -import jalview.datamodel.ColumnSelection; import jalview.datamodel.DBRefEntry; +import jalview.datamodel.HiddenColumns; import jalview.datamodel.NodeTransformI; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; @@ -76,7 +76,7 @@ public class TreePanel extends GTreePanel { String treeType; - ScoreModelI scoreModel; // if tree computed + String scoreModelName; // if tree computed String treeTitle; // if tree loaded @@ -93,15 +93,15 @@ public class TreePanel extends GTreePanel * * @param ap * @param type - * @param sm + * @param modelName * @param options */ - public TreePanel(AlignmentPanel ap, String type, ScoreModelI sm, + public TreePanel(AlignmentPanel ap, String type, String modelName, SimilarityParamsI options) { super(); this.similarityParams = options; - initTreePanel(ap, type, sm, null, null); + initTreePanel(ap, type, modelName, null, null); // We know this tree has distances. JBPNote TODO: prolly should add this as // a userdefined default @@ -126,13 +126,13 @@ public class TreePanel extends GTreePanel return treeCanvas.av; } - void initTreePanel(AlignmentPanel ap, String type, ScoreModelI sm, + void initTreePanel(AlignmentPanel ap, String type, String modelName, NewickFile newTree, AlignmentView inputData) { av = ap.av; this.treeType = type; - this.scoreModel = sm; + this.scoreModelName = modelName; treeCanvas = new TreeCanvas(this, ap, scrollPane); scrollPane.setViewportView(treeCanvas); @@ -275,7 +275,8 @@ public class TreePanel extends GTreePanel } else { - ScoreModelI sm = configureScoreModel(); + ScoreModelI sm = ScoreModels.getInstance().getScoreModel( + scoreModelName, treeCanvas.ap); TreeBuilder njtree = treeType.equals(TreeBuilder.NEIGHBOUR_JOINING) ? new NJTree( av, sm, similarityParams) : new AverageDistanceTree(av, sm, similarityParams); @@ -431,8 +432,7 @@ public class TreePanel extends GTreePanel { } - Object[] alAndColsel = originalData - .getAlignmentAndColumnSelection(gc); + Object[] alAndColsel = originalData.getAlignmentAndHiddenColumns(gc); if (alAndColsel != null && alAndColsel[0] != null) { @@ -449,8 +449,8 @@ public class TreePanel extends GTreePanel if (true) { // make a new frame! - AlignFrame af = new AlignFrame(al, - (ColumnSelection) alAndColsel[1], AlignFrame.DEFAULT_WIDTH, + AlignFrame af = new AlignFrame(al, (HiddenColumns) alAndColsel[1], + AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); // >>>This is a fix for the moment, until a better solution is @@ -839,10 +839,9 @@ public class TreePanel extends GTreePanel + treeType.toLowerCase()); /* - * i18n description (if available) of score model used + * short score model name (long description can be too long) */ - String smn = MessageManager.getStringOrReturn("label.score_model_", - scoreModel.getName()); + String smn = scoreModelName; /* * put them together as Using @@ -851,28 +850,4 @@ public class TreePanel extends GTreePanel treecalcnm, smn); return ttl; } - - /** - * If the score model is one that requires to get state data from the current - * view, create and configure a new instance of it - * - * @return - */ - protected ScoreModelI configureScoreModel() - { - if (scoreModel instanceof ViewBasedAnalysisI) - { - try - { - scoreModel = scoreModel.getClass().newInstance(); - ((ViewBasedAnalysisI) scoreModel) - .configureFromAlignmentView(treeCanvas.ap); - } catch (Exception q) - { - Cache.log.error("Couldn't create a scoremodel instance for " - + scoreModel.getName()); - } - } - return scoreModel; - } }