Search in sources :

Example 11 with DocumentWindow

use of cbit.vcell.client.desktop.DocumentWindow in project vcell by virtualcell.

the class ClientMDIManager method createNewDocumentWindow.

/**
 * Insert the method's description here.
 * Creation date: (5/24/2004 11:20:58 AM)
 * @param vcDocument cbit.vcell.document.VCDocument
 */
public DocumentWindow createNewDocumentWindow(final DocumentWindowManager windowManager) {
    // used for opening new document windows
    // assumes caller checked for having this document already open
    // keep track of things
    String windowID = windowManager.getManagerID();
    // make the window
    DocumentWindow documentWindow = createDocumentWindow();
    documentWindow.setWorkArea(windowManager.getComponent());
    getWindowsHash().put(windowID, documentWindow);
    getManagersHash().put(windowID, windowManager);
    // wire manager to events
    getRequestManager().getAsynchMessageManager().addSimStatusListener(windowManager);
    getRequestManager().getAsynchMessageManager().addExportListener(windowManager);
    getRequestManager().getAsynchMessageManager().addDataJobListener(windowManager);
    // get the window ready
    setCanonicalTitle(windowID);
    documentWindow.setWindowManager(windowManager);
    // listen for event when user clicks window close button and send request to manager
    documentWindow.addWindowListener(windowListener);
    setNewlyCreatedDesktops(getNumCreatedDocumentWindows() + 1);
    // initialize status bar with current status (also syncs all other windows)
    getRequestManager().updateStatusNow();
    // done
    documentWindow.setVisible(true);
    return documentWindow;
}
Also used : DocumentWindow(cbit.vcell.client.desktop.DocumentWindow)

Example 12 with DocumentWindow

use of cbit.vcell.client.desktop.DocumentWindow in project vcell by virtualcell.

the class ClientRequestManager method createMathModelFromApplication.

/**
 * Insert the method's description here.
 * Creation date: (5/24/2004 12:22:11 PM)
 * @param windowID java.lang.String
 */
public void createMathModelFromApplication(final BioModelWindowManager requester, final String name, final SimulationContext simContext) {
    if (simContext == null) {
        PopupGenerator.showErrorDialog(requester, "Selected Application is null, cannot generate corresponding math model");
        return;
    }
    switch(simContext.getApplicationType()) {
        case NETWORK_STOCHASTIC:
            break;
        case RULE_BASED_STOCHASTIC:
        case NETWORK_DETERMINISTIC:
    }
    AsynchClientTask task1 = new AsynchClientTask("Creating MathModel from BioModel Application", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

        @Override
        public void run(Hashtable<String, Object> hashTable) throws Exception {
            MathModel newMathModel = new MathModel(null);
            // Get corresponding mathDesc to create new mathModel.
            MathDescription mathDesc = simContext.getMathDescription();
            MathDescription newMathDesc = null;
            newMathDesc = new MathDescription(name + "_" + (new java.util.Random()).nextInt());
            try {
                if (mathDesc.getGeometry().getDimension() > 0 && mathDesc.getGeometry().getGeometrySurfaceDescription().getGeometricRegions() == null) {
                    mathDesc.getGeometry().getGeometrySurfaceDescription().updateAll();
                }
            } catch (ImageException e) {
                e.printStackTrace(System.out);
                throw new RuntimeException("Geometric surface generation error:\n" + e.getMessage());
            } catch (GeometryException e) {
                e.printStackTrace(System.out);
                throw new RuntimeException("Geometric surface generation error:\n" + e.getMessage());
            }
            newMathDesc.setGeometry(mathDesc.getGeometry());
            newMathDesc.read_database(new CommentStringTokenizer(mathDesc.getVCML_database()));
            newMathDesc.isValid();
            newMathModel.setName(name);
            newMathModel.setMathDescription(newMathDesc);
            hashTable.put("newMathModel", newMathModel);
        }
    };
    AsynchClientTask task2 = new AsynchClientTask("Creating MathModel from BioModel Application", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

        @Override
        public void run(Hashtable<String, Object> hashTable) throws Exception {
            MathModel newMathModel = (MathModel) hashTable.get("newMathModel");
            DocumentWindowManager windowManager = createDocumentWindowManager(newMathModel);
            if (simContext.getBioModel().getVersion() != null) {
                ((MathModelWindowManager) windowManager).setCopyFromBioModelAppVersionableTypeVersion(new VersionableTypeVersion(VersionableType.BioModelMetaData, simContext.getBioModel().getVersion()));
            }
            DocumentWindow dw = getMdiManager().createNewDocumentWindow(windowManager);
            setFinalWindow(hashTable, dw);
        }
    };
    ClientTaskDispatcher.dispatch(requester.getComponent(), new Hashtable<String, Object>(), new AsynchClientTask[] { task1, task2 }, false);
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) MathModel(cbit.vcell.mathmodel.MathModel) ImageException(cbit.image.ImageException) VersionableTypeVersion(org.vcell.util.document.VersionableTypeVersion) SetMathDescription(cbit.vcell.client.task.SetMathDescription) MathDescription(cbit.vcell.math.MathDescription) Hashtable(java.util.Hashtable) GeometryException(cbit.vcell.geometry.GeometryException) Random(java.util.Random) DocumentWindow(cbit.vcell.client.desktop.DocumentWindow) CommentStringTokenizer(org.vcell.util.CommentStringTokenizer) CSGObject(cbit.vcell.geometry.CSGObject)

Aggregations

DocumentWindow (cbit.vcell.client.desktop.DocumentWindow)12 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)5 Hashtable (java.util.Hashtable)5 Component (java.awt.Component)4 File (java.io.File)4 UserCancelException (org.vcell.util.UserCancelException)4 ExternalDataIdentifier (org.vcell.util.document.ExternalDataIdentifier)4 ImageException (cbit.image.ImageException)3 ImageDataset (cbit.vcell.VirtualMicroscopy.ImageDataset)3 DocumentManager (cbit.vcell.clientdb.DocumentManager)3 FieldDataSymbol (cbit.vcell.data.FieldDataSymbol)3 VariableType (cbit.vcell.math.VariableType)3 VCImageUncompressed (cbit.image.VCImageUncompressed)2 AnnotatedImageDataset (cbit.vcell.VirtualMicroscopy.importer.AnnotatedImageDataset)2 MicroscopyXmlReader (cbit.vcell.VirtualMicroscopy.importer.MicroscopyXmlReader)2 BioModelWindowManager (cbit.vcell.client.BioModelWindowManager)2 RequestManager (cbit.vcell.client.RequestManager)2 DataSymbol (cbit.vcell.data.DataSymbol)2 FieldDataFileOperationSpec (cbit.vcell.field.io.FieldDataFileOperationSpec)2 CSGObject (cbit.vcell.geometry.CSGObject)2