part finished (still finishing the updateJalview method of VamsasDatastore)
[jalview.git] / src / jalview / gui / VamsasClient.java
index 8d635a3..76e9599 100755 (executable)
@@ -8,6 +8,7 @@ import java.io.FileOutputStream;
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.util.Hashtable;
+import java.util.IdentityHashMap;
 import java.util.Vector;
 import java.util.jar.JarOutputStream;
 
@@ -42,9 +43,33 @@ public class VamsasClient extends ArchiveClient {
                Cache.log.info("Jalview loading the Vamsas Session.");
                // load in the vamsas archive for the first time
                ClientDoc cdoc = this.getUpdateable();
+               updateJalview(cdoc);
+               
+       }
+       /**
+        * this will close all windows currently in Jalview.
+        *
+        */
+       protected void closeWindows() {
+               JInternalFrame[] frames = Desktop.desktop.getAllFrames();
+
+        if (frames == null)
+        {
+            return;
+        }
+
+        try
+        {      
+            for (int i = frames.length - 1; i > -1; i--) {
+               frames[i].dispose();    
+            }
+        } catch (Exception e) {
+               Cache.log.error("Whilst closing windows",e);
+        }
                
        }
        public void get_update(VamsasArchive doc) {
+               // Close windows - load update.
                Cache.log.info("Jalview updating from Vamsas Session.");
        }
        public void push_update() {
@@ -56,10 +81,22 @@ public class VamsasClient extends ArchiveClient {
                // stop any update/watcher thread.
                Cache.log.info("Jalview disconnecting from the Vamsas Session.");
        }
-       java.util.Hashtable jv2vobj = null;
+       public void updateJalview(ClientDoc cdoc) {
+               
+       }
+       protected void _updateAlignFrame(ClientDoc cdoc, AlignFrame av) {
+               
+       }
+       /**
+        * jalview object binding to VorbaIds
+        */
+       IdentityHashMap jv2vobj = null;
+       Hashtable vobj2jv = null;
        public void updateVamsasDocument(ClientDoc doc) {
-               if (jv2vobj==null)
-                       jv2vobj = new Hashtable();
+               if (jv2vobj==null) {
+                       jv2vobj = new IdentityHashMap();
+                       vobj2jv = new Hashtable();
+               }
                // wander through frames 
                JInternalFrame[] frames = Desktop.desktop.getAllFrames();
 
@@ -83,7 +120,9 @@ public class VamsasClient extends ArchiveClient {
                 if (frames[i] instanceof AlignFrame)
                 {
                        AlignFrame af = (AlignFrame) frames[i];
+                       
                        // check if this frame has an associated alignment object ?
+                       
                        // update alignment and root from frame.
 
                 }