X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FAppletFormatAdapter.java;h=8c376fcfbfd3c5ea7f681e09f4d8b32c099a87d8;hb=7047b076a62df177047ceb16c3611efe020bdd76;hp=bc2465a8023da9a86f9ee163fe1e5adc56abb9cc;hpb=5969ead0fd401f4435a3435ede9e4e87cf9c1d0b;p=jalview.git diff --git a/src/jalview/io/AppletFormatAdapter.java b/src/jalview/io/AppletFormatAdapter.java index bc2465a..8c376fc 100755 --- a/src/jalview/io/AppletFormatAdapter.java +++ b/src/jalview/io/AppletFormatAdapter.java @@ -20,7 +20,7 @@ */ package jalview.io; -import jalview.api.AlignExportSettingI; +import jalview.api.AlignExportSettingsI; import jalview.api.AlignmentViewPanel; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentAnnotation; @@ -73,7 +73,7 @@ public class AppletFormatAdapter */ protected String newline = System.getProperty("line.separator"); - private AlignExportSettingI exportSettings; + private AlignExportSettingsI exportSettings; private File selectedFile; @@ -100,7 +100,7 @@ public class AppletFormatAdapter } public AppletFormatAdapter(AlignmentViewPanel alignPanel, - AlignExportSettingI settings) + AlignExportSettingsI settings) { viewpanel = alignPanel; exportSettings = settings; @@ -174,13 +174,13 @@ public class AppletFormatAdapter if (isParseWithJMOL) { // needs a File option - alignFile = new JmolParser(inFile, sourceType); + alignFile = new JmolParser(selectedFile == null ? inFile : selectedFile, sourceType); } else { - // todo is MCview parsing obsolete yet? JAL-2120 + // todo is mc_view parsing obsolete yet? JAL-2120 StructureImportSettings.setShowSeqFeatures(true); - alignFile = new MCview.PDBfile(annotFromStructure, + alignFile = new mc_view.PDBfile(annotFromStructure, localSecondaryStruct, serviceSecondaryStruct, inFile, sourceType); } @@ -265,7 +265,7 @@ public class AppletFormatAdapter else { StructureImportSettings.setShowSeqFeatures(true); - alignFile = new MCview.PDBfile(annotFromStructure, + alignFile = new mc_view.PDBfile(annotFromStructure, localSecondaryStruct, serviceSecondaryStruct, source); } ((StructureFile) alignFile).setDbRefType(Type.PDB); @@ -421,15 +421,22 @@ public class AppletFormatAdapter return null; } + /** * Determines the protocol (i.e DataSourceType.{FILE|PASTE|URL}) for the input * data + * + * BH 2018 allows File or String, and can return RELATIVE_URL * - * @param data + * @param dataObject File or String * @return the protocol for the input data */ - public static DataSourceType checkProtocol(String data) + public static DataSourceType checkProtocol(Object dataObject) { + if(dataObject instanceof File) + return DataSourceType.FILE; + + String data = dataObject.toString(); DataSourceType protocol = DataSourceType.PASTE; String ft = data.toLowerCase().trim(); if (ft.indexOf("http:") == 0 || ft.indexOf("https:") == 0 @@ -437,7 +444,7 @@ public class AppletFormatAdapter { protocol = DataSourceType.URL; } - else if (jalview.bin.Jalview.isJS) + else if (jalview.bin.Jalview.isJS()) { protocol = DataSourceType.RELATIVE_URL; }