use of cbit.vcell.client.desktop.DocumentWindow in project vcell by virtualcell.
the class ClientMDIManager method createNewDocumentWindow.
/**
* Insert the method's description here.
* Creation date: (5/24/2004 11:20:58 AM)
* @param vcDocument cbit.vcell.document.VCDocument
*/
public DocumentWindow createNewDocumentWindow(final DocumentWindowManager windowManager) {
// used for opening new document windows
// assumes caller checked for having this document already open
// keep track of things
String windowID = windowManager.getManagerID();
// make the window
DocumentWindow documentWindow = createDocumentWindow();
documentWindow.setWorkArea(windowManager.getComponent());
getWindowsHash().put(windowID, documentWindow);
getManagersHash().put(windowID, windowManager);
// wire manager to events
getRequestManager().getAsynchMessageManager().addSimStatusListener(windowManager);
getRequestManager().getAsynchMessageManager().addExportListener(windowManager);
getRequestManager().getAsynchMessageManager().addDataJobListener(windowManager);
// get the window ready
setCanonicalTitle(windowID);
documentWindow.setWindowManager(windowManager);
// listen for event when user clicks window close button and send request to manager
documentWindow.addWindowListener(windowListener);
setNewlyCreatedDesktops(getNumCreatedDocumentWindows() + 1);
// initialize status bar with current status (also syncs all other windows)
getRequestManager().updateStatusNow();
// done
documentWindow.setVisible(true);
return documentWindow;
}
use of cbit.vcell.client.desktop.DocumentWindow in project vcell by virtualcell.
the class ClientRequestManager method createMathModelFromApplication.
/**
* Insert the method's description here.
* Creation date: (5/24/2004 12:22:11 PM)
* @param windowID java.lang.String
*/
public void createMathModelFromApplication(final BioModelWindowManager requester, final String name, final SimulationContext simContext) {
if (simContext == null) {
PopupGenerator.showErrorDialog(requester, "Selected Application is null, cannot generate corresponding math model");
return;
}
switch(simContext.getApplicationType()) {
case NETWORK_STOCHASTIC:
break;
case RULE_BASED_STOCHASTIC:
case NETWORK_DETERMINISTIC:
}
AsynchClientTask task1 = new AsynchClientTask("Creating MathModel from BioModel Application", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
MathModel newMathModel = new MathModel(null);
// Get corresponding mathDesc to create new mathModel.
MathDescription mathDesc = simContext.getMathDescription();
MathDescription newMathDesc = null;
newMathDesc = new MathDescription(name + "_" + (new java.util.Random()).nextInt());
try {
if (mathDesc.getGeometry().getDimension() > 0 && mathDesc.getGeometry().getGeometrySurfaceDescription().getGeometricRegions() == null) {
mathDesc.getGeometry().getGeometrySurfaceDescription().updateAll();
}
} catch (ImageException e) {
e.printStackTrace(System.out);
throw new RuntimeException("Geometric surface generation error:\n" + e.getMessage());
} catch (GeometryException e) {
e.printStackTrace(System.out);
throw new RuntimeException("Geometric surface generation error:\n" + e.getMessage());
}
newMathDesc.setGeometry(mathDesc.getGeometry());
newMathDesc.read_database(new CommentStringTokenizer(mathDesc.getVCML_database()));
newMathDesc.isValid();
newMathModel.setName(name);
newMathModel.setMathDescription(newMathDesc);
hashTable.put("newMathModel", newMathModel);
}
};
AsynchClientTask task2 = new AsynchClientTask("Creating MathModel from BioModel Application", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
MathModel newMathModel = (MathModel) hashTable.get("newMathModel");
DocumentWindowManager windowManager = createDocumentWindowManager(newMathModel);
if (simContext.getBioModel().getVersion() != null) {
((MathModelWindowManager) windowManager).setCopyFromBioModelAppVersionableTypeVersion(new VersionableTypeVersion(VersionableType.BioModelMetaData, simContext.getBioModel().getVersion()));
}
DocumentWindow dw = getMdiManager().createNewDocumentWindow(windowManager);
setFinalWindow(hashTable, dw);
}
};
ClientTaskDispatcher.dispatch(requester.getComponent(), new Hashtable<String, Object>(), new AsynchClientTask[] { task1, task2 }, false);
}
Aggregations