use of org.vcell.util.document.BioModelInfo in project vcell by virtualcell.
the class StandaloneRuleBasedTest method main.
public static void main(String[] args) {
try {
PropertyLoader.loadProperties();
} catch (Exception e) {
e.printStackTrace();
}
final int numTrials = 40;
// 30 seconds
final long bngTimeoutDurationMS = 30000;
VCDatabaseVisitor vcDatabaseVisitor = new VCDatabaseVisitor() {
@Override
public void visitMathModel(MathModel mathModel, PrintStream logFilePrintStream) {
throw new IllegalArgumentException("Not Implemented");
}
@Override
public void visitGeometry(Geometry geometry, PrintStream logFilePrintStream) {
throw new IllegalArgumentException("Not Implemented");
}
@Override
public void visitBioModel(BioModel bioModel, PrintStream logFilePrintStream) {
SimulationContext[] simulationContexts = bioModel.getSimulationContexts();
for (SimulationContext simContext : simulationContexts) {
if ((simContext.getApplicationType() == Application.NETWORK_STOCHASTIC) && simContext.getGeometry().getDimension() == 0) {
File baseDirectory = createDirFile(simContext);
try {
checkNonspatialStochasticSimContext(simContext, baseDirectory, numTrials, bngTimeoutDurationMS);
} catch (Exception e) {
e.printStackTrace();
if (!e.getMessage().contains("Only Mass Action Kinetics supported ")) {
StochtestFileUtils.writeMessageTofile(baseDirectory, e.getMessage());
}
}
}
}
}
@Override
public boolean filterMathModel(MathModelInfo mathModelInfo) {
return false;
}
@Override
public boolean filterGeometry(GeometryInfo geometryInfo) {
return false;
}
@Override
public boolean filterBioModel(BioModelInfo bioModelInfo) {
return // bioModelInfo.getVersion().getName().equals("model");
bioModelInfo.getVersion().getName().equals("simpleModel_Network_orig");
}
};
String currentUserID = "schaff";
String[] allUsers = new String[] { /*-all*/
currentUserID, "-" };
VCDatabaseScanner.scanBioModels(allUsers, vcDatabaseVisitor, false);
}
use of org.vcell.util.document.BioModelInfo in project vcell by virtualcell.
the class MathModelEditor method setRightBottomPanelOnSelection.
@Override
protected void setRightBottomPanelOnSelection(Object[] selections) {
if (selections == null) {
return;
}
JComponent bottomComponent = rightBottomEmptyPanel;
int destComponentIndex = DocumentEditorTabID.object_properties.ordinal();
boolean bShowInDatabaseProperties = false;
if (selections != null && selections.length == 1) {
Object singleSelection = selections[0];
if (singleSelection == mathModel) {
bottomComponent = mathModelEditorAnnotationPanel;
} else if (singleSelection instanceof DocumentEditorTreeFolderNode) {
DocumentEditorTreeFolderNode folderNode = (DocumentEditorTreeFolderNode) singleSelection;
if (folderNode.getFolderClass() == DocumentEditorTreeFolderClass.MATH_ANNOTATION_NODE) {
bottomComponent = mathModelEditorAnnotationPanel;
} else if (folderNode.getFolderClass() == DocumentEditorTreeFolderClass.MATH_SIMULATIONS_NODE) {
bottomComponent = simulationSummaryPanel;
}
} else if (singleSelection instanceof BioModelInfo) {
bShowInDatabaseProperties = true;
bottomComponent = bioModelMetaDataPanel;
} else if (singleSelection instanceof MathModelInfo) {
bShowInDatabaseProperties = true;
bottomComponent = mathModelMetaDataPanel;
} else if (singleSelection instanceof GeometryInfo) {
bShowInDatabaseProperties = true;
bottomComponent = geometryMetaDataPanel;
} else if (singleSelection instanceof Simulation) {
bottomComponent = simulationSummaryPanel;
} else if (singleSelection instanceof CSGObject) {
bottomComponent = csgObjectPropertiesPanel;
csgObjectPropertiesPanel.setSimulationContext(getSelectedSimulationContext());
}
}
if (bShowInDatabaseProperties) {
for (destComponentIndex = 0; destComponentIndex < rightBottomTabbedPane.getTabCount(); destComponentIndex++) {
Component c = rightBottomTabbedPane.getComponentAt(destComponentIndex);
if (c == bioModelMetaDataPanel || c == mathModelMetaDataPanel || c == geometryMetaDataPanel) {
break;
}
}
if (rightBottomTabbedPane.getTabCount() == destComponentIndex) {
rightBottomTabbedPane.addTab(DATABASE_PROPERTIES_TAB_TITLE, new TabCloseIcon(), bottomComponent);
}
}
if (rightSplitPane.getBottomComponent() != rightBottomTabbedPane) {
rightSplitPane.setBottomComponent(rightBottomTabbedPane);
}
if (rightBottomTabbedPane.getComponentAt(destComponentIndex) != bottomComponent) {
rightBottomTabbedPane.setComponentAt(destComponentIndex, bottomComponent);
rightBottomTabbedPane.repaint();
}
rightBottomTabbedPane.setSelectedComponent(bottomComponent);
}
use of org.vcell.util.document.BioModelInfo in project vcell by virtualcell.
the class DeleteOldDocument 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 dwm = (DocumentWindowManager) fetch(hashTable, DOCUMENT_WINDOW_MANAGER);
VCDocument currentDocument = dwm.getVCDocument();
DocumentManager documentManager = (DocumentManager) fetch(hashTable, DOCUMENT_MANAGER);
switch(currentDocument.getDocumentType()) {
case BIOMODEL_DOC:
{
// make the info
BioModel oldBioModel = (BioModel) currentDocument;
BioModelInfo oldBioModelInfo = documentManager.getBioModelInfo(oldBioModel.getVersion().getVersionKey());
// delete document
documentManager.delete(oldBioModelInfo);
break;
}
case MATHMODEL_DOC:
{
// make the info
MathModel oldMathModel = (MathModel) currentDocument;
MathModelInfo oldMathModelInfo = documentManager.getMathModelInfo(oldMathModel.getVersion().getVersionKey());
// delete document
documentManager.delete(oldMathModelInfo);
break;
}
case GEOMETRY_DOC:
{
// make the info
Geometry oldGeometry = (Geometry) currentDocument;
GeometryInfo oldGeometryInfo = documentManager.getGeometryInfo(oldGeometry.getVersion().getVersionKey());
// delete document
documentManager.delete(oldGeometryInfo);
break;
}
default:
break;
}
}
use of org.vcell.util.document.BioModelInfo in project vcell by virtualcell.
the class DocumentToExport 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
*/
@Override
public void run(Hashtable<String, Object> hashTable) throws java.lang.Exception {
TopLevelWindowManager topLevelWindowManager = extractRequired(hashTable, TopLevelWindowManager.class, "topLevelWindowManager");
VCDocument doc = null;
if (topLevelWindowManager instanceof DocumentWindowManager) {
doc = ((DocumentWindowManager) topLevelWindowManager).getVCDocument();
} else if (topLevelWindowManager instanceof DatabaseWindowManager) {
DocumentManager documentManager = extractRequired(hashTable, DocumentManager.class, CommonTask.DOCUMENT_MANAGER.name);
VCDocumentInfo documentInfo = ((DatabaseWindowManager) topLevelWindowManager).getPanelSelection();
if (documentInfo instanceof BioModelInfo) {
BioModelInfo bmi = (BioModelInfo) documentInfo;
doc = documentManager.getBioModel(bmi);
} else if (documentInfo instanceof MathModelInfo) {
MathModelInfo mmi = (MathModelInfo) documentInfo;
doc = documentManager.getMathModel(mmi);
} else if (documentInfo instanceof GeometryInfo) {
GeometryInfo gmi = (GeometryInfo) documentInfo;
doc = documentManager.getGeometry(gmi);
}
if (doc == null) {
throw new IllegalStateException("export called on DatabaseWindowManager with selection " + documentInfo);
}
}
if (doc != null) {
hashTable.put(EXPORT_DOCUMENT, doc);
} else {
throw new UnsupportedOperationException("TopLevelWindowManager subclass " + topLevelWindowManager.getClass().getName() + " does not support exporting to document");
}
}
use of org.vcell.util.document.BioModelInfo in project vcell by virtualcell.
the class VCellBasicCellRenderer method getTreeCellRendererComponent.
/**
* Insert the method's description here.
* Creation date: (7/27/2000 6:41:57 PM)
* @return java.awt.Component
*/
public java.awt.Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
JLabel component = (JLabel) super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
//
if (!leaf && expanded) {
setIcon(fieldFolderOpenIcon);
} else if (!leaf && !expanded) {
setIcon(fieldFolderClosedIcon);
}
try {
if (value instanceof BioModelNode) {
BioModelNode node = (BioModelNode) value;
boolean bLoaded = false;
//
// Check if node is a SolverResultSetInfo
//
Object userObject = node.getUserObject();
if (userObject instanceof SimulationInfo) {
//
// Check if node is a SimulationInfo
//
setComponentProperties(component, (SimulationInfo) userObject);
int maxErrorLevel = getMaxErrorLevel(node);
if (maxErrorLevel == BioModelNode.ERROR_POSSIBLE) {
setIcon(fieldSimulationWarningIcon);
component.setToolTipText("Simulation contains possibly invalid results");
} else if (maxErrorLevel == BioModelNode.ERROR_CONFIRMED) {
setIcon(fieldSimulationErrorIcon);
component.setToolTipText("Simulation contains invalid results");
}
} else if (userObject instanceof String && node.getChildCount() == 0) {
component.setToolTipText(null);
component.setText((String) userObject);
} else if (userObject instanceof BioModelInfo) {
//
// Check if node is a BioModelInfo
//
setComponentProperties(component, (BioModelInfo) userObject);
bLoaded = isLoaded((BioModelInfo) userObject);
int maxErrorLevel = getMaxErrorLevel(node);
if (maxErrorLevel == BioModelNode.ERROR_POSSIBLE) {
setIcon(fieldBioModelWarningIcon);
component.setToolTipText("BioModel version: Has possibly invalid simulation results");
} else if (maxErrorLevel == BioModelNode.ERROR_CONFIRMED) {
setIcon(fieldBioModelErrorIcon);
component.setToolTipText("BioModel version: Has invalid simulation results");
}
} else if (userObject instanceof String && node.getChildCount() > 0 && ((BioModelNode) node.getChildAt(0)).getUserObject() instanceof BioModelInfo) {
//
// Check if node is a BioModelName (String), with children (at least one version of biomodel), and if the child is a
// BioModelInfo node
//
String label = (String) userObject;
component.setToolTipText("BioModel");
component.setText(label);
//
// check if child is loaded
//
int maxErrorLevel = BioModelNode.ERROR_NONE;
for (int i = 0; i < node.getChildCount(); i++) {
maxErrorLevel = Math.max(maxErrorLevel, getMaxErrorLevel((BioModelNode) node.getChildAt(i)));
}
if (maxErrorLevel == BioModelNode.ERROR_POSSIBLE) {
if (!leaf && expanded) {
setIcon(fieldFolderOpenWarningIcon);
} else if (!leaf && !expanded) {
setIcon(fieldFolderClosedWarningIcon);
}
component.setToolTipText("BioModel: one or more versions may have invalid simulation results");
} else if (maxErrorLevel == BioModelNode.ERROR_CONFIRMED) {
if (!leaf && expanded) {
setIcon(fieldFolderOpenErrorIcon);
} else if (!leaf && !expanded) {
setIcon(fieldFolderClosedErrorIcon);
}
component.setToolTipText("BioModel: one or more versions have invalid simulation results");
}
//
for (int i = 0; i < node.getChildCount(); i++) {
BioModelInfo bioModelInfo = (BioModelInfo) ((BioModelNode) node.getChildAt(i)).getUserObject();
if (isLoaded(bioModelInfo)) {
bLoaded = true;
}
}
} else if (userObject instanceof User && node.getChildCount() > 0 && (((BioModelNode) node.getChildAt(0)).getUserObject() instanceof String) && ((BioModelNode) (node.getChildAt(0).getChildAt(0))).getUserObject() instanceof BioModelInfo) {
//
// Check if node is a User, with at least one child which is a string (BioModel name)
// and if the child's child is a BioModelInfo node
//
String label = ((User) userObject).getName();
component.setToolTipText("User Name");
component.setText(label);
if (isLoaded((User) userObject)) {
bLoaded = true;
}
} else if (userObject instanceof MathModelInfo) {
//
// Check if node is a MathModelInfo node
//
setComponentProperties(component, (MathModelInfo) userObject);
bLoaded = isLoaded((MathModelInfo) userObject);
} else if (userObject instanceof String && node.getChildCount() > 0 && ((BioModelNode) node.getChildAt(0)).getUserObject() instanceof MathModelInfo) {
//
// Check if node is a MathModel name (String), with children (at least one version of mathmodel), and
// if the child is a MathModelInfo node
//
String label = (String) userObject;
component.setToolTipText("Mathematical Model");
component.setText(label);
//
for (int i = 0; i < node.getChildCount(); i++) {
MathModelInfo mathModelInfo = (MathModelInfo) ((BioModelNode) node.getChildAt(i)).getUserObject();
if (isLoaded(mathModelInfo)) {
bLoaded = true;
}
}
} else if (userObject instanceof User && node.getChildCount() > 0 && (((BioModelNode) node.getChildAt(0)).getUserObject() instanceof String) && ((BioModelNode) (node.getChildAt(0).getChildAt(0))).getUserObject() instanceof MathModelInfo) {
//
// Check if node is a User, with at least one child which is a string (Mathmodel name)
// and if the child's child is a MathModelInfo node
//
String label = ((User) userObject).getName();
component.setToolTipText("User Name");
component.setText(label);
if (isLoaded((User) userObject)) {
bLoaded = true;
}
} else if (userObject instanceof cbit.vcell.geometry.GeometryInfo) {
//
// Check if node is a GeometryInfo
//
setComponentProperties(component, (GeometryInfo) userObject);
bLoaded = isLoaded((GeometryInfo) userObject);
} else if (userObject instanceof String && node.getChildCount() > 0 && ((BioModelNode) node.getChildAt(0)).getUserObject() instanceof GeometryInfo) {
//
// Check if node is a Geometry name (String), with children (at least one version of Geometry), and
// if the child is a GeometryInfo node
//
String label = (String) userObject;
component.setToolTipText("Geometry");
component.setText(label);
//
for (int i = 0; i < node.getChildCount(); i++) {
GeometryInfo geometryInfo = (GeometryInfo) ((BioModelNode) node.getChildAt(i)).getUserObject();
if (isLoaded(geometryInfo)) {
bLoaded = true;
}
}
} else if (userObject instanceof User && node.getChildCount() > 0 && (((BioModelNode) node.getChildAt(0)).getUserObject() instanceof String) && ((BioModelNode) (node.getChildAt(0).getChildAt(0))).getUserObject() instanceof GeometryInfo) {
//
// Check if node is a User, with at least one child which is a string (Geometry name)
// and if the child's child is a GeometryInfo node
//
String label = ((User) userObject).getName();
component.setToolTipText("User Name");
component.setText(label);
if (isLoaded((User) userObject)) {
bLoaded = true;
}
} else if (userObject instanceof String && node.getChildCount() > 0) {
component.setToolTipText(null);
component.setText((String) userObject);
// }else if (node.getUserObject() instanceof MathInfo) {
// setComponentProperties(component,(MathInfo)node.getUserObject());
} else if (userObject instanceof VCImageInfo) {
setComponentProperties(component, (VCImageInfo) userObject);
} else if (userObject instanceof Extent) {
setComponentProperties(component, (Extent) userObject);
} else if (userObject instanceof Annotation) {
setComponentProperties(component, (Annotation) userObject);
} else if (userObject instanceof MathModel) {
setComponentProperties(component, (MathModel) userObject);
} else if (userObject instanceof BioModel) {
setComponentProperties(component, (BioModel) userObject);
} else if (userObject instanceof SimulationContext) {
setComponentProperties(component, (SimulationContext) userObject);
bLoaded = isLoaded((SimulationContext) userObject);
} else if (userObject instanceof Simulation) {
setComponentProperties(component, (Simulation) userObject);
} else if (userObject instanceof MathDescription) {
setComponentProperties(component, (MathDescription) userObject);
} else if (userObject instanceof Geometry) {
setComponentProperties(component, (Geometry) userObject);
} else if (userObject instanceof User) {
setComponentProperties(component, (User) userObject);
} else {
setComponentProperties(component, userObject);
}
if (selectedFont == null && component.getFont() != null) {
selectedFont = component.getFont().deriveFont(Font.BOLD);
}
if (unselectedFont == null && component.getFont() != null) {
unselectedFont = component.getFont().deriveFont(Font.PLAIN);
}
if (bLoaded) {
component.setFont(selectedFont);
} else {
component.setFont(unselectedFont);
}
}
} catch (Throwable e) {
e.printStackTrace(System.out);
}
//
return component;
}
Aggregations