Search in sources :

Example 1 with ExportDocument

use of cbit.vcell.client.task.ExportDocument in project vcell by virtualcell.

the class ClientRequestManager method exportDocument.

/**
 * Comment
 */
public void exportDocument(TopLevelWindowManager manager, FileFilter forceFilefilter) {
    /* block window */
    JFrame currentWindow = getMdiManager().blockWindow(manager.getManagerID());
    /* prepare hashtable for tasks */
    Hashtable<String, Object> hash = new Hashtable<String, Object>();
    hash.put("mdiManager", getMdiManager());
    hash.put(DocumentManager.IDENT, getDocumentManager());
    hash.put("topLevelWindowManager", manager);
    hash.put("currentWindow", currentWindow);
    hash.put("userPreferences", getUserPreferences());
    if (forceFilefilter != null) {
        hash.put(ChooseFile.FORCE_FILE_FILTER, forceFilefilter);
    }
    hash.put("CallAction", CallAction.EXPORT);
    hash.put(CommonTask.DOCUMENT_WINDOW_MANAGER.name, manager);
    hash.put("currentDocumentWindow", currentWindow);
    /* create tasks */
    AsynchClientTask documentValid = new DocumentValidTask();
    AsynchClientTask setMathDescription = new SetMathDescription();
    // get document to be exported
    AsynchClientTask documentToExport = new DocumentToExport();
    // get file
    AsynchClientTask chooseFile = new ChooseFile();
    // export it
    AsynchClientTask exportDocument = new ExportDocument();
    // clean-up
    AsynchClientTask finishExport = new FinishExport();
    // assemble array
    AsynchClientTask[] tasks = null;
    tasks = new AsynchClientTask[] { documentToExport, chooseFile, documentValid, setMathDescription, exportDocument, finishExport };
    /* run tasks */
    ClientTaskDispatcher.dispatch(currentWindow, hash, tasks, false);
}
Also used : DocumentValidTask(cbit.vcell.client.task.DocumentValidTask) AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) Hashtable(java.util.Hashtable) SetMathDescription(cbit.vcell.client.task.SetMathDescription) ExportDocument(cbit.vcell.client.task.ExportDocument) JFrame(javax.swing.JFrame) DocumentToExport(cbit.vcell.client.task.DocumentToExport) CSGObject(cbit.vcell.geometry.CSGObject) ChooseFile(cbit.vcell.client.task.ChooseFile) FinishExport(cbit.vcell.client.task.FinishExport)

Example 2 with ExportDocument

use of cbit.vcell.client.task.ExportDocument in project vcell by virtualcell.

the class GeometryViewer method exportGeometry.

private void exportGeometry() /*String exportType*/
{
    Objects.requireNonNull(documentWindowManager);
    AsynchClientTask computeSurface = new AsynchClientTask("computing Surface...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

        @Override
        public void run(Hashtable<String, Object> hashTable) throws Exception {
            if (getGeometry().getGeometrySurfaceDescription() == null || getGeometry().getGeometrySurfaceDescription().getSurfaceCollection() == null) {
                getGeometry().getGeometrySurfaceDescription().updateAll();
            }
        }
    };
    AsynchClientTask[] tasks = new AsynchClientTask[] { new ChooseFile(), computeSurface, new ExportDocument() };
    Hashtable<String, Object> hash = new Hashtable<String, Object>();
    hash.put("documentToExport", getGeometry());
    hash.put("userPreferences", documentWindowManager.getUserPreferences());
    hash.put(CommonTask.DOCUMENT_MANAGER.name, documentWindowManager.getRequestManager().getDocumentManager());
    hash.put("component", this);
    ClientTaskDispatcher.dispatch(this, hash, tasks, false);
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) Hashtable(java.util.Hashtable) ChooseFile(cbit.vcell.client.task.ChooseFile) ExportDocument(cbit.vcell.client.task.ExportDocument)

Aggregations

AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)2 ChooseFile (cbit.vcell.client.task.ChooseFile)2 ExportDocument (cbit.vcell.client.task.ExportDocument)2 Hashtable (java.util.Hashtable)2 DocumentToExport (cbit.vcell.client.task.DocumentToExport)1 DocumentValidTask (cbit.vcell.client.task.DocumentValidTask)1 FinishExport (cbit.vcell.client.task.FinishExport)1 SetMathDescription (cbit.vcell.client.task.SetMathDescription)1 CSGObject (cbit.vcell.geometry.CSGObject)1 JFrame (javax.swing.JFrame)1