Search in sources :

Example 1 with LWFileChooser

use of org.vcell.client.logicalwindow.LWFileChooser in project vcell by virtualcell.

the class VirtualFrapLoader method loadVFRAP.

// the function is called when activate in VCell or as standalone.
public static void loadVFRAP(final String[] args, final boolean bStandalone, final DocumentWindowManager documentWindowManager) {
    try {
        File wd = null;
        if (args == null || args.length == 0) {
            wd = ResourceUtil.getUserHomeDir();
        } else {
            wd = new File(args[0]);
        }
        final File workingDirectory = wd;
        SwingUtilities.invokeLater(new Runnable() {

            public void run() {
                LocalWorkspace localWorkspace = new LocalWorkspace(workingDirectory);
                FRAPSingleWorkspace frapWorkspace = new FRAPSingleWorkspace();
                FRAPBatchRunWorkspace batchRunWorkspace = new FRAPBatchRunWorkspace();
                // Check swing availability
                String vers = System.getProperty("java.version");
                if (vers.compareTo("1.1.2") < 0) {
                    System.out.println("!!!WARNING: Swing must be run with a 1.1.2 or higher version JVM!!!");
                }
                /* Set Look and Feel */
                try {
                    UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
                } catch (Exception e) {
                    throw new RuntimeException(e.getMessage(), e);
                }
                // set up file choosers
                openVFRAPFileChooser = new LWFileChooser();
                openVFRAPFileChooser.setDialogTitle("Open Virtual FRAP document (.vfrap)");
                openVFRAPFileChooser.setCurrentDirectory(new File(localWorkspace.getDefaultWorkspaceDirectory()));
                openVFRAPFileChooser.addChoosableFileFilter(filter_vfrap);
                openVFRAPFileChooser.setAcceptAllFileFilterUsed(false);
                openVFRAPBatchRunChooser = new LWFileChooser();
                openVFRAPBatchRunChooser.setDialogTitle("Open Virtual FRAP batchrun document (.vfbatch)");
                openVFRAPBatchRunChooser.setCurrentDirectory(new File(localWorkspace.getDefaultWorkspaceDirectory()));
                openVFRAPBatchRunChooser.addChoosableFileFilter(filter_vfbatch);
                openVFRAPBatchRunChooser.setAcceptAllFileFilterUsed(false);
                loadFRAPImageFileChooser = new LWFileChooser();
                loadFRAPImageFileChooser.setDialogTitle("Load FRAP image file");
                loadFRAPImageFileChooser.setCurrentDirectory(new File(localWorkspace.getDefaultWorkspaceDirectory()));
                loadFRAPImageFileChooser.addChoosableFileFilter(filter_tif);
                loadFRAPImageFileChooser.addChoosableFileFilter(filter_lsm);
                addDataFileChooser_batchRun = new LWFileChooser();
                addDataFileChooser_batchRun.setDialogTitle("Add a Virtual FRAP docmument or FRAP image file to batchrun");
                addDataFileChooser_batchRun.setCurrentDirectory(new File(localWorkspace.getDefaultWorkspaceDirectory()));
                addDataFileChooser_batchRun.addChoosableFileFilter(filter_vfrap);
                addDataFileChooser_batchRun.addChoosableFileFilter(filter_tif);
                addDataFileChooser_batchRun.addChoosableFileFilter(filter_lsm);
                saveFileChooser = new LWFileChooser();
                saveFileChooser.setDialogTitle("Save Virtual FRAP document (.vfrap)");
                saveFileChooser.addChoosableFileFilter(filter_vfrap);
                saveFileChooser.setCurrentDirectory(new File(localWorkspace.getDefaultWorkspaceDirectory()));
                saveAsMatFileChooser = new LWFileChooser();
                saveAsMatFileChooser.setDialogTitle("Save image data to matlab file (.mat)");
                saveAsMatFileChooser.addChoosableFileFilter(filter_mat);
                saveAsMatFileChooser.setCurrentDirectory(new File(localWorkspace.getDefaultWorkspaceDirectory()));
                saveFileChooser_batchRun = new LWFileChooser();
                saveFileChooser_batchRun.setDialogTitle("Save Virtual FRAP batchrun document (.vfbatch)");
                saveFileChooser_batchRun.addChoosableFileFilter(filter_vfbatch);
                saveFileChooser_batchRun.setCurrentDirectory(new File(localWorkspace.getDefaultWorkspaceDirectory()));
                saveFileChooser_batchRunSaveSingleFileAs = new LWFileChooser();
                saveFileChooser_batchRunSaveSingleFileAs.addChoosableFileFilter(filter_vfrap);
                saveFileChooser_batchRunSaveSingleFileAs.setCurrentDirectory(new File(localWorkspace.getDefaultWorkspaceDirectory()));
                multiOpenFileChooser = new LWFileChooser();
                multiOpenFileChooser.setDialogTitle("Open FRAP image series");
                multiOpenFileChooser.setCurrentDirectory(new File(localWorkspace.getDefaultWorkspaceDirectory()));
                multiOpenFileChooser.addChoosableFileFilter(filter_tif);
                multiOpenFileChooser.setMultiSelectionEnabled(true);
                saveMovieFileChooser = new LWFileChooser();
                saveMovieFileChooser.setDialogTitle("Save to quick time movie (.mov)");
                saveMovieFileChooser.addChoosableFileFilter(filter_qt);
                saveMovieFileChooser.setAcceptAllFileFilterUsed(false);
                saveMovieFileChooser.setCurrentDirectory(new File(localWorkspace.getDefaultWorkspaceDirectory()));
                if (mf == null) {
                    mf = new VirtualFrapMainFrame(localWorkspace, frapWorkspace, batchRunWorkspace, bStandalone, documentWindowManager);
                }
                // System.out.println(mf.getLocation().x + "---"+mf.getLocation().y);
                mf.setMainFrameTitle("");
                mf.setVisible(true);
                // initialize FRAPStudy
                FRAPStudy fStudy = new FRAPStudy();
                frapWorkspace.setFrapStudy(fStudy, true);
                try {
                    Thread.sleep(30);
                } catch (InterruptedException e) {
                }
            }
        });
    } catch (Exception e) {
        e.printStackTrace(System.out);
    }
}
Also used : LocalWorkspace(cbit.vcell.microscopy.LocalWorkspace) LWFileChooser(org.vcell.client.logicalwindow.LWFileChooser) FRAPStudy(cbit.vcell.microscopy.FRAPStudy) FRAPSingleWorkspace(cbit.vcell.microscopy.FRAPSingleWorkspace) File(java.io.File) FRAPBatchRunWorkspace(cbit.vcell.microscopy.batchrun.FRAPBatchRunWorkspace)

Aggregations

FRAPSingleWorkspace (cbit.vcell.microscopy.FRAPSingleWorkspace)1 FRAPStudy (cbit.vcell.microscopy.FRAPStudy)1 LocalWorkspace (cbit.vcell.microscopy.LocalWorkspace)1 FRAPBatchRunWorkspace (cbit.vcell.microscopy.batchrun.FRAPBatchRunWorkspace)1 File (java.io.File)1 LWFileChooser (org.vcell.client.logicalwindow.LWFileChooser)1