JAL-2499 JAL-2403 push 'configure for view' inside ScoreModels, defer
[jalview.git] / src / jalview / appletgui / TreePanel.java
index 905a54a..70a3c04 100644 (file)
@@ -27,8 +27,6 @@ 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.SequenceI;
@@ -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)
@@ -388,27 +363,16 @@ public class TreePanel extends EmbmenuFrame implements ActionListener,
   }
 
   /**
-   * 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
+   * Gets an instantiated score model for the given name, configured for the
+   * current view if applicable
    * 
-   * @param sm
+   * @param modelName
    * @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());
-      }
-    }
+    ScoreModelI sm = ScoreModels.getInstance().getScoreModel(modelName,
+            treeCanvas.ap);
     return sm;
   }