vclient = clientfactory.getIClient(app, sess);
}
}
+ // set some properties for our VAMSAS interaction
+ setVclientConfig();
user = vclient.getUserHandle();
} catch (Exception e)
return true;
}
+ private void setVclientConfig()
+ {
+ if (vclient==null)
+ {
+ return;
+ }
+ try {
+ if (vclient instanceof uk.ac.vamsas.client.simpleclient.SimpleClient)
+ {
+ uk.ac.vamsas.client.simpleclient.SimpleClientConfig cfg = ((uk.ac.vamsas.client.simpleclient.SimpleClient) vclient).getSimpleClientConfig();
+ cfg._validatemergedroots = false;
+ cfg._validateupdatedroots= true; //we may write rubbish otherwise.
+ }
+ }
+ catch (Error e)
+ {
+ Cache.log.warn("Probable SERIOUS VAMSAS client incompatibility - carrying on regardless",e);
+ }
+ catch (Exception e)
+ {
+ Cache.log.warn("Probable VAMSAS client incompatibility - carrying on regardless",e);
+ }
+ }
+
/**
* make the appHandle for Jalview
*
"Impementation error! Vamsas Operations when client not initialised and connected.");
}
addDocumentUpdateHandler();
+ addStoreDocumentHandler();
startSession();
Cache.log
.debug("Jalview loading the Vamsas Session for the first time.");
public void push_update()
{
- Cache.log.info("Jalview updating to the Vamsas Session.");
- dealWithDocumentUpdate(true);
- /*
- * IClientDocument cdoc=null; try { cdoc = vclient.getClientDocument(); }
- * catch (Exception e) { Cache.log.error("Failed to get client document for
- * update."); // RAISE A WARNING DIALOG disableGui(false); return; }
- * updateVamsasDocument(cdoc); updateJalviewGui();
- * cdoc.setVamsasRoots(cdoc.getVamsasRoots()); // propagate update flags
- * back vclient.updateDocument(cdoc);
- */
- Cache.log.info("Jalview finished updating to the Vamsas Session.");
+ Thread udthread = new Thread(new Runnable() {
+
+ public void run()
+ {
+ Cache.log.info("Jalview updating to the Vamsas Session.");
+
+ dealWithDocumentUpdate(true);
+ /*
+ * IClientDocument cdoc=null; try { cdoc = vclient.getClientDocument(); }
+ * catch (Exception e) { Cache.log.error("Failed to get client document for
+ * update."); // RAISE A WARNING DIALOG disableGui(false); return; }
+ * updateVamsasDocument(cdoc); updateJalviewGui();
+ * cdoc.setVamsasRoots(cdoc.getVamsasRoots()); // propagate update flags
+ * back vclient.updateDocument(cdoc);
+ */
+ Cache.log.info("Jalview finished updating to the Vamsas Session.");
+ // TODO Auto-generated method stub
+ }
+
+ });
+ udthread.start();
}
public void end_session()
Cache.log.debug("Jalview updating from sesion document ..");
ensureJvVamsas();
VamsasAppDatastore vds = new VamsasAppDatastore(cdoc, vobj2jv, jv2vobj,
- baseProvEntry());
+ baseProvEntry(), alRedoState);
vds.updateToJalview();
Cache.log.debug(".. finished updating from sesion document.");
{
jv2vobj = new IdentityHashMap();
vobj2jv = new Hashtable();
+ alRedoState = new Hashtable();
}
}
IdentityHashMap jv2vobj = null;
Hashtable vobj2jv = null;
-
+ Hashtable alRedoState = null;
public void updateVamsasDocument(IClientDocument doc)
{
ensureJvVamsas();
VamsasAppDatastore vds = new VamsasAppDatastore(doc, vobj2jv, jv2vobj,
- baseProvEntry());
+ baseProvEntry(), alRedoState);
// wander through frames
JInternalFrame[] frames = Desktop.desktop.getAllFrames();
Cache.log.debug("Added Jalview handler for vamsas document updates.");
}
+ private void addStoreDocumentHandler()
+ {
+ final VamsasApplication client = this;
+ vclient.addVorbaEventHandler(uk.ac.vamsas.client.Events.DOCUMENT_REQUESTTOCLOSE, new PropertyChangeListener()
+ {
+ public void propertyChange(PropertyChangeEvent evt)
+ {
+ Cache.log.debug("Asking user if the vamsas session should be stored.");
+ int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop,
+ "The current VAMSAS session has unsaved data - do you want to save it ?",
+ "VAMSAS Session Shutdown",
+ JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
+
+ if(reply==JOptionPane.YES_OPTION)
+ {
+ Cache.log.debug("Prompting for vamsas store filename.");
+ Desktop.instance.vamsasSave_actionPerformed(null);
+ Cache.log.debug("Finished attempt at storing document.");
+ }
+ Cache.log.debug("finished dealing with REQUESTTOCLOSE event.");
+ }
+ });
+ Cache.log.debug("Added Jalview handler for vamsas document updates.");
+ }
public void disableGui(boolean b)
{
Desktop.instance.setVamsasUpdate(b);
last = mstring;
// Cache.log.debug("Handling Mouse over "+mm.getVorbaID()+"
// bound to "+jvobj+" at "+mm.getPosition());
- // position is in sequence or in aligned sequence ???????
+ // position is character position in aligned sequence
ssm.mouseOverVamsasSequence((SequenceI) jvobj, mm
.getPosition());
}