Merge branch 'develop' into features/JAL-2446NCList
[jalview.git] / src / jalview / appletgui / TreePanel.java
index 905a54a..c7bf6aa 100644 (file)
@@ -27,10 +27,8 @@ import jalview.analysis.TreeModel;
 import jalview.analysis.scoremodels.ScoreModels;
 import jalview.analysis.scoremodels.SimilarityParams;
 import jalview.api.analysis.ScoreModelI;
-import jalview.api.analysis.ViewBasedAnalysisI;
-import jalview.bin.Cache;
 import jalview.datamodel.Alignment;
-import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.HiddenColumns;
 import jalview.datamodel.SequenceI;
 import jalview.io.NewickFile;
 import jalview.util.MessageManager;
@@ -83,21 +81,8 @@ public class TreePanel extends EmbmenuFrame implements ActionListener,
 
   /**
    * Creates a new TreePanel object.
-   * 
-   * @param av
-   *          DOCUMENT ME!
-   * @param seqVector
-   *          DOCUMENT ME!
-   * @param type
-   *          DOCUMENT ME!
-   * @param pwtype
-   *          DOCUMENT ME!
-   * @param s
-   *          DOCUMENT ME!
-   * @param e
-   *          DOCUMENT ME!
    */
-  public TreePanel(AlignmentPanel ap, String type, String pwtype)
+  public TreePanel(AlignmentPanel alignPanel, String type, String pwtype)
   {
     try
     {
@@ -108,22 +93,12 @@ public class TreePanel extends EmbmenuFrame implements ActionListener,
       ex.printStackTrace();
     }
 
-    initTreePanel(ap, type, pwtype, null);
+    initTreePanel(alignPanel, type, pwtype, null);
   }
 
   /**
    * Creates a new TreePanel object.
    * 
-   * @param av
-   *          DOCUMENT ME!
-   * @param seqVector
-   *          DOCUMENT ME!
-   * @param newtree
-   *          DOCUMENT ME!
-   * @param type
-   *          DOCUMENT ME!
-   * @param pwtype
-   *          DOCUMENT ME!
    */
   public TreePanel(AlignmentPanel ap, String type, String pwtype,
           NewickFile newtree)
@@ -177,7 +152,7 @@ public class TreePanel extends EmbmenuFrame implements ActionListener,
       }
 
       Object[] alAndColsel = tree.getOriginalData()
-              .getAlignmentAndColumnSelection(gc);
+              .getAlignmentAndHiddenColumns(gc);
 
       if (alAndColsel != null && alAndColsel[0] != null)
       {
@@ -185,7 +160,8 @@ public class TreePanel extends EmbmenuFrame implements ActionListener,
         AlignFrame af = new AlignFrame(al, av.applet,
                 "Original Data for Tree", false);
 
-        af.viewport.setHiddenColumns((ColumnSelection) alAndColsel[1]);
+        af.viewport.getAlignment().setHiddenColumns(
+                (HiddenColumns) alAndColsel[1]);
       }
     }
     else
@@ -215,7 +191,9 @@ public class TreePanel extends EmbmenuFrame implements ActionListener,
       }
       else
       {
-        ScoreModelI sm = configureScoreModel(pwtype);
+        ScoreModelI sm1 = ScoreModels.getInstance().getScoreModel(pwtype,
+                treeCanvas.ap);
+        ScoreModelI sm = sm1;
         TreeBuilder njtree = type.equals(TreeBuilder.NEIGHBOUR_JOINING) ? new NJTree(
                 av, sm, SimilarityParams.Jalview)
                 : new AverageDistanceTree(av, sm, SimilarityParams.Jalview);
@@ -387,29 +365,4 @@ public class TreePanel extends EmbmenuFrame implements ActionListener,
     inputData.addActionListener(this);
   }
 
-  /**
-   * Gets the score model for the given name. If the score model is one that
-   * requires to get state data from the current view, allow it to do so
-   * 
-   * @param sm
-   * @return
-   */
-  protected ScoreModelI configureScoreModel(String modelName)
-  {
-    ScoreModelI sm = ScoreModels.getInstance().forName(modelName);
-    if (sm instanceof ViewBasedAnalysisI)
-    {
-      try
-      {
-        sm = sm.getClass().newInstance();
-        ((ViewBasedAnalysisI) sm).configureFromAlignmentView(treeCanvas.ap);
-      } catch (Exception q)
-      {
-        Cache.log.error("Couldn't create a scoremodel instance for "
-                + sm.getName());
-      }
-    }
-    return sm;
-  }
-
 }