Search in sources :

Example 11 with MathModelInfo

use of org.vcell.util.document.MathModelInfo in project vcell by virtualcell.

the class ClientDocumentManager method setGroupPrivate.

/**
 * Insert the method's description here.
 * Creation date: (11/28/00 5:43:44 PM)
 * @param bioModelInfo cbit.vcell.biomodel.BioModelInfo
 */
public MathModelInfo setGroupPrivate(MathModelInfo mathModelInfo) throws DataAccessException {
    try {
        // 
        // unpublish from database
        // 
        MathModelInfo newMathModelInfo = (MathModelInfo) setGroupPrivate0(mathModelInfo, VersionableType.MathModelMetaData, mathModelInfoHash);
        // 
        // delete MathModelMetaData from cache
        // 
        xmlHash.remove(mathModelInfo.getVersion().getVersionKey());
        fireDatabaseUpdate(new DatabaseEvent(this, DatabaseEvent.UPDATE, mathModelInfo, newMathModelInfo));
        return newMathModelInfo;
    } catch (RemoteProxyException e) {
        handleRemoteProxyException(e);
        throw new DataAccessException(e.getMessage());
    }
}
Also used : MathModelInfo(org.vcell.util.document.MathModelInfo) DataAccessException(org.vcell.util.DataAccessException) RemoteProxyException(cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException)

Example 12 with MathModelInfo

use of org.vcell.util.document.MathModelInfo in project vcell by virtualcell.

the class ClientDocumentManager method curate.

/**
 * Insert the method's description here.
 * Creation date: (5/23/2006 9:23:34 AM)
 */
public void curate(CurateSpec curateSpec) throws DataAccessException {
    try {
        VCDocumentInfo newVCDocumentInfo = getSessionManager().getUserMetaDbServer().curate(curateSpec);
        xmlHash.remove(curateSpec.getVCDocumentInfo().getVersion().getVersionKey());
        if (curateSpec.getVCDocumentInfo() instanceof MathModelInfo) {
            mathModelInfoHash.remove(curateSpec.getVCDocumentInfo().getVersion().getVersionKey());
            mathModelInfoHash.put(newVCDocumentInfo.getVersion().getVersionKey(), (MathModelInfo) newVCDocumentInfo);
        } else if (curateSpec.getVCDocumentInfo() instanceof BioModelInfo) {
            bioModelInfoHash.remove(curateSpec.getVCDocumentInfo().getVersion().getVersionKey());
            bioModelInfoHash.put(newVCDocumentInfo.getVersion().getVersionKey(), (BioModelInfo) newVCDocumentInfo);
        }
        fireDatabaseUpdate(new DatabaseEvent(this, DatabaseEvent.UPDATE, curateSpec.getVCDocumentInfo(), newVCDocumentInfo));
    } catch (Exception e) {
        e.printStackTrace();
        throw new DataAccessException(e.getClass().getName() + " " + e.getMessage());
    }
}
Also used : VCDocumentInfo(org.vcell.util.document.VCDocumentInfo) BioModelInfo(org.vcell.util.document.BioModelInfo) MathModelInfo(org.vcell.util.document.MathModelInfo) PermissionException(org.vcell.util.PermissionException) ObjectNotFoundException(org.vcell.util.ObjectNotFoundException) XmlParseException(cbit.vcell.xml.XmlParseException) RemoteProxyException(cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException) DataAccessException(org.vcell.util.DataAccessException) ExpressionException(cbit.vcell.parser.ExpressionException) MathException(cbit.vcell.math.MathException) DataAccessException(org.vcell.util.DataAccessException)

Example 13 with MathModelInfo

use of org.vcell.util.document.MathModelInfo in project vcell by virtualcell.

the class MathModelCellRenderer 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);
    // 
    try {
        if (value instanceof BioModelNode) {
            BioModelNode node = (BioModelNode) value;
            Object userObject = node.getUserObject();
            if (userObject instanceof User) {
                String label = null;
                if (sessionUser != null && sessionUser.compareEqual((User) userObject)) {
                    label = "My MathModels (" + ((User) userObject).getName() + ") (" + node.getChildCount() + ")";
                } else {
                    label = ((User) userObject).getName() + "                             ";
                }
                component.setToolTipText(label);
                component.setText(label);
            } else if (userObject instanceof MathModelInfo) {
                MathModelInfo mathModelInfo = (MathModelInfo) userObject;
                if (mathModelInfo.getVersion().getFlag().compareEqual(org.vcell.util.document.VersionFlag.Archived)) {
                    component.setText("(Archived) " + component.getText());
                } else if (mathModelInfo.getVersion().getFlag().compareEqual(org.vcell.util.document.VersionFlag.Published)) {
                    component.setText("(Published) " + component.getText());
                }
            } else if (userObject instanceof VCDocumentInfoNode) {
                VCDocumentInfoNode infonode = (VCDocumentInfoNode) userObject;
                User nodeUser = infonode.getVCDocumentInfo().getVersion().getOwner();
                String modelName = infonode.getVCDocumentInfo().getVersion().getName();
                String username = nodeUser.getName();
                if (nodeUser.compareEqual(sessionUser) || username.equals(VCDocumentDbTreeModel.USER_tutorial) || username.equals(VCDocumentDbTreeModel.USER_Education)) {
                    setText(modelName);
                } else {
                    setText("<html><b>" + nodeUser.getName() + " </b> : " + modelName + "</html>");
                }
            }
        }
    } catch (Throwable e) {
        e.printStackTrace(System.out);
    }
    // 
    if (component.getToolTipText() == null || component.getToolTipText().length() == 0) {
        component.setToolTipText(component.getText());
    }
    return component;
}
Also used : User(org.vcell.util.document.User) JLabel(javax.swing.JLabel) MathModelInfo(org.vcell.util.document.MathModelInfo)

