applet can define groups as parameters
authoramwaterhouse <Andrew Waterhouse>
Mon, 5 Feb 2007 10:57:02 +0000 (10:57 +0000)
committeramwaterhouse <Andrew Waterhouse>
Mon, 5 Feb 2007 10:57:02 +0000 (10:57 +0000)
src/jalview/bin/JalviewLite.java
src/jalview/io/AnnotationFile.java

index 35fc82f..222d049 100755 (executable)
@@ -461,27 +461,55 @@ public class JalviewLite extends Applet
              }\r
 \r
 \r
-                String pdbfile = applet.getParameter("PDBFILE");\r
-                if(pdbfile!=null)\r
+                param = getParameter("PDBFILE");\r
+                if(param!=null)\r
                 {\r
-                  if( inArchive(pdbfile) )\r
+                  if( inArchive(param) )\r
                     protocol = AppletFormatAdapter.CLASSLOADER;\r
                   else\r
                   {\r
                     protocol = AppletFormatAdapter.URL;\r
-                    pdbfile = addProtocol(pdbfile);\r
+                    param = addProtocol(param);\r
                   }\r
 \r
                   String sequence = applet.getParameter("PDBSEQ");\r
 \r
                   if(sequence!=null)\r
                   {\r
-                    new MCview.AppletPDBViewer(pdbfile, protocol,\r
+                    new MCview.AppletPDBViewer(param, protocol,\r
                                                (Sequence)currentAlignFrame.getAlignViewport().getAlignment().findName(sequence),\r
                                                currentAlignFrame.getSeqcanvas());\r
                   }\r
 \r
                 }\r
+\r
+                int gIndex = 1;\r
+                param = getParameter("SEQUENCE_GROUP"+gIndex);\r
+                if(param!=null)\r
+                do{\r
+                  new AnnotationFile().readAnnotationFile(\r
+                   currentAlignFrame.viewport.getAlignment(),\r
+                   "JALVIEW_ANNOTATION\nSEQUENCE_GROUP\t"+param,\r
+                   AppletFormatAdapter.PASTE);\r
+                  gIndex++;\r
+                  param = applet.getParameter("SEQUENCE_GROUP"+gIndex);\r
+                  currentAlignFrame.alignPanel.repaint();\r
+                }while(param!=null);\r
+\r
+              gIndex = 1;\r
+              param = getParameter("PROPERTIES" + gIndex);\r
+              if (param != null)\r
+                do\r
+                {\r
+                  new AnnotationFile().readAnnotationFile(\r
+                      currentAlignFrame.viewport.getAlignment(),\r
+                      "JALVIEW_ANNOTATION\nPROPERTIES\t" + param,\r
+                      AppletFormatAdapter.PASTE);\r
+                  gIndex++;\r
+                  param = applet.getParameter("PROPERTIES" + gIndex);\r
+                  currentAlignFrame.alignPanel.repaint();\r
+                }\r
+                while (param != null);\r
             }\r
             else\r
             {\r
index 56040d9..8ec234d 100755 (executable)
@@ -225,7 +225,6 @@ public class AnnotationFile
 \r
 \r
   SequenceI refSeq = null;\r
-  Hashtable annotationsHash = new Hashtable();\r
   public boolean readAnnotationFile(AlignmentI al,\r
                                     String file,\r
                                     String protocol)\r
@@ -591,7 +590,6 @@ public class AnnotationFile
     if(sg.getSize()>0)\r
     {\r
       al.addGroup(sg);\r
-      annotationsHash.put(sg.getName(), sg);\r
     }\r
   }\r
 \r
@@ -601,7 +599,21 @@ public class AnnotationFile
     //So far we have only added groups to the annotationHash,\r
     //the idea is in the future properties can be added to\r
     //alignments, other annotations etc\r
-    SequenceGroup sg = (SequenceGroup)annotationsHash.get(st.nextToken());\r
+    if(al.getGroups()==null)\r
+      return;\r
+    SequenceGroup sg = null;\r
+\r
+    String name = st.nextToken();\r
+\r
+    Vector groups = al.getGroups();\r
+    for(int i=0; i<groups.size(); i++)\r
+    {\r
+      sg = (SequenceGroup)groups.elementAt(i);\r
+      if(sg.getName().equals(name))\r
+        break;\r
+      else\r
+        sg = null;\r
+    }\r
 \r
     if(sg!=null)\r
     {\r