From 91cb798a47b512b0ac3792fd3a84f2c5bd3c7218 Mon Sep 17 00:00:00 2001 From: jprocter Date: Mon, 27 Mar 2006 08:39:24 +0000 Subject: [PATCH] preliminary notes on javliew sync with vamsas document --- src/jalview/gui/VamsasClient.java | 45 ++++++++++--------------------------- 1 file changed, 12 insertions(+), 33 deletions(-) diff --git a/src/jalview/gui/VamsasClient.java b/src/jalview/gui/VamsasClient.java index 46881ef..8d635a3 100755 --- a/src/jalview/gui/VamsasClient.java +++ b/src/jalview/gui/VamsasClient.java @@ -7,6 +7,7 @@ import java.io.File; import java.io.FileOutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; +import java.util.Hashtable; import java.util.Vector; import java.util.jar.JarOutputStream; @@ -33,15 +34,15 @@ public class VamsasClient extends ArchiveClient { // user and organisation stuff. public VamsasClient(Desktop jdesktop, File sessionPath) { - super("Jalview User", "Dundee", "jalview","2.7", + super(System.getProperty("user.name"),System.getProperty("host.name"), "jalview","2.7", sessionPath); us=jdesktop; } public void initial_update() { Cache.log.info("Jalview loading the Vamsas Session."); // load in the vamsas archive for the first time + ClientDoc cdoc = this.getUpdateable(); - // VamsasArchive doc = new VamsasArchive(); } public void get_update(VamsasArchive doc) { Cache.log.info("Jalview updating from Vamsas Session."); @@ -55,7 +56,10 @@ public class VamsasClient extends ArchiveClient { // stop any update/watcher thread. Cache.log.info("Jalview disconnecting from the Vamsas Session."); } - public void updateVamsasDocument(VamsasDocument doc) { + java.util.Hashtable jv2vobj = null; + public void updateVamsasDocument(ClientDoc doc) { + if (jv2vobj==null) + jv2vobj = new Hashtable(); // wander through frames JInternalFrame[] frames = Desktop.desktop.getAllFrames(); @@ -66,6 +70,11 @@ public class VamsasClient extends ArchiveClient { try { + // Mapping + // Alignframe.alignment (non-null dataset)==alignment + // alignframe .alignment (dataset==null) = VAMAS[] + // Tree.alignment = vamsas[].tree (vamsas[] given by dataset, alignment given by local ref] + Vector shortNames = new Vector(); //REVERSE ORDER @@ -76,36 +85,6 @@ public class VamsasClient extends ArchiveClient { AlignFrame af = (AlignFrame) frames[i]; // check if this frame has an associated alignment object ? // update alignment and root from frame. - - - String shortName = af.getTitle(); - - if (shortName.indexOf(File.separatorChar) > -1) - { - shortName = shortName.substring(shortName.lastIndexOf( - File.separatorChar) + 1); - } - - int count = 1; - - while (shortNames.contains(shortName)) - { - if (shortName.endsWith("_" + (count - 1))) - { - shortName = shortName.substring(0, - shortName.lastIndexOf("_")); - } - - shortName = shortName.concat("_" + count); - count++; - } - - shortNames.addElement(shortName); - - if (!shortName.endsWith(".xml")) - { - shortName = shortName + ".xml"; - } } } -- 1.7.10.2