e.printStackTrace();\r
}\r
\r
- for (int i = 0; i < jalview.io.AppletFormatAdapter.formats.size()-2; i++)\r
+ for (int i = 0; i < jalview.io.AppletFormatAdapter.WRITEABLE_FORMATS.length; i++)\r
{\r
- MenuItem item = new MenuItem( (String) jalview.io.AppletFormatAdapter.formats.\r
- elementAt(\r
- i));\r
+ MenuItem item = new MenuItem( jalview.io.AppletFormatAdapter.WRITEABLE_FORMATS[i] );\r
+\r
item.addActionListener(this);\r
outputmenu.add(item);\r
}\r
MenuItem item;\r
\r
// dynamically fill save as menu with available formats\r
- for (int i = 0; i < jalview.io.AppletFormatAdapter.formats.size()-2; i++)\r
+ for (int i = 0; i < jalview.io.AppletFormatAdapter.WRITEABLE_FORMATS.length; i++)\r
{\r
\r
- item = new MenuItem( (String) jalview.io.AppletFormatAdapter.formats.\r
- elementAt(\r
- i));\r
+ item = new MenuItem( jalview.io.AppletFormatAdapter.WRITEABLE_FORMATS[i]);\r
+\r
item.addActionListener(new java.awt.event.ActionListener()\r
{\r
public void actionPerformed(ActionEvent e)\r
param = getParameter("showFeatureSettings");\r
if(param !=null && param.equalsIgnoreCase("true"))\r
{\r
+ currentAlignFrame.viewport.showSequenceFeatures(true);\r
currentAlignFrame.featureSettings_actionPerformed();\r
}\r
\r
String format = new IdentifyFile().Identify(getText(), "Paste");\r
SequenceI[] sequences = null;\r
\r
- if (FormatAdapter.formats.contains(format))\r
+ if (FormatAdapter.isValidFormat(format))\r
{\r
try{\r
sequences = new FormatAdapter().readFile(getText(), "Paste", format);\r
colours.add(PIDColour);\r
colours.add(BLOSUM62Colour);\r
\r
- for (int i = 0; i < jalview.io.FormatAdapter.formats.size()-2; i++)\r
+ for (int i = 0; i < jalview.io.FormatAdapter.WRITEABLE_FORMATS.length; i++)\r
{\r
- JMenuItem item = new JMenuItem( (String) jalview.io.FormatAdapter.formats.\r
- elementAt(\r
- i));\r
+ JMenuItem item = new JMenuItem( jalview.io.FormatAdapter.WRITEABLE_FORMATS[i] );\r
+\r
item.addActionListener(new java.awt.event.ActionListener()\r
{\r
public void actionPerformed(ActionEvent e)\r
String format = new IdentifyFile().Identify(result, "Paste");\r
SequenceI[] sequences = null;\r
\r
- if (FormatAdapter.formats.contains(format))\r
+ if (FormatAdapter.isValidFormat(format))\r
{\r
sequences = null;\r
try{ sequences = new FormatAdapter().readFile(result.toString(), "Paste",\r
public class AppletFormatAdapter\r
{\r
/** DOCUMENT ME!! */\r
- public static final Vector formats = new Vector();\r
+ public static final String [] READABLE_FORMATS = new String[]\r
+ {\r
+ "BLC", "CLUSTAL", "FASTA", "MSF", "PileUp", "PIR", "PFAM", "STH", "PDB"\r
+ };\r
+\r
+ public static final String [] WRITEABLE_FORMATS = new String[]\r
+ {\r
+ "BLC", "CLUSTAL", "FASTA", "MSF", "PileUp", "PIR", "PFAM"\r
+ };\r
+\r
\r
public static String INVALID_CHARACTERS = "Contains invalid characters";\r
\r
public static String SUPPORTED_FORMATS = "Formats currently supported are\n" +\r
"Fasta, MSF, Clustal, BLC, PIR, MSP, and PFAM";\r
\r
- static\r
- {\r
- formats.addElement("BLC");\r
- formats.addElement("CLUSTAL");\r
- formats.addElement("FASTA");\r
- formats.addElement("MSF");\r
- formats.addElement("PileUp");\r
- formats.addElement("PIR");\r
- formats.addElement("PFAM");\r
- formats.addElement("STH");\r
- formats.addElement("PDB");\r
- }\r
-\r
\r
public static String FILE = "File";\r
public static String URL = "URL";\r
AlignFile afile = null;\r
String inFile;\r
\r
+ public static final boolean isValidFormat(String format)\r
+ {\r
+ boolean valid = false;\r
+ for(int i=0; i<READABLE_FORMATS.length; i++)\r
+ if(READABLE_FORMATS[i].equalsIgnoreCase(format))\r
+ return true;\r
+\r
+ return valid;\r
+ }\r
+\r
/**\r
* DOCUMENT ME!\r
*\r
{\r
String errorMessage = AppletFormatAdapter.SUPPORTED_FORMATS;\r
\r
- if (FormatAdapter.formats.contains(format))\r
+ if (FormatAdapter.isValidFormat(format))\r
{\r
try\r
{\r
setJMenuBar(alignFrameMenuBar);\r
\r
// dynamically fill save as menu with available formats\r
- for (int i = 0; i < jalview.io.FormatAdapter.formats.size()-2; i++)\r
+ for (int i = 0; i < jalview.io.FormatAdapter.WRITEABLE_FORMATS.length; i++)\r
{\r
- JMenuItem item = new JMenuItem( (String) jalview.io.FormatAdapter.formats.\r
- elementAt(\r
- i));\r
+ JMenuItem item = new JMenuItem( jalview.io.FormatAdapter.WRITEABLE_FORMATS[i] );\r
+\r
item.addActionListener(new java.awt.event.ActionListener()\r
{\r
public void actionPerformed(ActionEvent e)\r
String format = new jalview.io.IdentifyFile().Identify(result.getAligfile(),\r
"Paste");\r
\r
- if (jalview.io.FormatAdapter.formats.contains(format))\r
+ if (jalview.io.FormatAdapter.isValidFormat(format))\r
{\r
al = new Alignment(new FormatAdapter().readFile(\r
result.getAligfile(), "Paste", format));\r