use of cbit.vcell.client.DocumentWindowManager in project vcell by virtualcell.
the class DocumentWindow method setWindowManager.
/**
* Sets the windowManager property (cbit.vcell.client.desktop.DocumentWindowManager) value.
* @param windowManager The new value for the property.
* @see #getWindowManager
*/
public void setWindowManager(DocumentWindowManager windowManager) {
if (fieldWindowManager == windowManager) {
return;
}
DocumentWindowManager oldValue = fieldWindowManager;
fieldWindowManager = windowManager;
// May 2009,found it doesn't fire to any where.
firePropertyChange("windowManager", oldValue, windowManager);
// if (windowManager.getTaskBar() != null) {
// windowManager.getTaskBar().setBackground(getStatusBarPane().getBackground());
// getStatusBarPane().add(windowManager.getTaskBar(), BorderLayout.CENTER);
// }
}
use of cbit.vcell.client.DocumentWindowManager in project vcell by virtualcell.
the class DocumentWindow method startVirtualFRAP.
private void startVirtualFRAP() {
final DocumentWindowManager dwm = getWindowManager();
final Hashtable<String, Object> ht = new Hashtable<>();
ClientTaskDispatcher.dispatch(this, ht, LaunchVirtualFRAP.taskList(dwm), true, false, false, null, false);
}
use of cbit.vcell.client.DocumentWindowManager 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 cbit.vcell.client.DocumentWindowManager in project vcell by virtualcell.
the class CheckUnchanged 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 documentWindowManager = (DocumentWindowManager) hashTable.get(CommonTask.DOCUMENT_WINDOW_MANAGER.name);
DocumentManager documentManager = (DocumentManager) hashTable.get(CommonTask.DOCUMENT_MANAGER.name);
// JFrame currentDocumentWindow = (JFrame)hashTable.get("currentDocumentWindow");
if (documentWindowManager.getVCDocument().getDocumentType() == VCDocumentType.MATHMODEL_DOC) {
if (((MathModelWindowManager) documentWindowManager).hasUnappliedChanges()) {
String msg = "Changes have been made in VCML Editor, please click \"Apply Changes\" or \"Cancel\" to proceed.";
PopupGenerator.showErrorDialog(documentWindowManager, msg);
throw UserCancelException.CANCEL_UNAPPLIED_CHANGES;
}
}
boolean isChanged = true;
Version v = documentWindowManager.getVCDocument().getVersion();
if (v == null || !v.getOwner().equals(documentManager.getSessionManager().getUser())) {
isChanged = true;
} else {
try {
isChanged = documentManager.isChanged(documentWindowManager.getVCDocument());
} catch (DataAccessException exc) {
String choice = PopupGenerator.showWarningDialog(documentWindowManager, documentWindowManager.getUserPreferences(), UserMessage.warn_UnableToCheckForChanges, null);
if (!choice.equals(UserMessage.OPTION_CONTINUE)) {
throw UserCancelException.WARN_UNABLE_CHECK;
}
}
}
if (!isChanged) {
if (whileSavingForRunningSims) {
// just skip the saves and go ahead
hashTable.put("conditionalSkip", new String[] { SaveDocument.class.getName(), CheckBeforeDelete.class.getName(), DeleteOldDocument.class.getName() });
} else {
String choice = PopupGenerator.showWarningDialog(documentWindowManager, documentWindowManager.getUserPreferences(), UserMessage.warn_UnchangedDocument, null);
if (choice.equals(UserMessage.OPTION_SAVE_AS_NEW)) {
// user chose to Save As
throw UserCancelException.CHOOSE_SAVE_AS;
} else {
// user canceled, just show existing document
throw UserCancelException.WARN_NO_CHANGES;
}
}
}
}
use of cbit.vcell.client.DocumentWindowManager 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