Search in sources :

Example 6 with VersionInfo

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

the class MathModelDbTreePanel method treeSelection.

/**
 * Comment
 */
protected void treeSelection() {
    TreePath treePath = getJTree1().getSelectionPath();
    if (treePath == null) {
        setSelectedVersionInfo(null);
        return;
    }
    BioModelNode bioModelNode = (BioModelNode) treePath.getLastPathComponent();
    Object object = bioModelNode.getUserObject();
    if (object instanceof VersionInfo) {
        setSelectedVersionInfo((VersionInfo) object);
    } else if (object instanceof VCDocumentInfoNode && bioModelNode.getChildCount() > 0 && ((BioModelNode) bioModelNode.getChildAt(0)).getUserObject() instanceof MathModelInfo) {
        MathModelInfo mathModelInfo = (MathModelInfo) ((BioModelNode) bioModelNode.getChildAt(0)).getUserObject();
        setSelectedVersionInfo(mathModelInfo);
    } else {
        setSelectedVersionInfo(null);
    }
}
Also used : VersionInfo(org.vcell.util.document.VersionInfo) TreePath(javax.swing.tree.TreePath) VCDocumentInfoNode(cbit.vcell.desktop.VCellBasicCellRenderer.VCDocumentInfoNode) MathModelInfo(org.vcell.util.document.MathModelInfo)

Example 7 with VersionInfo

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

the class GeometryTreePanel method treeSelection.

/**
 * Comment
 */
