use of org.vcell.util.document.VCDocumentInfo in project vcell by virtualcell.
the class TestingFrameworkWindowPanel method getUserSelectedSimulationInfo.
private TFGenerateReport.VCDocumentAndSimInfo getUserSelectedSimulationInfo() throws Exception {
final String CANCEL_STRING = "Cancel";
final String BM_STRING = "BioModel";
final String MM_STRING = "MathModel";
String result = PopupGenerator.showWarningDialog(this, "Choose Reference Model Type.", new String[] { BM_STRING, MM_STRING, CANCEL_STRING }, CANCEL_STRING);
if (result == null || result.equals(CANCEL_STRING)) {
throw UserCancelException.CANCEL_GENERIC;
}
VCDocumentInfo userDefinedRegrRefModel = null;
VCDocument vcDocument = null;
if (result.equals(BM_STRING)) {
userDefinedRegrRefModel = getTestingFrameworkWindowManager().getRequestManager().selectBioModelInfo(getTestingFrameworkWindowManager());
vcDocument = getTestingFrameworkWindowManager().getRequestManager().getDocumentManager().getBioModel(userDefinedRegrRefModel.getVersion().getVersionKey());
} else {
userDefinedRegrRefModel = getTestingFrameworkWindowManager().getRequestManager().selectMathModelInfo(getTestingFrameworkWindowManager());
vcDocument = getTestingFrameworkWindowManager().getRequestManager().getDocumentManager().getMathModel(userDefinedRegrRefModel.getVersion().getVersionKey());
}
SimulationInfo simInfo = getTestingFrameworkWindowManager().getUserSelectedRefSimInfo(getTestingFrameworkWindowManager().getRequestManager(), userDefinedRegrRefModel);
TFGenerateReport.VCDocumentAndSimInfo vcDocumentAndsimInfo = new TFGenerateReport.VCDocumentAndSimInfo(simInfo, vcDocument);
return vcDocumentAndsimInfo;
}
use of org.vcell.util.document.VCDocumentInfo in project vcell by virtualcell.
the class DocumentToExport method run.
/**
* Insert the method's description here. Creation date: (5/31/2004 6:04:14
* PM)
*
* @param hashTable
* java.util.Hashtable
* @param clientWorker
* cbit.vcell.desktop.controls.ClientWorker
*/
@Override
public void run(Hashtable<String, Object> hashTable) throws java.lang.Exception {
TopLevelWindowManager topLevelWindowManager = extractRequired(hashTable, TopLevelWindowManager.class, "topLevelWindowManager");
VCDocument doc = null;
if (topLevelWindowManager instanceof DocumentWindowManager) {
doc = ((DocumentWindowManager) topLevelWindowManager).getVCDocument();
} else if (topLevelWindowManager instanceof DatabaseWindowManager) {
DocumentManager documentManager = extractRequired(hashTable, DocumentManager.class, CommonTask.DOCUMENT_MANAGER.name);
VCDocumentInfo documentInfo = ((DatabaseWindowManager) topLevelWindowManager).getPanelSelection();
if (documentInfo instanceof BioModelInfo) {
BioModelInfo bmi = (BioModelInfo) documentInfo;
doc = documentManager.getBioModel(bmi);
} else if (documentInfo instanceof MathModelInfo) {
MathModelInfo mmi = (MathModelInfo) documentInfo;
doc = documentManager.getMathModel(mmi);
} else if (documentInfo instanceof GeometryInfo) {
GeometryInfo gmi = (GeometryInfo) documentInfo;
doc = documentManager.getGeometry(gmi);
}
if (doc == null) {
throw new IllegalStateException("export called on DatabaseWindowManager with selection " + documentInfo);
}
}
if (doc != null) {
hashTable.put(EXPORT_DOCUMENT, doc);
} else {
throw new UnsupportedOperationException("TopLevelWindowManager subclass " + topLevelWindowManager.getClass().getName() + " does not support exporting to document");
}
}
use of org.vcell.util.document.VCDocumentInfo in project vcell by virtualcell.
the class ClientRequestManager method revertToSaved.
/**
* Insert the method's description here.
* Creation date: (6/9/2004 1:07:09 PM)
* @param vcDocument cbit.vcell.document.VCDocument
*/
public void revertToSaved(DocumentWindowManager documentWindowManager) {
// make the info
VCDocument document = documentWindowManager.getVCDocument();
VCDocumentInfo info = null;
try {
KeyValue versionKey = document.getVersion().getVersionKey();
switch(document.getDocumentType()) {
case BIOMODEL_DOC:
{
info = getDocumentManager().getBioModelInfo(versionKey);
break;
}
case MATHMODEL_DOC:
{
info = getDocumentManager().getMathModelInfo(versionKey);
break;
}
case GEOMETRY_DOC:
{
info = getDocumentManager().getGeometryInfo(versionKey);
break;
}
}
} catch (DataAccessException e) {
e.printStackTrace(System.out);
throw new RuntimeException(e.getMessage());
}
// reload and reset into same window
openAfterChecking(info, documentWindowManager, false);
}
use of org.vcell.util.document.VCDocumentInfo in project vcell by virtualcell.
the class ClientRequestManager method openDocument.
public void openDocument(VCDocumentType documentType, DocumentWindowManager requester) {
/* trying to open from database; called by DocumentWindow */
// get an info first
VCDocumentInfo documentInfo = null;
try {
documentInfo = getMdiManager().getDatabaseWindowManager().selectDocument(documentType, requester);
// check whether request comes from a blank, unchanged document window; if so, open in same window, otherwise in a new window
boolean inNewWindow = isDifferentFromBlank(documentType, requester.getVCDocument());
openDocument(documentInfo, requester, inNewWindow);
} catch (UserCancelException uexc) {
System.out.println(uexc);
return;
} catch (Exception exc) {
exc.printStackTrace(System.out);
PopupGenerator.showErrorDialog(requester, "Open document failed\n" + exc.getMessage(), exc);
}
}
use of org.vcell.util.document.VCDocumentInfo in project vcell by virtualcell.
the class ClientRequestManager method createSelectLoadGeomTask.
private AsynchClientTask createSelectLoadGeomTask(final TopLevelWindowManager requester) {
AsynchClientTask selectLoadGeomTask = new AsynchClientTask("Select/Load geometry...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
VersionInfo vcVersionInfo = (VersionInfo) hashTable.get(VERSIONINFO_KEY);
Geometry geom = null;
if (vcVersionInfo instanceof VCDocumentInfo) {
geom = getGeometryFromDocumentSelection(requester.getComponent(), (VCDocumentInfo) vcVersionInfo, false);
} else if (vcVersionInfo instanceof VCImageInfo) {
VCImage img = getDocumentManager().getImage((VCImageInfo) vcVersionInfo);
geom = new Geometry("createSelectLoadGeomTask", img);
} else {
throw new Exception("Unexpected versioninfo type.");
}
// pregenerate sampled image, cpu intensive
geom.precomputeAll(new GeometryThumbnailImageFactoryAWT());
hashTable.put(GEOMETRY_KEY, geom);
}
};
return selectLoadGeomTask;
}
Aggregations