Search in sources :

Example 6 with VCImageInfo

use of cbit.image.VCImageInfo in project vcell by virtualcell.

the class ImageDbTreeModel 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
 */
private BioModelNode createBaseTree() throws DataAccessException {
    VCImageInfo[] imageInfos = getDocumentManager().getImageInfos();
    BioModelNode rootRootNode = new BioModelNode("Images", true);
    // 
    // get list of users (owners)
    // 
    Vector<User> ownerList = new Vector<User>();
    ownerList.addElement(getDocumentManager().getUser());
    for (int i = 0; i < imageInfos.length; i++) {
        VCImageInfo imageInfo = imageInfos[i];
        if (!ownerList.contains(imageInfo.getVersion().getOwner())) {
            ownerList.addElement(imageInfo.getVersion().getOwner());
        }
    }
    // 
    // for each user
    // 
    TreeMap<String, BioModelNode> treeMap = new TreeMap<String, BioModelNode>();
    for (int ownerIndex = 0; ownerIndex < ownerList.size(); ownerIndex++) {
        User owner = (User) ownerList.elementAt(ownerIndex);
        BioModelNode ownerNode = createOwnerSubTree(owner);
        if (owner.equals(getDocumentManager().getUser()) || ownerNode.getChildCount() > 0) {
            treeMap.put(owner.getName().toLowerCase(), ownerNode);
        }
    }
    // 
    rootRootNode.add((BioModelNode) treeMap.remove(getDocumentManager().getUser().getName().toLowerCase()));
    BioModelNode otherUsersNode = new BioModelNode("Images Neighborhood", true);
    rootRootNode.add(otherUsersNode);
    Object[] bmnArr = treeMap.values().toArray();
    for (int i = 0; i < bmnArr.length; i += 1) {
        otherUsersNode.add((BioModelNode) bmnArr[i]);
    }
    return rootRootNode;
}
Also used : User(org.vcell.util.document.User) TreeMap(java.util.TreeMap) Vector(java.util.Vector) VCImageInfo(cbit.image.VCImageInfo)

Example 7 with VCImageInfo

use of cbit.image.VCImageInfo 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 8 with VCImageInfo

use of cbit.image.VCImageInfo in project vcell by virtualcell.

the class ImageTable method getInfo.

/**
 * This method was created in VisualAge.
 * @return VCImage
 * @param rset ResultSet
 * @param log SessionLog
 */
public VersionInfo getInfo(ResultSet rset, Connection con, DatabaseSyntax dbSyntax) throws SQLException, DataAccessException {
    GIFImage gifImage = null;
    try {
        // gifImage = new GIFImage(rset.getBytes(BrowseImageDataTable.table.data.toString()));
        byte[] gifData = (byte[]) DbDriver.getLOB(rset, BrowseImageDataTable.table.data, dbSyntax);
        gifImage = new GIFImage(gifData);
    // 
    } catch (GifParsingException e) {
        throw new DataAccessException("Error Parsing browseImage");
    }
    java.math.BigDecimal groupid = rset.getBigDecimal(VersionTable.privacy_ColumnName);
    Version version = getVersion(rset, DbDriver.getGroupAccessFromGroupID(con, groupid));
    int x = rset.getInt(ImageTable.table.numX.toString());
    int y = rset.getInt(ImageTable.table.numY.toString());
    int z = rset.getInt(ImageTable.table.numZ.toString());
    org.vcell.util.ISize size = new org.vcell.util.ISize(x, y, z);
    double extentX = rset.getBigDecimal(ExtentTable.table.extentX.toString()).doubleValue();
    double extentY = rset.getBigDecimal(ExtentTable.table.extentY.toString()).doubleValue();
    double extentZ = rset.getBigDecimal(ExtentTable.table.extentZ.toString()).doubleValue();
    org.vcell.util.Extent extent = new org.vcell.util.Extent(extentX, extentY, extentZ);
    String softwareVersion = rset.getString(SoftwareVersionTable.table.softwareVersion.toString());
    return new VCImageInfo(version, size, extent, gifImage, VCellSoftwareVersion.fromString(softwareVersion));
}
Also used : GifParsingException(cbit.image.GifParsingException) GIFImage(cbit.image.GIFImage) VCellSoftwareVersion(org.vcell.util.document.VCellSoftwareVersion) Version(org.vcell.util.document.Version) DataAccessException(org.vcell.util.DataAccessException) VCImageInfo(cbit.image.VCImageInfo)

