From: jprocter Date: Wed, 8 Sep 2010 14:12:51 +0000 (+0000) Subject: todos & added simple method for other classes to monitor when fileUpdate events have... X-Git-Tag: Release_2_6~60 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=6453f3a8dfeacb9ff6c5585b2f0ff5e0bbe76e44;p=jalview.git todos & added simple method for other classes to monitor when fileUpdate events have occured --- diff --git a/src/jalview/ext/jmol/JalviewJmolBinding.java b/src/jalview/ext/jmol/JalviewJmolBinding.java index f27b533..2c34762 100644 --- a/src/jalview/ext/jmol/JalviewJmolBinding.java +++ b/src/jalview/ext/jmol/JalviewJmolBinding.java @@ -373,6 +373,7 @@ public abstract class JalviewJmolBinding implements StructureListener, } } String[] selcom = new String[files.length]; + int nmatched=0; // generate select statements to select regions to superimpose structures { for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++) @@ -386,7 +387,9 @@ public abstract class JalviewJmolBinding implements StructureListener, { if (matched[r]) { - + if (pdbfnum==0) { + nmatched++; + } if (lpos != commonrpositions[pdbfnum][r] - 1) { // discontinuity @@ -433,7 +436,8 @@ public abstract class JalviewJmolBinding implements StructureListener, } } } - + // TODO: consider bailing if nmatched less than 4 because superposition not well defined. + // TODO: refactor superposable position search (above) from jmol selection construction (below) for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++) { if (pdbfnum == refStructure) @@ -682,6 +686,10 @@ public abstract class JalviewJmolBinding implements StructureListener, // /StructureListener public synchronized String[] getPdbFile() { + if (viewer==null) + { + return new String[0]; + } if (modelFileNames == null) { @@ -1009,6 +1017,12 @@ public abstract class JalviewJmolBinding implements StructureListener, return false; } + // incremented every time a load notification is successfully handled - lightweight mechanism for other threads to detect when they can start referrring to new structures. + private long loadNotifiesHandled=0; + public long getLoadNotifiesHandled() + { + return loadNotifiesHandled; + } public void notifyFileLoaded(String fullPathName, String fileName2, String modelName, String errorMsg, int modelParts) { @@ -1182,6 +1196,7 @@ public abstract class JalviewJmolBinding implements StructureListener, fr.featuresAdded(); } refreshGUI(); + loadNotifiesHandled++; } }