protected void treeSelection() {
    TreePath treePath = getJTree1().getSelectionPath();
    if (treePath == null) {
        setSelectedVersionInfo(null);
        return;
    }
    BioModelNode bioModelNode = (BioModelNode) treePath.getLastPathComponent();
    Object object = bioModelNode.getUserObject();
    try {
        BeanUtils.setCursorThroughout(this, java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
        if (object instanceof VersionInfo) {
            setSelectedVersionInfo((VersionInfo) object);
        } else if (object instanceof VCDocumentInfoNode && bioModelNode.getChildCount() > 0 && ((BioModelNode) bioModelNode.getChildAt(0)).getUserObject() instanceof GeometryInfo) {
            GeometryInfo geometryInfo = (GeometryInfo) ((BioModelNode) bioModelNode.getChildAt(0)).getUserObject();
            setSelectedVersionInfo(geometryInfo);
        } else {
            setSelectedVersionInfo(null);
        }
    } catch (Exception exc) {
        handleException(exc);
    } finally {
        BeanUtils.setCursorThroughout(this, java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
    }
}
Also used : VersionInfo(org.vcell.util.document.VersionInfo) TreePath(javax.swing.tree.TreePath) GeometryInfo(cbit.vcell.geometry.GeometryInfo) VCDocumentInfoNode(cbit.vcell.desktop.VCellBasicCellRenderer.VCDocumentInfoNode)

Example 8 with VersionInfo

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

the class ImageDbTreePanel method treeSelection.

/**
 * Comment
 */
private void treeSelection() {
    TreeSelectionModel treeSelectionModel = getselectionModel1();
    TreePath treePath = treeSelectionModel.getSelectionPath();
    if (treePath == null) {
        setSelectedVersionInfo(null);
        return;
    }
    BioModelNode bioModelNode = (BioModelNode) treePath.getLastPathComponent();
    Object object = bioModelNode.getUserObject();
    if (object instanceof VersionInfo) {
        setSelectedVersionInfo((VersionInfo) object);
    // 
    // if selected parent of VCImageInfo, setSelection as it's SimulationInfo
    // 
    } else if (object instanceof String && bioModelNode.getChildCount() > 0 && ((BioModelNode) bioModelNode.getChildAt(0)).getUserObject() instanceof VCImageInfo) {
        VCImageInfo imgInfo = (VCImageInfo) ((BioModelNode) bioModelNode.getChildAt(0)).getUserObject();
        setSelectedVersionInfo(imgInfo);
    } else {
        setSelectedVersionInfo(null);
    }
}
Also used : VersionInfo(org.vcell.util.document.VersionInfo) TreePath(javax.swing.tree.TreePath) TreeSelectionModel(javax.swing.tree.TreeSelectionModel) VCImageInfo(cbit.image.VCImageInfo)

Example 9 with VersionInfo

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

the class DatabaseServerImpl method getVersionInfos.

/**
 * This method was created in VisualAge.
 * @return GeometryInfo
 * @param key KeyValue
 * @exception org.vcell.util.DataAccessException The exception description.
 * @exception java.rmi.RemoteException The exception description.
 */
private VersionInfo[] getVersionInfos(User user, KeyValue key, VersionableType vType, boolean bAll, boolean bCheckPermission) throws DataAccessException {
    try {
        if (lg.isTraceEnabled())
            lg.trace("DatabaseServerImpl.getVersionInfos(User=" + user + ",vType=" + vType + ",bAll=" + bAll + ")");
        Vector<VersionInfo> vector = dbTop.getVersionableInfos(user, key, vType, bAll, bCheckPermission, true);
        if (vType.equals(VersionableType.BioModelMetaData)) {
            BioModelInfo[] bioModelInfos = new BioModelInfo[vector.size()];
            vector.copyInto(bioModelInfos);
            return bioModelInfos;
        } else if (vType.equals(VersionableType.Geometry)) {
            GeometryInfo[] geoInfos = new GeometryInfo[vector.size()];
            vector.copyInto(geoInfos);
            return geoInfos;
        } else if (vType.equals(VersionableType.MathModelMetaData)) {
            MathModelInfo[] mathInfos = new MathModelInfo[vector.size()];
            vector.copyInto(mathInfos);
            return mathInfos;
        } else if (vType.equals(VersionableType.VCImage)) {
            VCImageInfo[] imgInfos = new VCImageInfo[vector.size()];
            vector.copyInto(imgInfos);
            return imgInfos;
        } else if (vType.equals(VersionableType.Simulation)) {
            SimulationInfo[] simInfos = new SimulationInfo[vector.size()];
            vector.copyInto(simInfos);
            return simInfos;
        } else {
            throw new IllegalArgumentException("Wrong VersinableType vType:" + vType);
        }
    } catch (SQLException e) {
        lg.error(e.getMessage(), e);
        throw new DataAccessException(e.getMessage());
    } catch (ObjectNotFoundException e) {
        lg.error(e.getMessage(), e);
        throw new ObjectNotFoundException(e.getMessage());
    } catch (Throwable e) {
        lg.error(e.getMessage(), e);
        throw new DataAccessException(e.getMessage());
    }
}
Also used : SQLException(java.sql.SQLException) BioModelInfo(org.vcell.util.document.BioModelInfo) MathModelInfo(org.vcell.util.document.MathModelInfo) VersionInfo(org.vcell.util.document.VersionInfo) ObjectNotFoundException(org.vcell.util.ObjectNotFoundException) DataAccessException(org.vcell.util.DataAccessException) SimulationInfo(cbit.vcell.solver.SimulationInfo)

Example 10 with VersionInfo

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

the class DatabaseServerImpl method groupAddUser.

/**
 * This method was created in VisualAge.
 * @return void
 * @param key KeyValue
 * @exception org.vcell.util.DataAccessException The exception description.
 * @exception java.rmi.RemoteException The exception description.
 */
public VersionInfo groupAddUser(User user, VersionableType vType, KeyValue key, String addUserToGroup, boolean isHidden) throws DataAccessException, ObjectNotFoundException {
    try {
        if (lg.isTraceEnabled())
            lg.trace("DatabaseServerImpl.groupAddUser(vType=" + vType.getTypeName() + ", Key=" + key + ", userToAdd=" + addUserToGroup + ", isHidden=" + isHidden + ")");
        dbTop.groupAddUser(user, vType, key, true, addUserToGroup, isHidden);
        VersionInfo newVersionInfo = (VersionInfo) (dbTop.getVersionableInfos(user, key, vType, false, true, true).elementAt(0));
        return newVersionInfo;
    } catch (SQLException e) {
        lg.error(e.getMessage(), e);
        throw new DataAccessException(e.getMessage());
    } catch (ObjectNotFoundException e) {
        lg.error(e.getMessage(), e);
        throw new ObjectNotFoundException(e.getMessage());
    } catch (Throwable e) {
        lg.error(e.getMessage(), e);
        throw new DataAccessException(e.getMessage());
    }
}
Also used : VersionInfo(org.vcell.util.document.VersionInfo) SQLException(java.sql.SQLException) ObjectNotFoundException(org.vcell.util.ObjectNotFoundException) DataAccessException(org.vcell.util.DataAccessException)

Aggregations

VersionInfo (org.vcell.util.document.VersionInfo)28 DataAccessException (org.vcell.util.DataAccessException)18 ObjectNotFoundException (org.vcell.util.ObjectNotFoundException)10 SQLException (java.sql.SQLException)6 BigDecimal (java.math.BigDecimal)5 VersionableTypeVersion (org.vcell.util.document.VersionableTypeVersion)5 ResultSet (java.sql.ResultSet)4 Statement (java.sql.Statement)4 Hashtable (java.util.Hashtable)4 MathModelInfo (org.vcell.util.document.MathModelInfo)4 Version (org.vcell.util.document.Version)4 VCImageInfo (cbit.image.VCImageInfo)3 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)3 GeometryInfo (cbit.vcell.geometry.GeometryInfo)3 Connection (java.sql.Connection)3 Vector (java.util.Vector)3 TreePath (javax.swing.tree.TreePath)3 BioModelInfo (org.vcell.util.document.BioModelInfo)3 VCDocumentInfoNode (cbit.vcell.desktop.VCellBasicCellRenderer.VCDocumentInfoNode)2 SimulationInfo (cbit.vcell.solver.SimulationInfo)2