X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fext%2Farchaeopteryx%2FAptxInit.java;h=3dc2e884912b88c51869785ea589b71a104b0692;hb=075c1528d363ca18476cb9f0b12709158c78fa5e;hp=b9a7ae2cc00d3db65730518f36e34b62ba201787;hpb=fc5e6326a0df6e78a44c0c53c2125091f992d1e1;p=jalview.git diff --git a/src/jalview/ext/archaeopteryx/AptxInit.java b/src/jalview/ext/archaeopteryx/AptxInit.java index b9a7ae2..3dc2e88 100644 --- a/src/jalview/ext/archaeopteryx/AptxInit.java +++ b/src/jalview/ext/archaeopteryx/AptxInit.java @@ -15,6 +15,7 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; +import java.util.HashMap; import java.util.Map; import org.forester.archaeopteryx.AptxUtil; @@ -65,6 +66,8 @@ public final class AptxInit private final static NHXParser.TAXONOMY_EXTRACTION TAXONOMY_EXTRACTION = APTX_CONFIG .getTaxonomyExtraction(); + private static Map activeAptx = new HashMap<>(); + public static MainFrame createInstanceFromCalculation( @@ -125,13 +128,20 @@ public final class AptxInit nex.setReplaceUnderscores(REPLACE_NHX_UNDERSCORES); nex.setIgnoreQuotes(false); } -// else if (p instanceof PhyloXmlParser) -// { -// MainFrameApplication.warnIfNotPhyloXmlValidation(APTX_CONFIG); -// } + else if (parser instanceof PhyloXmlParser) + { + if ( VALIDATE_PHYLOXML_XSD ) { + JvOptionPane.showInternalMessageDialog( null, + ForesterUtil.wordWrap( + "phyloXML XSD-based validation is turned off [enable with line 'validate_against_phyloxml_xsd_schem: true' in configuration file]", + 80 ), + "Warning", + JvOptionPane.WARNING_MESSAGE ); + } + } Phylogeny[] trees = PhylogenyMethods.readPhylogenies(parser, treeFile); MainFrame[] aptxFrames = new MainFrame[trees.length]; - String treeTitle = treeFile.getName(); + for (int i = 0; i < trees.length; i++) { @@ -141,6 +151,8 @@ public final class AptxInit { PhylogenyMethods.transferInternalNodeNamesToConfidence(tree, ""); } + String treeTitle = treeFile.getName() + "[" + i + "]"; + tree.setName(treeTitle); aptxFrames[i] = createAptxFrame(tree, viewport, treeTitle); } @@ -191,7 +203,7 @@ public final class AptxInit * @return */ public static MainFrame[] createInstancesFromDb(int databaseIndex, - AlignmentViewport viewport) + AlignmentViewport viewport, String defaultIdentifier) { URL url = null; @@ -204,7 +216,8 @@ public final class AptxInit Desktop.desktop, client.getInstructions() + "\n(Reference: " + client.getReference() + ")", - client.getDescription(), JvOptionPane.QUESTION_MESSAGE); + client.getDescription(), JvOptionPane.QUESTION_MESSAGE, null, + null, defaultIdentifier).toString(); if ((identifier != null) && (identifier.trim().length() > 0)) { @@ -496,8 +509,11 @@ public final class AptxInit final Map alignMappedToNodes, final Map nodesMappedToAlign) { - return new JalviewBinding(aptxApp, jalviewAlignViewport, + JalviewBinding treeBinding = new JalviewBinding(aptxApp, + jalviewAlignViewport, alignMappedToNodes, nodesMappedToAlign); + activeAptx.put(aptxApp, treeBinding); + return treeBinding; } @@ -509,14 +525,25 @@ public final class AptxInit aptxApp.setMinimumSize(new Dimension(width, height)); // aptxApp.setFont(Desktop.instance.getFont()); // aptxApp.getMainPanel().setFont(Desktop.instance.getFont()); - - Desktop.addInternalFrame(aptxApp, "Archaeopteryx Tree View", true, - width, height, true, true); - + String frameTitle = MessageManager.getString("label.aptx_title"); + File treeFile = aptxApp.getMainPanel().getCurrentTreePanel() + .getTreeFile(); + if (treeFile != null) + { + frameTitle += MessageManager.formatMessage("label.aptx_title_append", + new String[] + { treeFile.getAbsolutePath() }); + } + Desktop.addInternalFrame(aptxApp, frameTitle, true, width, height, true, + true); return aptxApp; } + public static Map getAllAptxFrames() + { + return activeAptx; + } }