Example 14 with MathModelInfo

use of org.vcell.util.document.MathModelInfo in project vcell by virtualcell.

the class MathModelDbTreeModel method databaseDelete.

/**
 * @param event cbit.vcell.clientdb.DatabaseEvent
 */
public void databaseDelete(DatabaseEvent databaseEvent) {
    if (databaseEvent.getOldVersionInfo() instanceof MathModelInfo) {
        MathModelInfo removedMathModelInfo = (MathModelInfo) databaseEvent.getOldVersionInfo();
        BioModelNode removedNode = ((BioModelNode) getRoot()).findNodeByUserObject(removedMathModelInfo);
        if (removedNode != null) {
            if (removedNode.getParent() != null && removedNode.getSiblingCount() == 1) {
                // just this one version
                removedNode = (BioModelNode) removedNode.getParent();
            }
            removeNodeFromParent(removedNode);
        }
    }
}
Also used : MathModelInfo(org.vcell.util.document.MathModelInfo)

Example 15 with MathModelInfo

use of org.vcell.util.document.MathModelInfo in project vcell by virtualcell.

the class MathModelDbTreeModel 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, MathModelInfo[] mathModelInfos) throws DataAccessException {
    // 
    // for each user
    // 
    BioModelNode rootNode = new BioModelNode(owner, true);
    for (int i = 0; i < mathModelInfos.length; i++) {
        MathModelInfo mathModelInfo = mathModelInfos[i];
        if (mathModelInfo.getVersion().getOwner().equals(owner)) {
            if (!meetSearchCriteria(mathModelInfo)) {
                continue;
            }
            BioModelNode bioModelNode = new BioModelNode(new VCDocumentInfoNode(mathModelInfo), true);
            rootNode.add(bioModelNode);
            // 
            // get list of bioModels with the same branch
            // 
            Vector<MathModelInfo> mathModelBranchList = new Vector<MathModelInfo>();
            mathModelBranchList.addElement(mathModelInfo);
            for (i = i + 1; i < mathModelInfos.length; i++) {
                if (mathModelInfos[i].getVersion().getBranchID().equals(mathModelInfo.getVersion().getBranchID())) {
                    if (!meetSearchCriteria(mathModelInfos[i])) {
                        continue;
                    }
                    mathModelBranchList.add(0, mathModelInfos[i]);
                } else {
                    i--;
                    break;
                }
            }
            MathModelInfo[] mathModelInfosInBranch = null;
            if (getLatestOnly()) {
                mathModelInfosInBranch = new MathModelInfo[1];
                mathModelInfosInBranch[0] = (MathModelInfo) mathModelBranchList.elementAt(0);
            } else {
                mathModelInfosInBranch = new MathModelInfo[mathModelBranchList.size()];
                mathModelBranchList.copyInto(mathModelInfosInBranch);
            }
            for (int versionCount = 0; versionCount < mathModelInfosInBranch.length; versionCount++) {
                bioModelNode.add(createVersionSubTree(mathModelInfosInBranch[versionCount]));
            }
        }
    }
    return rootNode;
}
Also used : VCDocumentInfoNode(cbit.vcell.desktop.VCellBasicCellRenderer.VCDocumentInfoNode) MathModelInfo(org.vcell.util.document.MathModelInfo) Vector(java.util.Vector)

Aggregations

MathModelInfo (org.vcell.util.document.MathModelInfo)67 BioModelInfo (org.vcell.util.document.BioModelInfo)37 DataAccessException (org.vcell.util.DataAccessException)32 GeometryInfo (cbit.vcell.geometry.GeometryInfo)22 VCDocumentInfo (org.vcell.util.document.VCDocumentInfo)14 MathModel (cbit.vcell.mathmodel.MathModel)12 Vector (java.util.Vector)11 BioModel (cbit.vcell.biomodel.BioModel)10 KeyValue (org.vcell.util.document.KeyValue)10 RemoteProxyException (cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException)8 Hashtable (java.util.Hashtable)8 ObjectNotFoundException (org.vcell.util.ObjectNotFoundException)8 User (org.vcell.util.document.User)8 Simulation (cbit.vcell.solver.Simulation)7 UserCancelException (org.vcell.util.UserCancelException)7 Geometry (cbit.vcell.geometry.Geometry)6 SimulationContext (cbit.vcell.mapping.SimulationContext)6 TestCriteriaNewBioModel (cbit.vcell.numericstest.TestCriteriaNewBioModel)6 TestCriteriaNewMathModel (cbit.vcell.numericstest.TestCriteriaNewMathModel)6 SimulationInfo (cbit.vcell.solver.SimulationInfo)6