Search in sources :

Example 36 with GeometryInfo

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");
    }
}
Also used : VCDocument(org.vcell.util.document.VCDocument) TopLevelWindowManager(cbit.vcell.client.TopLevelWindowManager) DocumentWindowManager(cbit.vcell.client.DocumentWindowManager) VCDocumentInfo(org.vcell.util.document.VCDocumentInfo) DocumentManager(cbit.vcell.clientdb.DocumentManager) BioModelInfo(org.vcell.util.document.BioModelInfo) GeometryInfo(cbit.vcell.geometry.GeometryInfo) MathModelInfo(org.vcell.util.document.MathModelInfo) DatabaseWindowManager(cbit.vcell.client.DatabaseWindowManager)

Example 37 with GeometryInfo

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);
}
Also used : Simulation(cbit.vcell.solver.Simulation) TabCloseIcon(cbit.vcell.client.desktop.biomodel.TabCloseIcon) JComponent(javax.swing.JComponent) BioModelInfo(org.vcell.util.document.BioModelInfo) GeometryInfo(cbit.vcell.geometry.GeometryInfo) DocumentEditorTreeFolderNode(cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderNode) CSGObject(cbit.vcell.geometry.CSGObject) MathModelInfo(org.vcell.util.document.MathModelInfo) CSGObject(cbit.vcell.geometry.CSGObject) JComponent(javax.swing.JComponent) Component(java.awt.Component)

Example 38 with GeometryInfo

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;
}
Also used : GeometryInfo(cbit.vcell.geometry.GeometryInfo) VCDocumentInfoNode(cbit.vcell.desktop.VCellBasicCellRenderer.VCDocumentInfoNode) Vector(java.util.Vector)

Example 39 with GeometryInfo

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();
        }
    }
}
Also used : User(org.vcell.util.document.User) GeometryInfo(cbit.vcell.geometry.GeometryInfo) VCDocumentInfoNode(cbit.vcell.desktop.VCellBasicCellRenderer.VCDocumentInfoNode) DataAccessException(org.vcell.util.DataAccessException)

Example 40 with GeometryInfo

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);
}
Also used : User(org.vcell.util.document.User) GeometryInfo(cbit.vcell.geometry.GeometryInfo) TreeMap(java.util.TreeMap) DataAccessException(org.vcell.util.DataAccessException)

Aggregations

GeometryInfo (cbit.vcell.geometry.GeometryInfo)47 BioModelInfo (org.vcell.util.document.BioModelInfo)27 MathModelInfo (org.vcell.util.document.MathModelInfo)27 DataAccessException (org.vcell.util.DataAccessException)19 VCDocumentInfo (org.vcell.util.document.VCDocumentInfo)11 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)8 Hashtable (java.util.Hashtable)8 Geometry (cbit.vcell.geometry.Geometry)7 VCImageInfo (cbit.image.VCImageInfo)6 BioModel (cbit.vcell.biomodel.BioModel)6 User (org.vcell.util.document.User)6 VersionInfo (org.vcell.util.document.VersionInfo)6 CSGObject (cbit.vcell.geometry.CSGObject)5 SimulationContext (cbit.vcell.mapping.SimulationContext)5 RemoteProxyException (cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException)5 Vector (java.util.Vector)5 ObjectNotFoundException (org.vcell.util.ObjectNotFoundException)5 ImageException (cbit.image.ImageException)4 DocumentManager (cbit.vcell.clientdb.DocumentManager)4 GeometryException (cbit.vcell.geometry.GeometryException)4