Search in sources :

Example 6 with DocumentManager

use of cbit.vcell.clientdb.DocumentManager in project vcell by virtualcell.

the class NewName method run.

/**
 * Insert the method's description here.
 * Creation date: (5/31/2004 6:04:14 PM)
 * @param hashTable java.util.Hashtable
 * @param clientWorker cbit.vcell.desktop.controls.ClientWorker
 */
public void run(Hashtable<String, Object> hashTable) throws java.lang.Exception {
    DocumentWindowManager documentWindowManager = (DocumentWindowManager) hashTable.get(CommonTask.DOCUMENT_WINDOW_MANAGER.name);
    VCDocument document = documentWindowManager.getVCDocument();
    if (document.getDocumentType() == VCDocumentType.MATHMODEL_DOC) {
        if (((MathModelWindowManager) documentWindowManager).hasUnappliedChanges()) {
            String msg = "Changes have been made in VCML Editor, please click \"Apply Changes\" or \"Cancel\" to proceed.";
            PopupGenerator.showErrorDialog(documentWindowManager, msg);
            throw UserCancelException.CANCEL_UNAPPLIED_CHANGES;
        }
    }
    MDIManager mdiManager = (MDIManager) hashTable.get("mdiManager");
    String oldName = document.getName();
    User user = mdiManager.getFocusedWindowManager().getRequestManager().getDocumentManager().getUser();
    DocumentManager documentManager = mdiManager.getFocusedWindowManager().getRequestManager().getDocumentManager();
    VCDocumentInfo[] vcDocumentInfos = new VCDocumentInfo[0];
    String documentTypeDescription = "unknown";
    if (document.getDocumentType() == VCDocumentType.MATHMODEL_DOC) {
        documentTypeDescription = "MathModel";
        vcDocumentInfos = documentManager.getMathModelInfos();
    } else if (document.getDocumentType() == VCDocumentType.BIOMODEL_DOC) {
        documentTypeDescription = "BioModel";
        vcDocumentInfos = documentManager.getBioModelInfos();
    } else if (document.getDocumentType() == VCDocumentType.GEOMETRY_DOC) {
        documentTypeDescription = "Geometry";
        vcDocumentInfos = documentManager.getGeometryInfos();
    }
    String newDocumentName = (oldName == null ? "New" + documentTypeDescription : oldName);
    while (true) {
        newDocumentName = mdiManager.getDatabaseWindowManager().showSaveDialog(document.getDocumentType(), (Component) hashTable.get("currentDocumentWindow"), newDocumentName);
        if (newDocumentName == null || newDocumentName.trim().length() == 0) {
            newDocumentName = null;
            DialogUtils.showWarningDialog((Component) hashTable.get("currentDocumentWindow"), "New " + documentTypeDescription + " name cannot be empty.");
            continue;
        }
        // Check name conflict
        boolean bNameConflict = false;
        for (int i = 0; i < vcDocumentInfos.length; i++) {
            if (vcDocumentInfos[i].getVersion().getOwner().compareEqual(user)) {
                if (vcDocumentInfos[i].getVersion().getName().equals(newDocumentName)) {
                    bNameConflict = true;
                    break;
                }
            }
        }
        if (bNameConflict) {
            DialogUtils.showWarningDialog((Component) hashTable.get("currentDocumentWindow"), "A " + documentTypeDescription + " with name '" + newDocumentName + "' already exists.  Choose a different name.");
            continue;
        } else {
            break;
        }
    }
    hashTable.put("newName", newDocumentName);
}
Also used : MDIManager(cbit.vcell.client.MDIManager) User(org.vcell.util.document.User) VCDocument(org.vcell.util.document.VCDocument) DocumentWindowManager(cbit.vcell.client.DocumentWindowManager) VCDocumentInfo(org.vcell.util.document.VCDocumentInfo) DocumentManager(cbit.vcell.clientdb.DocumentManager) Component(java.awt.Component) MathModelWindowManager(cbit.vcell.client.MathModelWindowManager)

Example 7 with DocumentManager

use of cbit.vcell.clientdb.DocumentManager in project vcell by virtualcell.

the class VCDocumentDbTreeModel method setDocumentManager.

/**
 * Sets the documentManager property (cbit.vcell.clientdb.DocumentManager) value.
 * @param documentManager The new value for the property.
 * @see #getDocumentManager
 */
public void setDocumentManager(DocumentManager documentManager) {
    DocumentManager oldValue = fieldDocumentManager;
    fieldDocumentManager = documentManager;
    if (oldValue != null) {
        oldValue.removeDatabaseListener(this);
    }
    if (documentManager != null) {
        documentManager.addDatabaseListener(this);
    }
    firePropertyChange(CommonTask.DOCUMENT_MANAGER.name, oldValue, documentManager);
    if (documentManager != oldValue) {
        refreshTree();
    }
}
Also used : DocumentManager(cbit.vcell.clientdb.DocumentManager)

Example 8 with DocumentManager

use of cbit.vcell.clientdb.DocumentManager in project vcell by virtualcell.

the class VCDocumentDbTreePanel method setDocumentManager.

/**
 * Sets the documentManager property (cbit.vcell.clientdb.DocumentManager) value.
 * @param documentManager The new value for the property.
 * @see #getDocumentManager
 */
