use of cbit.vcell.geometry.GeometryInfo 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 cbit.vcell.geometry.GeometryInfo 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 cbit.vcell.geometry.GeometryInfo in project vcell by virtualcell.
the class GeometryDbTreeModel method createOwnerSubTree.
/**
* Insert the method's description here.
* Creation date: (11/28/00 1:06:51 PM)
* @return cbit.vcell.desktop.BioModelNode
* @param docManager cbit.vcell.clientdb.DocumentManager
*/
public BioModelNode createOwnerSubTree(User owner, GeometryInfo[] geometryInfos) throws DataAccessException {
//
// for each user
//
BioModelNode rootNode = new BioModelNode(owner, true);
for (int i = 0; i < geometryInfos.length; i++) {
GeometryInfo geometryInfo = geometryInfos[i];
if (geometryInfo.getVersion().getOwner().equals(owner) && geometryInfo.getDimension() > 0) {
if (!meetSearchCriteria(geometryInfo)) {
continue;
}
BioModelNode bioModelNode = new BioModelNode(new VCDocumentInfoNode(geometryInfo), true);
rootNode.add(bioModelNode);
//
// get list of geometries with the same branch
//
Vector<GeometryInfo> geometryBranchList = new Vector<GeometryInfo>();
geometryBranchList.addElement(geometryInfo);
for (i = i + 1; i < geometryInfos.length; i++) {
if (geometryInfos[i].getVersion().getBranchID().equals(geometryInfo.getVersion().getBranchID()) && geometryInfos[i].getDimension() > 0) {
if (!meetSearchCriteria(geometryInfos[i])) {
continue;
}
geometryBranchList.add(0, geometryInfos[i]);
} else {
i--;
break;
}
}
GeometryInfo[] geometryInfosInBranch = null;
if (getLatestOnly()) {
geometryInfosInBranch = new GeometryInfo[1];
geometryInfosInBranch[0] = (GeometryInfo) geometryBranchList.elementAt(0);
} else {
geometryInfosInBranch = new GeometryInfo[geometryBranchList.size()];
geometryBranchList.copyInto(geometryInfosInBranch);
}
for (int versionCount = 0; versionCount < geometryInfosInBranch.length; versionCount++) {
bioModelNode.add(createVersionSubTree(geometryInfosInBranch[versionCount]));
}
}
}
return rootNode;
}
use of cbit.vcell.geometry.GeometryInfo in project vcell by virtualcell.
the class GeometryDbTreeModel method databaseInsert.
/**
* @param event cbit.vcell.clientdb.DatabaseEvent
*/
public void databaseInsert(DatabaseEvent databaseEvent) {
if (databaseEvent.getNewVersionInfo() instanceof GeometryInfo) {
try {
GeometryInfo insertedGeometryInfo = (GeometryInfo) databaseEvent.getNewVersionInfo();
//
// get parent of updated version
//
// model1 (VCDocumentInfoNode)
// Fri Sept 2, 2001 12:00:00 (GeometryInfo)
// Fri Sept 1, 2001 10:00:00 (GeometryInfo)
//
//
BioModelNode newVersionNode = createVersionSubTree(insertedGeometryInfo);
//
// find owner node (if it is displayed)
//
User owner = insertedGeometryInfo.getVersion().getOwner();
BioModelNode ownerRoot = ((BioModelNode) getRoot()).findNodeByUserObject(owner);
BioModelNode parentNode = null;
if (ownerRoot != null) {
parentNode = ownerRoot.findNodeByUserObject(new VCDocumentInfoNode(insertedGeometryInfo));
}
if (parentNode == null) {
//
// fresh insert
// Have to create parent node, for all versions of this geometry,
// and stick it in the correct order in the tree.
//
parentNode = new BioModelNode(new VCDocumentInfoNode(insertedGeometryInfo), true);
parentNode.insert(newVersionNode, 0);
//
if (ownerRoot != null) {
// !!!!!!!!!!!!!! new insert on top (index=0) .... should do insertion sort !!!!
ownerRoot.insert(parentNode, 0);
insertNodeInto(parentNode, ownerRoot, 0);
}
} else {
//
// already versions there (just add child in the correct position within parent)
//
// !!!!!!!!!! right now ignore order !!!!!!!!!!
parentNode.insert(newVersionNode, 0);
insertNodeInto(newVersionNode, parentNode, 0);
}
} catch (DataAccessException e) {
e.printStackTrace(System.out);
System.out.println("exception responding to databaseInsert(), refreshing whole tree");
refreshTree();
}
}
}
use of cbit.vcell.geometry.GeometryInfo in project vcell by virtualcell.
the class GeometryDbTreeModel method createBaseTree.
/**
* Insert the method's description here.
* Creation date: (11/28/00 1:06:51 PM)
* @return cbit.vcell.desktop.BioModelNode
* @param docManager cbit.vcell.clientdb.DocumentManager
*/
protected void createBaseTree() throws DataAccessException {
VCDocumentDbTreeModel.initBaseTree(rootNode, new BioModelNode[] { myModelsNode, sharedModelsNode, otherModelsNode }, "Geometries", sharedModelsNode, SHARED_GEOMETRIES);
GeometryInfo[] geometryInfos = getDocumentManager().getGeometryInfos();
User loginUser = getDocumentManager().getUser();
TreeMap<String, BioModelNode> treeMap = null;
try {
treeMap = VCDocumentDbTreeModel.initOwners(geometryInfos, loginUser, this, this.getClass().getMethod("createOwnerSubTree", new Class[] { User.class, GeometryInfo[].class }));
} catch (Exception e) {
e.printStackTrace();
treeMap = new TreeMap<String, BioModelNode>();
treeMap.put(loginUser.getName(), new BioModelNode("Error:" + e.getMessage()));
}
initFinalTree(this, treeMap, loginUser);
}
Aggregations