WRITEABLE_FORMATS and READABLE_FORMATS string []
authoramwaterhouse <Andrew Waterhouse>
Tue, 15 Aug 2006 10:02:12 +0000 (10:02 +0000)
committeramwaterhouse <Andrew Waterhouse>
Tue, 15 Aug 2006 10:02:12 +0000 (10:02 +0000)
src/jalview/appletgui/APopupMenu.java
src/jalview/appletgui/AlignFrame.java
src/jalview/bin/JalviewLite.java
src/jalview/gui/CutAndPasteTransfer.java
src/jalview/gui/PopupMenu.java
src/jalview/gui/SequenceFetcher.java
src/jalview/io/AppletFormatAdapter.java
src/jalview/io/FileLoader.java
src/jalview/jbgui/GAlignFrame.java
src/jalview/ws/JPredClient.java

index b26bd74..449b83a 100755 (executable)
@@ -89,11 +89,10 @@ public class APopupMenu
       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
index 1ff729d..eb6fe49 100755 (executable)
@@ -1937,12 +1937,11 @@ public void itemStateChanged(ItemEvent evt)
       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
index 53d55f3..10efeeb 100755 (executable)
@@ -337,6 +337,7 @@ public class JalviewLite extends Applet
               param = getParameter("showFeatureSettings");\r
               if(param !=null && param.equalsIgnoreCase("true"))\r
               {\r
+                currentAlignFrame.viewport.showSequenceFeatures(true);\r
                 currentAlignFrame.featureSettings_actionPerformed();\r
               }\r
 \r
index 2bb456b..5c9c941 100755 (executable)
@@ -169,7 +169,7 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer
         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
index 9764f4a..e89eb28 100755 (executable)
@@ -115,11 +115,10 @@ public class PopupMenu extends JPopupMenu
         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
index 99c1d5e..f3d8e29 100755 (executable)
@@ -364,7 +364,7 @@ public class SequenceFetcher
     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
index ba5b8a0..1de01e6 100755 (executable)
     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
index 0fc4aa8..10e0bf8 100755 (executable)
@@ -138,7 +138,7 @@ public class FileLoader
       {\r
         String errorMessage = AppletFormatAdapter.SUPPORTED_FORMATS;\r
 \r
-        if (FormatAdapter.formats.contains(format))\r
+        if (FormatAdapter.isValidFormat(format))\r
         {\r
           try\r
           {\r
index 496585b..1b03e19 100755 (executable)
@@ -148,11 +148,10 @@ public class GAlignFrame
       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
index 08d7271..ec3f737 100755 (executable)
@@ -406,7 +406,7 @@ public class JPredClient
           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