Search in sources :

Example 1 with MDIManager

use of cbit.vcell.client.MDIManager in project vcell by virtualcell.

the class FinishExport 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 {
    MDIManager mdiManager = (MDIManager) hashTable.get("mdiManager");
    TopLevelWindowManager topLevelWindowManager = (TopLevelWindowManager) hashTable.get("topLevelWindowManager");
    Object obj = hashTable.get(RENAME_KEY);
    if (obj != null) {
        String fn = obj.toString();
        DialogUtils.showInfoDialog(topLevelWindowManager.getComponent(), "Export saved as  " + fn);
    }
    mdiManager.unBlockWindow(topLevelWindowManager.getManagerID());
    mdiManager.showWindow(topLevelWindowManager.getManagerID());
}
Also used : MDIManager(cbit.vcell.client.MDIManager) TopLevelWindowManager(cbit.vcell.client.TopLevelWindowManager)

Example 2 with MDIManager

use of cbit.vcell.client.MDIManager 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 3 with MDIManager

use of cbit.vcell.client.MDIManager in project vcell by virtualcell.

the class FinishSave 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 {
    MDIManager mdiManager = (MDIManager) hashTable.get("mdiManager");
    DocumentWindowManager documentWindowManager = (DocumentWindowManager) hashTable.get(CommonTask.DOCUMENT_WINDOW_MANAGER.name);
    if (hashTable.containsKey(SaveDocument.DOC_KEY)) {
        VCDocument savedDocument = (VCDocument) hashTable.get(SaveDocument.DOC_KEY);
        documentWindowManager.resetDocument(savedDocument);
    }
    mdiManager.unBlockWindow(documentWindowManager.getManagerID());
    mdiManager.showWindow(documentWindowManager.getManagerID());
}
Also used : MDIManager(cbit.vcell.client.MDIManager) VCDocument(org.vcell.util.document.VCDocument) DocumentWindowManager(cbit.vcell.client.DocumentWindowManager)

Aggregations

MDIManager (cbit.vcell.client.MDIManager)3 DocumentWindowManager (cbit.vcell.client.DocumentWindowManager)2 VCDocument (org.vcell.util.document.VCDocument)2 MathModelWindowManager (cbit.vcell.client.MathModelWindowManager)1 TopLevelWindowManager (cbit.vcell.client.TopLevelWindowManager)1 DocumentManager (cbit.vcell.clientdb.DocumentManager)1 Component (java.awt.Component)1 User (org.vcell.util.document.User)1 VCDocumentInfo (org.vcell.util.document.VCDocumentInfo)1