Search in sources :

Example 21 with VCDocumentInfo

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;
}
Also used : VCDocument(org.vcell.util.document.VCDocument) VCDocumentInfo(org.vcell.util.document.VCDocumentInfo) TFGenerateReport(cbit.vcell.client.task.TFGenerateReport) SimulationInfo(cbit.vcell.solver.SimulationInfo)

Example 22 with VCDocumentInfo

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");
    }
}
Also used : VCDocument(org.vcell.util.document.VCDocument) TopLevelWindowManager(cbit.vcell.client.TopLevelWindowManager) DocumentWindowManager(cbit.vcell.client.DocumentWindowManager) VCDocumentInfo(org.vcell.util.document.VCDocumentInfo) DocumentManager(cbit.vcell.clientdb.DocumentManager) BioModelInfo(org.vcell.util.document.BioModelInfo) GeometryInfo(cbit.vcell.geometry.GeometryInfo) MathModelInfo(org.vcell.util.document.MathModelInfo) DatabaseWindowManager(cbit.vcell.client.DatabaseWindowManager)

Example 23 with VCDocumentInfo

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);
}
Also used : KeyValue(org.vcell.util.document.KeyValue) VCDocument(org.vcell.util.document.VCDocument) VCDocumentInfo(org.vcell.util.document.VCDocumentInfo) DataAccessException(org.vcell.util.DataAccessException)

Example 24 with VCDocumentInfo

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);
    }
}
Also used : VCDocumentInfo(org.vcell.util.document.VCDocumentInfo) UserCancelException(org.vcell.util.UserCancelException) ProgrammingException(org.vcell.util.ProgrammingException) GeometryException(cbit.vcell.geometry.GeometryException) IOException(java.io.IOException) DataAccessException(org.vcell.util.DataAccessException) PropertyVetoException(java.beans.PropertyVetoException) ImageException(cbit.image.ImageException) UtilCancelException(org.vcell.util.UtilCancelException) DataFormatException(java.util.zip.DataFormatException) UserCancelException(org.vcell.util.UserCancelException)

Example 25 with VCDocumentInfo

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;
}
Also used : Geometry(cbit.vcell.geometry.Geometry) VersionInfo(org.vcell.util.document.VersionInfo) GeometryThumbnailImageFactoryAWT(cbit.vcell.geometry.GeometryThumbnailImageFactoryAWT) AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) VCDocumentInfo(org.vcell.util.document.VCDocumentInfo) Hashtable(java.util.Hashtable) VCImage(cbit.image.VCImage) VCImageInfo(cbit.image.VCImageInfo) ProgrammingException(org.vcell.util.ProgrammingException) GeometryException(cbit.vcell.geometry.GeometryException) IOException(java.io.IOException) DataAccessException(org.vcell.util.DataAccessException) PropertyVetoException(java.beans.PropertyVetoException) ImageException(cbit.image.ImageException) UtilCancelException(org.vcell.util.UtilCancelException) DataFormatException(java.util.zip.DataFormatException) UserCancelException(org.vcell.util.UserCancelException)

Aggregations

VCDocumentInfo (org.vcell.util.document.VCDocumentInfo)27 DataAccessException (org.vcell.util.DataAccessException)15 BioModelInfo (org.vcell.util.document.BioModelInfo)15 MathModelInfo (org.vcell.util.document.MathModelInfo)14 GeometryInfo (cbit.vcell.geometry.GeometryInfo)10 VCDocument (org.vcell.util.document.VCDocument)8 UserCancelException (org.vcell.util.UserCancelException)7 Vector (java.util.Vector)6 KeyValue (org.vcell.util.document.KeyValue)6 PropertyVetoException (java.beans.PropertyVetoException)5 Hashtable (java.util.Hashtable)5 UtilCancelException (org.vcell.util.UtilCancelException)5 ImageException (cbit.image.ImageException)4 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)4 GeometryException (cbit.vcell.geometry.GeometryException)4 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)4 DataFormatException (java.util.zip.DataFormatException)4 ObjectNotFoundException (org.vcell.util.ObjectNotFoundException)4 DocumentWindowManager (cbit.vcell.client.DocumentWindowManager)3