Search in sources :

Example 1 with ImageDbTreePanel

use of cbit.vcell.desktop.ImageDbTreePanel in project vcell by virtualcell.

the class ClientRequestManager method createSelectDocTask.

private AsynchClientTask createSelectDocTask(final TopLevelWindowManager requester) {
    AsynchClientTask selectDocumentTypeTask = new AsynchClientTask("Select/Load geometry", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

        @Override
        public void run(Hashtable<String, Object> hashTable) throws Exception {
            String[][] docTypeoptions = new String[][] { { "BioModel names" }, { "MathModel names" } };
            VCDocumentType[] sourceDocumentTypes = new VCDocumentType[] { VCDocumentType.BIOMODEL_DOC, VCDocumentType.MATHMODEL_DOC };
            VCAssert.assertTrue(docTypeoptions.length == sourceDocumentTypes.length, "Label and types mismatch");
            int[] geomType = DialogUtils.showComponentOKCancelTableList(JOptionPane.getFrameForComponent(requester.getComponent()), "Select different Geometry", new String[] { "Search by" }, docTypeoptions, ListSelectionModel.SINGLE_SELECTION);
            final int selectedType = geomType[0];
            VCDocumentType sourceDocumentType = sourceDocumentTypes[selectedType];
            VersionInfo vcVersionInfo = null;
            if (geomType[0] == 3) {
                ImageDbTreePanel imageDbTreePanel = new ImageDbTreePanel();
                imageDbTreePanel.setDocumentManager(getDocumentManager());
                imageDbTreePanel.setPreferredSize(new java.awt.Dimension(200, 400));
                vcVersionInfo = DialogUtils.getDBTreePanelSelection(requester.getComponent(), imageDbTreePanel, "OK", "Select Image:");
            } else {
                vcVersionInfo = selectDocumentFromType(sourceDocumentType, requester);
            }
            hashTable.put(VERSIONINFO_KEY, vcVersionInfo);
        }
    };
    return selectDocumentTypeTask;
}
Also used : VersionInfo(org.vcell.util.document.VersionInfo) AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) Dimension(java.awt.Dimension) Hashtable(java.util.Hashtable) VCDocumentType(org.vcell.util.document.VCDocument.VCDocumentType) ImageDbTreePanel(cbit.vcell.desktop.ImageDbTreePanel)

Aggregations

AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)1 ImageDbTreePanel (cbit.vcell.desktop.ImageDbTreePanel)1 Dimension (java.awt.Dimension)1 Hashtable (java.util.Hashtable)1 VCDocumentType (org.vcell.util.document.VCDocument.VCDocumentType)1 VersionInfo (org.vcell.util.document.VersionInfo)1