Search in sources :

Example 1 with VCDocumentType

use of org.vcell.util.document.VCDocument.VCDocumentType 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)

Example 2 with VCDocumentType

use of org.vcell.util.document.VCDocument.VCDocumentType in project vcell by virtualcell.

the class ClientMDIManager method createCanonicalTitle.

/**
 * Insert the method's description here.
 * Creation date: (5/27/2006 4:10:10 PM)
 * @return java.lang.String
 * @param version cbit.sql.Version
 */
public static String createCanonicalTitle(VCDocument vcDocument) {
    Version version = vcDocument.getVersion();
    VCDocumentType docType = vcDocument.getDocumentType();
    String docName = (version != null ? version.getName() : (vcDocument.getName() == null ? "NoName" : vcDocument.getName() + " (NoVersion)"));
    java.util.Date docDate = (version != null ? version.getDate() : null);
    VersionFlag versionFlag = (version != null ? version.getFlag() : null);
    String title = (versionFlag != null && versionFlag.compareEqual(VersionFlag.Archived) ? "(" + CurateSpec.CURATE_TYPE_STATES[CurateSpec.ARCHIVE] + ") " : "") + (versionFlag != null && versionFlag.compareEqual(VersionFlag.Published) ? "(" + CurateSpec.CURATE_TYPE_STATES[CurateSpec.PUBLISH] + ") " : "") + (docType == VCDocumentType.BIOMODEL_DOC ? "BIOMODEL: " : "") + (docType == VCDocumentType.MATHMODEL_DOC ? "MATHMODEL: " : "") + (docType == VCDocumentType.GEOMETRY_DOC ? "GEOMETRY: " : "") + docName + " " + "(" + (docDate != null ? docDate.toString() : "NoDate") + ")";
    title += " -- VCell " + DocumentWindowAboutBox.getVERSION_NO() + " (build " + DocumentWindowAboutBox.getBUILD_NO() + ")";
    return title;
}
Also used : VersionFlag(org.vcell.util.document.VersionFlag) Version(org.vcell.util.document.Version) VCDocumentType(org.vcell.util.document.VCDocument.VCDocumentType)

Aggregations

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