Example 9 with VCImageInfo

use of cbit.image.VCImageInfo 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 VCImageInfo setGroupPrivate(VCImageInfo imageInfo) throws DataAccessException {
    try {
        // 
        // unpublish from database
        // 
        VCImageInfo newImageInfo = (VCImageInfo) setGroupPrivate0(imageInfo, VersionableType.VCImage, imgInfoHash);
        // 
        // delete Image from cache
        // 
        xmlHash.remove(imageInfo.getVersion().getVersionKey());
        fireDatabaseUpdate(new DatabaseEvent(this, DatabaseEvent.UPDATE, imageInfo, newImageInfo));
        return newImageInfo;
    } catch (RemoteProxyException e) {
        handleRemoteProxyException(e);
        throw new DataAccessException(e.getMessage());
    }
}
Also used : VCImageInfo(cbit.image.VCImageInfo) DataAccessException(org.vcell.util.DataAccessException) RemoteProxyException(cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException)

Example 10 with VCImageInfo

use of cbit.image.VCImageInfo in project vcell by virtualcell.

the class ClientDocumentManager method removeUserFromGroup.

/**
 * Insert the method's description here.
 * Creation date: (11/28/00 5:43:44 PM)
 * @param bioModelInfo cbit.vcell.biomodel.BioModelInfo
 */
public VCImageInfo removeUserFromGroup(VCImageInfo imageInfo, String userToRemove) throws DataAccessException {
    try {
        // 
        // publish from database
        // 
        VCImageInfo newImageInfo = (VCImageInfo) removeUserFromGroup0(imageInfo, VersionableType.VCImage, imgInfoHash, userToRemove);
        // 
        // delete Image from cache
        // 
        xmlHash.remove(imageInfo.getVersion().getVersionKey());
        fireDatabaseUpdate(new DatabaseEvent(this, DatabaseEvent.UPDATE, imageInfo, newImageInfo));
        return newImageInfo;
    } catch (RemoteProxyException e) {
        handleRemoteProxyException(e);
        throw new DataAccessException(e.getMessage());
    }
}
Also used : VCImageInfo(cbit.image.VCImageInfo) DataAccessException(org.vcell.util.DataAccessException) RemoteProxyException(cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException)

Aggregations

VCImageInfo (cbit.image.VCImageInfo)17 DataAccessException (org.vcell.util.DataAccessException)10 RemoteProxyException (cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException)6 VCImage (cbit.image.VCImage)4 GeometryInfo (cbit.vcell.geometry.GeometryInfo)4 GIFImage (cbit.image.GIFImage)3 ISize (org.vcell.util.ISize)3 ObjectNotFoundException (org.vcell.util.ObjectNotFoundException)3 BioModelInfo (org.vcell.util.document.BioModelInfo)3 MathModelInfo (org.vcell.util.document.MathModelInfo)3 User (org.vcell.util.document.User)3 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)2 Geometry (cbit.vcell.geometry.Geometry)2 MathException (cbit.vcell.math.MathException)2 ExpressionException (cbit.vcell.parser.ExpressionException)2 XmlParseException (cbit.vcell.xml.XmlParseException)2 Hashtable (java.util.Hashtable)2 Vector (java.util.Vector)2 BigString (org.vcell.util.BigString)2 KeyValue (org.vcell.util.document.KeyValue)2