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);
}
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();
}
}
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);
}
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();
}
}
}
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();
}
}
Aggregations