public void setDocumentManager(DocumentManager newValue) {
    if (ivjDocumentManager == newValue) {
        return;
    }
    DocumentManager oldValue = getDocumentManager();
    if (oldValue != null) {
        oldValue.removeDatabaseListener(ivjEventHandler);
    }
    ivjDocumentManager = newValue;
    if (ivjDocumentManager != null) {
        ivjDocumentManager.addDatabaseListener(ivjEventHandler);
    }
    getTreeModel().setDocumentManager(ivjDocumentManager);
    treeCellRenderer.setSessionUser(ivjDocumentManager == null ? null : ivjDocumentManager.getUser());
    firePropertyChange(CommonTask.DOCUMENT_MANAGER.name, oldValue, newValue);
}
Also used : DocumentManager(cbit.vcell.clientdb.DocumentManager)

Example 9 with DocumentManager

use of cbit.vcell.clientdb.DocumentManager in project vcell by virtualcell.

the class MathTestingReportGenerator method main.

public static void main(String[] args) {
    ClientServerManager clientServerManager = null;
    try {
        if (args.length != 3) {
            System.out.println("usage: MathTestingReportGenerator apihost apiport password");
            System.exit(1);
        }
        String userid = "vcelltestaccount";
        String apihost = args[0];
        Integer apiport = Integer.parseInt(args[1]);
        String password = args[2];
        clientServerManager = ClientFactory.createRemoteClientServerManager(apihost, apiport, userid, password);
        DocumentManager documentManager = clientServerManager.getDocumentManager();
        TestSuiteInfoNew[] testSuiteInfos = documentManager.getTestSuiteInfos();
        for (TestSuiteInfoNew testSuiteInfo : testSuiteInfos) {
            System.out.println(testSuiteInfo.toShortString());
        }
        // 
        // sorted by TSKey
        // 
        Arrays.sort(testSuiteInfos, new Comparator<TestSuiteInfoNew>() {

            @Override
            public int compare(TestSuiteInfoNew o1, TestSuiteInfoNew o2) {
                return o1.getTSKey().compareTo(o2.getTSKey());
            }
        });
        // 
        // print out details of the last one.
        // 
        TestSuiteNew testSuite = documentManager.getTestSuite(testSuiteInfos[testSuiteInfos.length - 1].getTSKey());
        for (TestCaseNew testCase : testSuite.getTestCases()) {
            System.out.println("TEST CASE: " + testCase.getAnnotation());
            TestCriteriaNew[] testCriterias = testCase.getTestCriterias();
            for (TestCriteriaNew testCriteria : testCriterias) {
                System.out.println("   CRITERIA: " + testCriteria.getReportStatusMessage());
                for (VariableComparisonSummary summary : testCriteria.getVarComparisonSummaries()) {
                    System.out.println("        SUMMARY: " + summary.toShortString());
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace(System.out);
    } finally {
        if (clientServerManager != null) {
            clientServerManager.cleanup();
        }
    }
}
Also used : DocumentManager(cbit.vcell.clientdb.DocumentManager) ClientServerManager(cbit.vcell.client.server.ClientServerManager) VariableComparisonSummary(cbit.vcell.solver.test.VariableComparisonSummary)

Example 10 with DocumentManager

use of cbit.vcell.clientdb.DocumentManager in project vcell by virtualcell.

the class ClientRobot method setManagerManager.

/**
 * Insert the method's description here.
 * Creation date: (3/8/01 3:18:01 PM)
 * @return cbit.vcell.desktop.controls.Workspace
 */
private void setManagerManager(cbit.vcell.client.server.ClientServerManager argManagerManager) {
    this.managerManager = argManagerManager;
    DocumentManager documentManager = null;
    if (managerManager != null) {
        documentManager = managerManager.getDocumentManager();
    }
}
Also used : DocumentManager(cbit.vcell.clientdb.DocumentManager)

Aggregations

DocumentManager (cbit.vcell.clientdb.DocumentManager)30 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)10 Hashtable (java.util.Hashtable)10 DocumentWindowManager (cbit.vcell.client.DocumentWindowManager)6 VCDocument (org.vcell.util.document.VCDocument)6 UserCancelException (org.vcell.util.UserCancelException)5 ExternalDataIdentifier (org.vcell.util.document.ExternalDataIdentifier)5 BioModel (cbit.vcell.biomodel.BioModel)4 Component (java.awt.Component)4 File (java.io.File)4 ImageDataset (cbit.vcell.VirtualMicroscopy.ImageDataset)3 DatabaseWindowManager (cbit.vcell.client.DatabaseWindowManager)3 DocumentWindow (cbit.vcell.client.desktop.DocumentWindow)3 FieldDataFileOperationSpec (cbit.vcell.field.io.FieldDataFileOperationSpec)3 GeometryInfo (cbit.vcell.geometry.GeometryInfo)3 RegionImage (cbit.vcell.geometry.RegionImage)3 DataAccessException (org.vcell.util.DataAccessException)3 VCImageUncompressed (cbit.image.VCImageUncompressed)2 AnnotatedImageDataset (cbit.vcell.VirtualMicroscopy.importer.AnnotatedImageDataset)2 MicroscopyXmlReader (cbit.vcell.VirtualMicroscopy.importer.MicroscopyXmlReader)2