use of org.vcell.util.document.VCDocument in project vcell by virtualcell.
the class ClientRequestManager method revertToSaved.
/**
* Insert the method's description here.
* Creation date: (6/9/2004 1:07:09 PM)
* @param vcDocument cbit.vcell.document.VCDocument
*/
public void revertToSaved(DocumentWindowManager documentWindowManager) {
// make the info
VCDocument document = documentWindowManager.getVCDocument();
VCDocumentInfo info = null;
try {
KeyValue versionKey = document.getVersion().getVersionKey();
switch(document.getDocumentType()) {
case BIOMODEL_DOC:
{
info = getDocumentManager().getBioModelInfo(versionKey);
break;
}
case MATHMODEL_DOC:
{
info = getDocumentManager().getMathModelInfo(versionKey);
break;
}
case GEOMETRY_DOC:
{
info = getDocumentManager().getGeometryInfo(versionKey);
break;
}
}
} catch (DataAccessException e) {
e.printStackTrace(System.out);
throw new RuntimeException(e.getMessage());
}
// reload and reset into same window
openAfterChecking(info, documentWindowManager, false);
}
use of org.vcell.util.document.VCDocument in project vcell by virtualcell.
the class ClientRequestManager method compareWithOther.
/**
* Processes the model comparison request.
* Creation date: (6/9/2004 1:07:09 PM)
* @param vcDocument cbit.vcell.document.VCDocument
*/
public XmlTreeDiff compareWithOther(final VCDocumentInfo docInfo1, final VCDocumentInfo docInfo2) {
VCDocument document1, document2;
try {
// get the VCDocument versions from documentManager
if (docInfo1 instanceof BioModelInfo && docInfo2 instanceof BioModelInfo) {
document1 = getDocumentManager().getBioModel((BioModelInfo) docInfo1);
document2 = getDocumentManager().getBioModel((BioModelInfo) docInfo2);
} else if (docInfo1 instanceof MathModelInfo && docInfo2 instanceof MathModelInfo) {
document1 = getDocumentManager().getMathModel((MathModelInfo) docInfo1);
document2 = getDocumentManager().getMathModel((MathModelInfo) docInfo2);
} else if (docInfo1 instanceof GeometryInfo && docInfo2 instanceof GeometryInfo) {
document1 = getDocumentManager().getGeometry((GeometryInfo) docInfo1);
document2 = getDocumentManager().getGeometry((GeometryInfo) docInfo2);
} else {
throw new IllegalArgumentException("The two documents are invalid or of different types.");
}
return compareDocuments(document1, document2, DiffConfiguration.COMPARE_DOCS_OTHER);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
use of org.vcell.util.document.VCDocument in project vcell by virtualcell.
the class ClientRequestManager method getOpenDesktopDocumentInfos.
public OpenModelInfoHolder[] getOpenDesktopDocumentInfos(boolean bIncludeSimulations) throws DataAccessException {
Vector<OpenModelInfoHolder> simInfoHolderV = new Vector<OpenModelInfoHolder>();
for (TopLevelWindowManager tlwm : getMdiManager().getWindowManagers()) {
if (tlwm instanceof DocumentWindowManager) {
DocumentWindowManager dwm = (DocumentWindowManager) tlwm;
VCDocument vcDoc = dwm.getVCDocument();
// if(vcDoc.getVersion() != null){
if (vcDoc.getDocumentType() == VCDocumentType.BIOMODEL_DOC) {
BioModel bioModel = (BioModel) vcDoc;
// getDocumentManager().getBioModel(vcDoc.getVersion().getVersionKey());
SimulationContext[] simContexts = bioModel.getSimulationContexts();
for (int i = 0; i < simContexts.length; i += 1) {
if (bIncludeSimulations) {
if (simContexts[i].getGeometry() == null) {
throw new DataAccessException("Error gathering document info (isCompartmental check failed):\nOpen BioModel document " + bioModel.getName() + " has no Geometry");
}
Simulation[] sims = simContexts[i].getSimulations();
for (int j = 0; j < sims.length; j += 1) {
for (int k = 0; k < sims[j].getScanCount(); k += 1) {
FieldDataWindowManager.OpenModelInfoHolder simInfoHolder = new FieldDataWindowManager.FDSimBioModelInfo(sims[j].getName(), bioModel.getVersion(), simContexts[i], sims[j].getSimulationInfo(), k, // !sims[j].getSolverTaskDescription().getSolverDescription().hasVariableTimestep(),
simContexts[i].getGeometry().getDimension() == 0);
simInfoHolderV.add(simInfoHolder);
}
}
} else {
FieldDataWindowManager.OpenModelInfoHolder simInfoHolder = new FieldDataWindowManager.FDSimBioModelInfo(null, bioModel.getVersion(), simContexts[i], null, -1, simContexts[i].getGeometry().getDimension() == 0);
simInfoHolderV.add(simInfoHolder);
}
}
} else if (vcDoc.getDocumentType() == VCDocumentType.MATHMODEL_DOC) {
MathModel mathModel = (MathModel) vcDoc;
// getDocumentManager().getMathModel(vcDoc.getVersion().getVersionKey());
if (bIncludeSimulations) {
if (mathModel.getMathDescription() == null || mathModel.getMathDescription().getGeometry() == null) {
throw new DataAccessException("Error gathering document info (isCompartmental check failed):\nOpen MathModel document " + mathModel.getName() + " has either no MathDescription or no Geometry");
}
Simulation[] sims = mathModel.getSimulations();
for (int i = 0; i < sims.length; i += 1) {
for (int k = 0; k < sims[i].getScanCount(); k += 1) {
FieldDataWindowManager.OpenModelInfoHolder simInfoHolder = new FieldDataWindowManager.FDSimMathModelInfo(sims[i].getName(), mathModel.getVersion(), mathModel.getMathDescription(), sims[i].getSimulationInfo(), k, // !sims[i].getSolverTaskDescription().getSolverDescription().hasVariableTimestep(),
mathModel.getMathDescription().getGeometry().getDimension() == 0);
simInfoHolderV.add(simInfoHolder);
}
}
} else {
FieldDataWindowManager.OpenModelInfoHolder simInfoHolder = new FieldDataWindowManager.FDSimMathModelInfo(null, mathModel.getVersion(), mathModel.getMathDescription(), null, -1, mathModel.getMathDescription().getGeometry().getDimension() == 0);
simInfoHolderV.add(simInfoHolder);
}
}
// }
}
}
OpenModelInfoHolder[] simInfoHolderArr = new OpenModelInfoHolder[simInfoHolderV.size()];
simInfoHolderV.copyInto(simInfoHolderArr);
return simInfoHolderArr;
}
Aggregations