From 541455bb84cb67379faedfe280096ec5cb91fb21 Mon Sep 17 00:00:00 2001 From: jprocter Date: Fri, 19 Jun 2009 10:09:56 +0000 Subject: [PATCH] javadoc and datastoreitem registry support for binding/rebinding methods --- src/jalview/io/vamsas/DatastoreItem.java | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/jalview/io/vamsas/DatastoreItem.java b/src/jalview/io/vamsas/DatastoreItem.java index 489f56f..738d14f 100644 --- a/src/jalview/io/vamsas/DatastoreItem.java +++ b/src/jalview/io/vamsas/DatastoreItem.java @@ -106,7 +106,7 @@ public abstract class DatastoreItem /** * note: this is taken verbatim from jalview.io.VamsasAppDatastore - + * with added call to updateRegistryEntry * @param jvobj * @param vobj */ @@ -124,7 +124,6 @@ public abstract class DatastoreItem : "unregisterable") + " object " + vobj); } } - if (vobj2jv.containsKey(vobj.getVorbaId()) && !(vobj2jv.get(vobj.getVorbaId())).equals(jvobj)) { @@ -152,11 +151,29 @@ public abstract class DatastoreItem vobj2jv.put(vobj.getVorbaId(), jvobj); // JBPNote - better implementing a hybrid invertible hash. jv2vobj.put(jvobj, vobj.getVorbaId()); + if (jvobj==this.jvobj || vobj==this.vobj) + { + updateRegistryEntry(jvobj,vobj); + } + } + /** + * update the vobj and jvobj references and the registry entry for this datastore object + * called by bindjvvobj and replacejvobjmapping + */ + private void updateRegistryEntry(Object jvobj,Vobject vobj) + { + if (this.jvobj!=null && this.vobj!=null) { + Cache.log.debug("updating dsobj registry. ("+this.getClass().getName()+")"); + } + this.jvobj = jvobj; + this.vobj = vobj; + dsReg.registerDsObj(this); } + /** * replaces oldjvobject with newjvobject in the Jalview Object <> VorbaID * binding tables - * note: this is taken verbatim from jalview.io.VamsasAppDatastore + * note: originally taken verbatim from jalview.io.VamsasAppDatastore with added call to updateRegistryEntry * @param oldjvobject * @param newjvobject (may be null to forget the oldjvobject's document mapping) * @@ -174,6 +191,7 @@ public abstract class DatastoreItem { jv2vobj.put(newjvobject, vobject); vobj2jv.put(vobject, newjvobject); + updateRegistryEntry(newjvobject,(Vobject) vobject); } } -- 1.7.10.2