* @return list of current sessions or null if no session exists.
*/
public static String[] getSessionList() throws Exception {
- uk.ac.vamsas.client.IClientFactory clientfactory = null;
- clientfactory = getClientFactory();
- return clientfactory.getCurrentSessions();
+ return getClientFactory().getCurrentSessions();
}
/**
* initialise, possibly with e valid session url
{
throw new Error("Impementation error! Vamsas Operations when client not initialised and connected.");
}
- this.addDocumentUpdateHandler();
- this.startSession();
- Cache.log.info("Jalview loading the Vamsas Session.");
- // load in the vamsas archive for the first time
- IClientDocument cdoc=null;
- try
- {
- cdoc = vclient.getClientDocument();
- }
- catch (IOException e)
- {
- Cache.log.error("Serious: Exception whilst getting vamsas document",e);
- return;
- }
- updateJalview(cdoc);
- updateJalviewGui();
- cdoc.setVamsasRoots(cdoc.getVamsasRoots()); // propagate update flags back
-
- try{
- vclient.updateDocument(cdoc);
- }
- catch (Exception e)
- {
- Cache.log.error("Serious: Exception whilst updating vamsas document.",e);
- return;
- }
- cdoc=null;
+ addDocumentUpdateHandler();
+ startSession();
+ Cache.log.debug("Jalview loading the Vamsas Session for the first time.");
+ dealWithDocumentUpdate();
+ Cache.log.debug("... finished update for the first time.");
}
/**
* Update all windows after a vamsas datamodel change.
*/
protected void updateJalviewGui()
{
- JInternalFrame[] frames = Desktop.desktop.getAllFrames();
+ JInternalFrame[] frames = jdesktop.getAllFrames();
if (frames == null)
{
e);
}
}
- /**
- * 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()
{
- disableGui(true);
- Cache.log.info("Jalview updating the Vamsas Session.");
+ Cache.log.info("Jalview updating to the Vamsas Session.");
+ dealWithDocumentUpdate();
+ /*
IClientDocument cdoc=null;
try
{
updateJalviewGui();
cdoc.setVamsasRoots(cdoc.getVamsasRoots()); // propagate update flags back
vclient.updateDocument(cdoc);
- disableGui(false);
- cdoc = null;
+ */
+ Cache.log.info("Jalview finished updating to the Vamsas Session.");
}
public void end_session()
} else {
Cache.log.warn("JV Client leaving a session that's its not joined yet.");
}
+ joinedSession=false;
vclient = null;
app=null; user = null;
jv2vobj = null;
public void updateJalview(IClientDocument cdoc)
{
+ Cache.log.debug("Jalview updating from sesion document ..");
ensureJvVamsas();
VamsasAppDatastore vds = new VamsasAppDatastore(cdoc, vobj2jv, jv2vobj,
baseProvEntry());
vds.updateToJalview();
+ Cache.log.debug(".. finished updating from sesion document.");
+
}
private void ensureJvVamsas()
{
pentry.setAction("created");
return pentry;
}
-
+ protected void dealWithDocumentUpdate()
+ {
+ // called by update handler for document update.
+ Cache.log.debug("Updating jalview from changed vamsas document.");
+ disableGui(true);
+ try {
+ IClientDocument cdoc = vclient.getClientDocument();
+ updateJalview(cdoc);
+ // cdoc.setVamsasRoots(cdoc.getVamsasRoots());
+ vclient.updateDocument(cdoc);
+ cdoc=null;
+ } catch (Exception ee) {
+ System.err.println("Exception whilst updating :");
+ ee.printStackTrace(System.err);
+ }
+ Cache.log.debug("Finished updating from document change.");
+ disableGui(false);
+ }
private void addDocumentUpdateHandler()
{
- final IClient vorbaclient = vclient;
final VamsasApplication client = this;
- vorbaclient.addDocumentUpdateHandler(new PropertyChangeListener() {
+ vclient.addDocumentUpdateHandler(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt)
{
- // update handler for document update.
- Cache.log.debug("Updating jalview from changed vamsas document.");
- client.disableGui(true);
- try {
- IClientDocument cdoc = vorbaclient.getClientDocument();
- client.updateJalview(cdoc);
- // cdoc.setVamsasRoots(cdoc.getVamsasRoots());
- vorbaclient.updateDocument(cdoc);
- cdoc=null;
- } catch (Exception ee) {
- System.err.println("Exception whilst updating :");
- ee.printStackTrace(System.err);
- }
- Cache.log.debug("Finished updating from document change.");
- client.disableGui(false);
+ Cache.log.debug("Dealing with document update event.");
+ client.dealWithDocumentUpdate();
+ Cache.log.debug("finished dealing with event.");
}
});
+ Cache.log.debug("Added Jalview handler for vamsas document updates.");
}
public void disableGui(boolean b)
{