+
+ /**
+ * Formats a localised title for the tree panel, like
+ * <p>
+ * Neighbour Joining Using BLOSUM62
+ * <p>
+ * For a tree loaded from file, just uses the file name
+ *
+ * @param treeType
+ * NJ or AV or FromFile
+ * @param modelOrFileName
+ * @return
+ */
+ public static String getPanelTitle(String treeType, String modelOrFileName)
+ {
+ if (NJTree.FROM_FILE.equals(treeType))
+ {
+ return modelOrFileName;
+ }
+
+ /*
+ * i18n description of Neighbour Joining or Average Distance method
+ */
+ String treecalcnm = MessageManager.getString("label.tree_calc_"
+ + treeType.toLowerCase());
+
+ /*
+ * i18n description (if any) of score model used
+ */
+ String smn = MessageManager.getStringOrReturn("label.score_model_",
+ modelOrFileName);
+
+ /*
+ * put them together as <method> Using <model>
+ */
+ final String ttl = MessageManager.formatMessage("label.treecalc_title",
+ treecalcnm, smn);
+ return ttl;
+ }
+
+ /**
+ * 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;
+ }