Search in sources :

Example 6 with DocumentWindowManager

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);
// }
}
Also used : DocumentWindowManager(cbit.vcell.client.DocumentWindowManager)

Example 7 with DocumentWindowManager

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);
}
Also used : DocumentWindowManager(cbit.vcell.client.DocumentWindowManager) Hashtable(java.util.Hashtable) EventObject(java.util.EventObject)

Example 8 with DocumentWindowManager

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;
        }
    }
}
Also used : VCDocument(org.vcell.util.document.VCDocument) Simulation(cbit.vcell.solver.Simulation) DocumentWindowManager(cbit.vcell.client.DocumentWindowManager) Version(org.vcell.util.document.Version) DocumentManager(cbit.vcell.clientdb.DocumentManager)

Example 9 with DocumentWindowManager

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;
            }
        }
    }
}
Also used : DocumentWindowManager(cbit.vcell.client.DocumentWindowManager) Version(org.vcell.util.document.Version) DocumentManager(cbit.vcell.clientdb.DocumentManager) MathModelWindowManager(cbit.vcell.client.MathModelWindowManager) DataAccessException(org.vcell.util.DataAccessException)

Example 10 with DocumentWindowManager

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;
    }
}
Also used : Geometry(cbit.vcell.geometry.Geometry) MathModel(cbit.vcell.mathmodel.MathModel) VCDocument(org.vcell.util.document.VCDocument) DocumentWindowManager(cbit.vcell.client.DocumentWindowManager) BioModel(cbit.vcell.biomodel.BioModel) DocumentManager(cbit.vcell.clientdb.DocumentManager) BioModelInfo(org.vcell.util.document.BioModelInfo) GeometryInfo(cbit.vcell.geometry.GeometryInfo) MathModelInfo(org.vcell.util.document.MathModelInfo)

Aggregations

DocumentWindowManager (cbit.vcell.client.DocumentWindowManager)15 VCDocument (org.vcell.util.document.VCDocument)9 BioModel (cbit.vcell.biomodel.BioModel)6 DocumentManager (cbit.vcell.clientdb.DocumentManager)6 MathModel (cbit.vcell.mathmodel.MathModel)4 Simulation (cbit.vcell.solver.Simulation)4 SimulationContext (cbit.vcell.mapping.SimulationContext)3 VCDocumentInfo (org.vcell.util.document.VCDocumentInfo)3 MDIManager (cbit.vcell.client.MDIManager)2 MathModelWindowManager (cbit.vcell.client.MathModelWindowManager)2 Geometry (cbit.vcell.geometry.Geometry)2 GeometryInfo (cbit.vcell.geometry.GeometryInfo)2 MathDescription (cbit.vcell.math.MathDescription)2 Component (java.awt.Component)2 Hashtable (java.util.Hashtable)2 BioModelInfo (org.vcell.util.document.BioModelInfo)2 MathModelInfo (org.vcell.util.document.MathModelInfo)2 Version (org.vcell.util.document.Version)2 ClientSimManager (cbit.vcell.client.ClientSimManager)1 DatabaseWindowManager (cbit.vcell.client.DatabaseWindowManager)1