{
JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.
getProperty( "LAST_DIRECTORY"),
- new String[]
- { "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc","amsa","jar" },
- new String[]
- { "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "AMSA", "Jalview" },
+ jalview.io.AppletFormatAdapter.WRITABLE_EXTENSIONS,
+ jalview.io.AppletFormatAdapter.WRITABLE_FNAMES,
currentFileFormat,
false);
JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.
getProperty(
"LAST_DIRECTORY"),
- new String[]
- {
- "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc",
- "jar"
- },
- new String[]
- {
- "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "Jalview"
- }, jalview.bin.Cache.getProperty("DEFAULT_FILE_FORMAT"));
+ jalview.io.AppletFormatAdapter.READABLE_EXTENSIONS,
+ jalview.io.AppletFormatAdapter.READABLE_FNAMES,
+ jalview.bin.Cache.getProperty("DEFAULT_FILE_FORMAT"));
chooser.setFileView(new JalviewFileView());
chooser.setDialogTitle("Open local file");
"BLC", "CLUSTAL", "FASTA", "MSF", "PileUp", "PIR", "PFAM" , "AMSA"
};
+ public static final String[] WRITABLE_EXTENSIONS = new String[]
+ { "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc","amsa","jar" };
+
+ public static final String[] WRITABLE_FNAMES = new String[]
+ { "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "AMSA", "Jalview" };
+
+ public static final String[] READABLE_EXTENSIONS = new String[]
+ {
+ "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc",
+ "amsa","jar"
+ };
+ public static final String[] READABLE_FNAMES = new String[]
+ {
+ "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "AMSA","Jalview"
+ };
+
public static String INVALID_CHARACTERS = "Contains invalid characters";
// TODO: make these messages dynamic
public static String SUPPORTED_FORMATS = "Formats currently supported are\n" +
- "Fasta, MSF, Clustal, BLC, PIR, MSP, and PFAM";
-
+ prettyPrint(READABLE_FORMATS);
+ /**
+ *
+ * @param els
+ * @return grammatically correct(ish) list consisting of els elements.
+ */
+ public static String prettyPrint(String[] els) {
+ StringBuffer list = new StringBuffer();
+ for (int i=0,iSize=els.length-1; i<iSize;i++)
+ {
+ list.append(els[i]);
+ list.append(",");
+ }
+ list.append(" and "+els[els.length-1]+".");
+ return list.toString();
+ }
public static String FILE = "File";
public static String URL = "URL";
public static String PASTE = "Paste";
AlignFile afile = null;
String inFile;
-
+ /**
+ * check that this format is valid for reading
+ * @param format a format string to be compared with READABLE_FORMATS
+ * @return true if format is readable
+ */
public static final boolean isValidFormat(String format)
{
boolean valid = false;