use of cbit.vcell.client.server.ClientServerManager.InteractiveContextDefaultProvider in project vcell by virtualcell.
the class VCellClient method startClient.
/**
* Insert the method's description here.
* Creation date: (5/5/2004 3:51:06 PM)
* @param bioModel cbit.vcell.biomodel.BioModel
*/
public static VCellClient startClient(final VCDocument startupDoc, final ClientServerInfo clientServerInfo) {
/* Set Look and Feel */
VCellLookAndFeel.setVCellLookAndFeel();
// instantiate app
final VCellClient vcellClient = new VCellClient();
Hashtable<String, Object> hash = new Hashtable<String, Object>();
AsynchClientTask task1 = new AsynchClientTask("Starting Virtual Cell", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
// start management layer
InteractiveContextDefaultProvider defaultRequester = new VCellGuiInteractiveContextDefaultProvider();
vcellClient.setClientServerManager(new ClientServerManager(clientServerInfo, defaultRequester));
vcellClient.setRequestManager(new ClientRequestManager(vcellClient));
vcellClient.setMdiManager(new ClientMDIManager(vcellClient.getRequestManager()));
// start auxilliary stuff
vcellClient.startStatusThreads();
// make sure we have at least a blank document to start with
if (startupDoc != null) {
hashTable.put("startupDoc", startupDoc);
} else {
VCDocument newStartupDoc = ((ClientRequestManager) vcellClient.getRequestManager()).createDefaultDocument(VCDocumentType.BIOMODEL_DOC);
hashTable.put("startupDoc", newStartupDoc);
}
DocumentWindowAboutBox.parseVCellVersion();
}
};
AsynchClientTask task2 = new AsynchClientTask("Creating GUI", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
// fire up the GUI
VCDocument startupDoc = (VCDocument) hashTable.get("startupDoc");
// needs to be set first, else throw away dirty/needs paint information stored in previous instance.
RepaintManager.setCurrentManager(new VCellClient.CheckThreadViolationRepaintManager());
DocumentWindowManager currWindowManager = vcellClient.createAndShowGUI(startupDoc);
if (currWindowManager != null) {
hashTable.put("currWindowManager", currWindowManager);
}
if (clientServerInfo.getUsername() == null) {
// we were not supplied login credentials; pop-up dialog
VCellClient.login(vcellClient.getRequestManager(), clientServerInfo, currWindowManager);
}
}
};
AsynchClientTask task3 = new AsynchClientTask("Connecting to Server", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
// try server connection
if (clientServerInfo.getUsername() != null) {
DocumentWindowManager currWindowManager = (DocumentWindowManager) hashTable.get("currWindowManager");
// we were not supplied login credentials; pop-up dialog
vcellClient.getRequestManager().connectToServer(currWindowManager, clientServerInfo);
}
}
};
AsynchClientTask[] taskArray = new AsynchClientTask[] { task1, task2, task3 };
ClientTaskDispatcher.dispatch(null, hash, taskArray);
return vcellClient;
}
use of cbit.vcell.client.server.ClientServerManager.InteractiveContextDefaultProvider in project vcell by virtualcell.
the class ClientFactory method createRemoteClientServerManager.
public static ClientServerManager createRemoteClientServerManager(String apihost, Integer apiport, String username, String password) {
DigestedPassword digestedPassword = new DigestedPassword(password);
ClientServerInfo csInfo = ClientServerInfo.createRemoteServerInfo(apihost, apiport, username, digestedPassword);
InteractiveContextDefaultProvider defaultInteractiveContextProvider = new VCellGuiInteractiveContextDefaultProvider();
ClientServerManager clientServerManager = new ClientServerManager(csInfo, defaultInteractiveContextProvider);
RequestManagerAdapter requestManager = new RequestManagerAdapter();
TopLevelWindowManager windowManager = new TopLevelWindowManager(requestManager) {
@Override
public Component getComponent() {
return null;
}
@Override
public String getManagerID() {
return null;
}
@Override
public boolean isRecyclable() {
return false;
}
};
InteractiveContext requester = new VCellGuiInteractiveContext(windowManager);
clientServerManager.connect(requester);
return clientServerManager;
}
use of cbit.vcell.client.server.ClientServerManager.InteractiveContextDefaultProvider in project vcell by virtualcell.
the class ClientFactory method createLocalClientServerManager.
public static ClientServerManager createLocalClientServerManager(String userid, String password) {
DigestedPassword digestedPassword = new DigestedPassword(password);
ClientServerInfo csInfo = ClientServerInfo.createLocalServerInfo(userid, digestedPassword);
InteractiveContextDefaultProvider defaultInteractiveContextProvider = new VCellGuiInteractiveContextDefaultProvider();
ClientServerManager clientServerManager = new ClientServerManager(csInfo, defaultInteractiveContextProvider);
clientServerManager.connect(null);
return clientServerManager;
}
Aggregations