Excluded HtmlFile.java dependencies from AppletFomatAdapter
authorCharles Ofoegbu <tcnofoegbu@dundee.ac.uk>
Wed, 12 Nov 2014 12:19:55 +0000 (12:19 +0000)
committerCharles Ofoegbu <tcnofoegbu@dundee.ac.uk>
Wed, 12 Nov 2014 12:19:55 +0000 (12:19 +0000)
src/jalview/io/AppletFormatAdapter.java
src/jalview/io/FileLoader.java
src/jalview/io/FormatAdapter.java
src/jalview/io/HtmlFile.java
src/jalview/io/IdentifyFile.java

index efddab3..2e94782 100755 (executable)
@@ -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();
index 29f5632..833f590 100755 (executable)
@@ -355,8 +355,7 @@ public class FileLoader implements Runnable
             }
             if (source instanceof HtmlFile)
             {
-              ((HtmlFile) source).LoadAlignmentFeatures(alignFrame
-);
+              ((HtmlFile) source).LoadAlignmentFeatures(alignFrame);
 
             }
             if (raiseGUI)
index c2a317a..416773d 100755 (executable)
 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
index a188290..ee1b151 100644 (file)
@@ -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;
 
index aa9c354..365982e 100755 (executable)
@@ -138,7 +138,7 @@ public class IdentifyFile
         }
         if (data.matches("<(\"[^\"]*\"|'[^']*'|[^'\">])*>"))
         {
-          reply = HtmlFile.FILE_DESC;
+          reply = "HTML";
           break;
         }