From: Charles Ofoegbu Date: Wed, 12 Nov 2014 12:19:55 +0000 (+0000) Subject: Excluded HtmlFile.java dependencies from AppletFomatAdapter X-Git-Tag: Jalview_2_9~152^2~2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=68c26e8852772be21fdb5b091fa9083d8cdb6eec;p=jalview.git Excluded HtmlFile.java dependencies from AppletFomatAdapter --- diff --git a/src/jalview/io/AppletFormatAdapter.java b/src/jalview/io/AppletFormatAdapter.java index efddab3..2e94782 100755 --- a/src/jalview/io/AppletFormatAdapter.java +++ b/src/jalview/io/AppletFormatAdapter.java @@ -47,7 +47,7 @@ public class AppletFormatAdapter */ public static final String[] READABLE_FORMATS = new String[] { "BLC", "CLUSTAL", "FASTA", "MSF", "PileUp", "PIR", "PFAM", "STH", - "PDB", "JnetFile", "RNAML", PhylipFile.FILE_DESC, HtmlFile.FILE_DESC }; // , + "PDB", "JnetFile", "RNAML", PhylipFile.FILE_DESC, "HTML" }; // , // "SimpleBLAST" // }; @@ -82,7 +82,7 @@ public class AppletFormatAdapter public static final String[] READABLE_EXTENSIONS = new String[] { "fa, fasta, mfa, fastq", "aln", "pfam", "msf", "pir", "blc", "amsa", "jar,jvp", "sto,stk", "xml,rnaml", PhylipFile.FILE_EXT, - HtmlFile.FILE_EXT }; // ".blast" + "html" }; // ".blast" /** * List of readable formats by application in order corresponding to @@ -90,7 +90,7 @@ public class AppletFormatAdapter */ public static final String[] READABLE_FNAMES = new String[] { "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "AMSA", "Jalview", - "Stockholm", "RNAML", PhylipFile.FILE_DESC, HtmlFile.FILE_DESC };// , + "Stockholm", "RNAML", PhylipFile.FILE_DESC, "HTML" };// , // "SimpleBLAST" // }; @@ -255,10 +255,10 @@ public class AppletFormatAdapter { afile = new PhylipFile(inFile, type); } - else if (format.equals(HtmlFile.FILE_DESC)) - { - afile = new HtmlFile(inFile, type); - } + // else if (format.equals(HtmlFile.FILE_DESC)) + // { + // afile = new HtmlFile(inFile, type); + // } else if (format.equals("RNAML")) { afile = new RnamlFile(inFile, type); @@ -382,10 +382,10 @@ public class AppletFormatAdapter { afile = new PhylipFile(source); } - else if (format.equals(HtmlFile.FILE_DESC)) - { - afile = new HtmlFile(source); - } + // else if (format.equals(HtmlFile.FILE_DESC)) + // { + // afile = new HtmlFile(source); + // } Alignment al = new Alignment(afile.getSeqsAsArray()); afile.addAnnotations(al); @@ -521,10 +521,10 @@ public class AppletFormatAdapter { afile = new PhylipFile(); } - else if (format.equalsIgnoreCase(HtmlFile.FILE_DESC)) - { - afile = new HtmlFile(); - } + // else if (format.equalsIgnoreCase(HtmlFile.FILE_DESC)) + // { + // afile = new HtmlFile(); + // } else if (format.equalsIgnoreCase("RNAML")) { afile = new RnamlFile(); diff --git a/src/jalview/io/FileLoader.java b/src/jalview/io/FileLoader.java index 29f5632..833f590 100755 --- a/src/jalview/io/FileLoader.java +++ b/src/jalview/io/FileLoader.java @@ -355,8 +355,7 @@ public class FileLoader implements Runnable } if (source instanceof HtmlFile) { - ((HtmlFile) source).LoadAlignmentFeatures(alignFrame -); + ((HtmlFile) source).LoadAlignmentFeatures(alignFrame); } if (raiseGUI) diff --git a/src/jalview/io/FormatAdapter.java b/src/jalview/io/FormatAdapter.java index c2a317a..416773d 100755 --- a/src/jalview/io/FormatAdapter.java +++ b/src/jalview/io/FormatAdapter.java @@ -21,7 +21,13 @@ package jalview.io; import jalview.api.AlignViewportI; -import jalview.datamodel.*; +import jalview.datamodel.Alignment; +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.ColumnSelection; +import jalview.datamodel.Sequence; +import jalview.datamodel.SequenceGroup; +import jalview.datamodel.SequenceI; /** * Additional formatting methods used by the application in a number of places. @@ -154,8 +160,10 @@ public class FormatAdapter extends AppletFormatAdapter public boolean getCacheSuffixDefault(String format) { if (isValidFormat(format)) + { return jalview.bin.Cache.getDefault(format.toUpperCase() + "_JVSUFFIX", true); + } return false; } @@ -227,6 +235,41 @@ public class FormatAdapter extends AppletFormatAdapter return this.formatSequences(format, alignment, suffix); } + public Alignment readFile(String inFile, String type, String format) + throws java.io.IOException + { + Alignment al; + if (format.equals("HTML")) + { + afile = new HtmlFile(inFile, type); + al = new Alignment(afile.getSeqsAsArray()); + afile.addAnnotations(al); + } + else + { + al = super.readFile(inFile, type, format); + } + + return al; + } + + public AlignmentI readFromFile(FileParse source, String format) + throws java.io.IOException + { + Alignment al; + if (format.equals("HTML")) + { + afile = new HtmlFile(source); + al = new Alignment(afile.getSeqsAsArray()); + afile.addAnnotations(al); + } + else + { + al = (Alignment) super.readFromFile(source, format); + } + return al; + } + /** * validate format is valid for IO in Application. This is basically the * AppletFormatAdapter.isValidFormat call with additional checks for diff --git a/src/jalview/io/HtmlFile.java b/src/jalview/io/HtmlFile.java index a188290..ee1b151 100644 --- a/src/jalview/io/HtmlFile.java +++ b/src/jalview/io/HtmlFile.java @@ -18,9 +18,9 @@ import org.jsoup.nodes.Element; public class HtmlFile extends AlignFile { - public static final String FILE_EXT = "html"; - - public static final String FILE_DESC = "HTML"; + // public static final String FILE_EXT = "html"; + // + // public static final String FILE_DESC = "HTML"; private ColourSchemeI cs; diff --git a/src/jalview/io/IdentifyFile.java b/src/jalview/io/IdentifyFile.java index aa9c354..365982e 100755 --- a/src/jalview/io/IdentifyFile.java +++ b/src/jalview/io/IdentifyFile.java @@ -138,7 +138,7 @@ public class IdentifyFile } if (data.matches("<(\"[^\"]*\"|'[^']*'|[^'\">])*>")) { - reply = HtmlFile.FILE_DESC; + reply = "HTML"; break; }