use of org.vcell.util.document.VCDocument 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.VCDocument in project vcell by virtualcell.
the class ClientRequestManager method checkBeforeClosing.
/**
* Insert the method's description here.
* Creation date: (5/21/2004 4:20:47 AM)
* @param windowManager cbit.vcell.client.desktop.DocumentWindowManager
*/
private CloseOption checkBeforeClosing(DocumentWindowManager windowManager) {
getMdiManager().showWindow(windowManager.getManagerID());
// we need to check for changes and get user confirmation...
VCDocument vcDocument = windowManager.getVCDocument();
if (vcDocument.getVersion() == null && !isDifferentFromBlank(vcDocument.getDocumentType(), vcDocument)) {
return CloseOption.CLOSE_IN_ANY_CASE;
}
boolean isChanged = true;
try {
isChanged = getDocumentManager().isChanged(vcDocument);
} catch (Exception exc) {
exc.printStackTrace();
String choice = PopupGenerator.showWarningDialog(windowManager, getUserPreferences(), UserMessage.warn_UnableToCheckForChanges, null);
if (choice.equals(UserMessage.OPTION_CANCEL)) {
// user canceled
return CloseOption.CANCEL_CLOSE;
}
}
// warn if necessary
if (isChanged) {
String choice = PopupGenerator.showWarningDialog(windowManager, getUserPreferences(), UserMessage.warn_close, null);
if (choice.equals(UserMessage.OPTION_CANCEL)) {
// user canceled
return CloseOption.CANCEL_CLOSE;
}
if (choice.equals(UserMessage.OPTION_YES)) {
return CloseOption.SAVE_AND_CLOSE;
}
}
// nothing changed, or user confirmed, close it
return CloseOption.CLOSE_IN_ANY_CASE;
}
use of org.vcell.util.document.VCDocument in project vcell by virtualcell.
the class IssueTableModel method getValueAt.
public Object getValueAt(int rowIndex, int columnIndex) {
VCDocument vcDocument = (issueManager != null) ? (issueManager.getVCDocument()) : null;
Issue issue = getValueAt(rowIndex);
switch(columnIndex) {
case COLUMN_DESCRIPTION:
return issue;
case COLUMN_URL:
{
String url = issue.getHyperlink();
if (url == null) {
return "";
}
return "<html><a href=\"" + url + "\">More</a></html>";
}
case COLUMN_SOURCE:
return getSourceObjectDescription(vcDocument, issue);
case COLUMN_PATH:
return getSourceObjectPathDescription(vcDocument, issue);
}
return null;
}
use of org.vcell.util.document.VCDocument in project vcell by virtualcell.
the class CheckBeforeDelete 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
*/
public void run(Hashtable<String, Object> hashTable) throws Exception {
DocumentWindowManager documentWindowManager = (DocumentWindowManager) hashTable.get(CommonTask.DOCUMENT_WINDOW_MANAGER.name);
// JFrame currentDocumentWindow = (JFrame)hashTable.get("currentDocumentWindow");
VCDocument currentDocument = documentWindowManager.getVCDocument();
if (!hashTable.containsKey(SaveDocument.DOC_KEY)) {
throw new RuntimeException("CheckBeforeDelete task called although SaveDocument task did not complete - should have aborted!!");
}
// Don't delete ARCHIVE or PUBLISH documents
if (!currentDocument.getVersion().getFlag().compareEqual(VersionFlag.Current)) {
hashTable.put("conditionalSkip", new String[] { DeleteOldDocument.class.getName() });
return;
}
DocumentManager documentManager = (DocumentManager) hashTable.get(CommonTask.DOCUMENT_MANAGER.name);
Simulation[] simulations = (Simulation[]) hashTable.get("simulations");
VCDocument savedDocument = (VCDocument) hashTable.get(SaveDocument.DOC_KEY);
// just to make sure, verify that we actually did save a new edition
Version oldVersion = currentDocument.getVersion();
Version newVersion = savedDocument.getVersion();
if (newVersion.getVersionKey().compareEqual(oldVersion.getVersionKey())) {
// throw new DataAccessException("CheckBeforeDelete task called but saved document has same version with current document");
hashTable.put("conditionalSkip", new String[] { DeleteOldDocument.class.getName() });
return;
}
// we saved a new one, now check for lost simulation data and warn the user
Simulation[] simulationsWithLostResults = null;
switch(currentDocument.getDocumentType()) {
case BIOMODEL_DOC:
{
simulationsWithLostResults = checkLostResults((BioModel) currentDocument, (BioModel) savedDocument, documentManager, simulations);
break;
}
case MATHMODEL_DOC:
{
simulationsWithLostResults = checkLostResults((MathModel) currentDocument, (MathModel) savedDocument, documentManager, simulations);
break;
}
case GEOMETRY_DOC:
default:
// nothing to check for in this case
return;
}
boolean bLost = simulationsWithLostResults != null && simulationsWithLostResults.length > 0;
if (bLost) {
String choice = PopupGenerator.showWarningDialog(documentWindowManager, documentWindowManager.getUserPreferences(), UserMessage.question_LostResults, null);
if (choice.equals(UserMessage.OPTION_SAVE_AS_NEW_EDITION)) {
// user canceled deletion
throw UserCancelException.CANCEL_DELETE_OLD;
}
if (choice.equals(UserMessage.OPTION_CANCEL)) {
throw UserCancelException.CANCEL_GENERIC;
}
}
}
use of org.vcell.util.document.VCDocument in project vcell by virtualcell.
the class DeleteOldDocument 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
*/
public void run(Hashtable<String, Object> hashTable) throws java.lang.Exception {
DocumentWindowManager dwm = (DocumentWindowManager) fetch(hashTable, DOCUMENT_WINDOW_MANAGER);
VCDocument currentDocument = dwm.getVCDocument();
DocumentManager documentManager = (DocumentManager) fetch(hashTable, DOCUMENT_MANAGER);
switch(currentDocument.getDocumentType()) {
case BIOMODEL_DOC:
{
// make the info
BioModel oldBioModel = (BioModel) currentDocument;
BioModelInfo oldBioModelInfo = documentManager.getBioModelInfo(oldBioModel.getVersion().getVersionKey());
// delete document
documentManager.delete(oldBioModelInfo);
break;
}
case MATHMODEL_DOC:
{
// make the info
MathModel oldMathModel = (MathModel) currentDocument;
MathModelInfo oldMathModelInfo = documentManager.getMathModelInfo(oldMathModel.getVersion().getVersionKey());
// delete document
documentManager.delete(oldMathModelInfo);
break;
}
case GEOMETRY_DOC:
{
// make the info
Geometry oldGeometry = (Geometry) currentDocument;
GeometryInfo oldGeometryInfo = documentManager.getGeometryInfo(oldGeometry.getVersion().getVersionKey());
// delete document
documentManager.delete(oldGeometryInfo);
break;
}
default:
break;
}
}
Aggregations