Search in sources :

Example 1 with MathType

use of org.vcell.util.document.BioModelChildSummary.MathType in project vcell by virtualcell.

the class ApplicationPropertiesTreeModel method populateRootNode.

/**
 * Insert the method's description here.
 * Creation date: (11/28/00 2:41:43 PM)
 * @param bioModelNode cbit.vcell.desktop.BioModelNode
 * @param bioModelInfo cbit.vcell.biomodel.BioModelInfo
 */
private void populateRootNode() {
    rootNode.removeAllChildren();
    if (simulationContext == null) {
        rootNode.setUserObject("Select an application to show properties");
    } else {
        rootNode.setUserObject(simulationContext);
        // add application type node
        MathType typeInfo = simulationContext.getMathType();
        BioModelNode appTypeNode = new BioModelNode(typeInfo, false);
        appTypeNode.setRenderHint("type", "AppType");
        rootNode.add(appTypeNode);
        rootNode.add(new BioModelNode(simulationContext.getGeometry(), false));
        rootNode.add(new BioModelNode(simulationContext.getMathDescription() == null ? "math not generated" : "math generated", false));
        Simulation[] simArray = simulationContext.getSimulations();
        if (simArray != null) {
            for (Simulation sim : simArray) {
                BioModelNode simNode = new BioModelNode(sim, true);
                simNode.add(new BioModelNode(new Annotation(sim.getDescription()), false));
                rootNode.add(simNode);
            }
        }
    }
    nodeStructureChanged(rootNode);
}
Also used : Simulation(cbit.vcell.solver.Simulation) MathType(org.vcell.util.document.BioModelChildSummary.MathType) BioModelNode(cbit.vcell.desktop.BioModelNode) Annotation(cbit.vcell.desktop.Annotation)

Example 2 with MathType

use of org.vcell.util.document.BioModelChildSummary.MathType in project vcell by virtualcell.

the class BioModelTreePanel method actionsOnClick.

/**
 * Comment
 */
private void actionsOnClick(MouseEvent mouseEvent) {
    DefaultMutableTreeNode currentTreeSelection = (DefaultMutableTreeNode) getJTree2().getLastSelectedPathComponent();
    Object selectedObject = null;
    if (currentTreeSelection == null) {
        return;
    }
    selectedObject = currentTreeSelection.getUserObject();
    // double click
    if (mouseEvent.getClickCount() == 2) {
        if (selectedObject instanceof SimulationContext) {
            fireActionPerformed(new ActionEvent(this, mouseEvent.getID(), GuiConstants.ACTIONCMD_OPEN_APPLICATION, mouseEvent.getModifiers()));
        } else if (selectedObject instanceof Annotation) {
            editAnnotation();
        } else if (selectedObject instanceof MathDescription) {
            fireActionPerformed(new ActionEvent(this, mouseEvent.getID(), GuiConstants.ACTIONCMD_OPEN_APPLICATION_MATH, mouseEvent.getModifiers()));
        } else if (selectedObject instanceof Geometry) {
            fireActionPerformed(new ActionEvent(this, mouseEvent.getID(), GuiConstants.ACTIONCMD_OPEN_APPLICATION_GEOMETRY, mouseEvent.getModifiers()));
        } else if (selectedObject instanceof Simulation) {
            fireActionPerformed(new ActionEvent(this, mouseEvent.getID(), GuiConstants.ACTIONCMD_OPEN_APPLICATION_SIMULATION, mouseEvent.getModifiers()));
        } else if (selectedObject instanceof MathType) {
            // deterministic or stochastic or rule-bsaed
            fireActionPerformed(new ActionEvent(this, mouseEvent.getID(), GuiConstants.ACTIONCMD_OPEN_APPLICATION_DETSTOCH, mouseEvent.getModifiers()));
        }
        return;
    }
    // right click
    if (mouseEvent.isPopupTrigger()) {
        Point mousePoint = mouseEvent.getPoint();
        if (selectedObject instanceof BioModel) {
            getBioModelPopupMenu().show(getJTree2(), mousePoint.x, mousePoint.y);
        } else if (selectedObject instanceof SimulationContext) {
            getAppPopupMenu().show(getJTree2(), mousePoint.x, mousePoint.y);
        } else if (selectedObject instanceof Simulation) {
            getSimPopupMenu().show(getJTree2(), mousePoint.x, mousePoint.y);
        }
        if (selectedObject instanceof Annotation) {
            getEditAnnotationPopupMenu().show(getJTree2(), mousePoint.x, mousePoint.y);
        }
    }
}
Also used : Geometry(cbit.vcell.geometry.Geometry) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) Simulation(cbit.vcell.solver.Simulation) MathDescription(cbit.vcell.math.MathDescription) ActionEvent(java.awt.event.ActionEvent) BioModel(cbit.vcell.biomodel.BioModel) MathType(org.vcell.util.document.BioModelChildSummary.MathType) Point(java.awt.Point) SimulationContext(cbit.vcell.mapping.SimulationContext)

Example 3 with MathType

use of org.vcell.util.document.BioModelChildSummary.MathType in project vcell by virtualcell.

the class MathModelMetaDataTreeModel method createVersionSubTree.

/**
 * Insert the method's description here.
 * Creation date: (11/28/00 2:41:43 PM)
 * @param mathModelNode cbit.vcell.desktop.BioModelNode
 * @param mathModelInfo cbit.vcell.mathmodel.MathModelInfo
 */
private BioModelNode createVersionSubTree(MathModelInfo mathModelInfo) throws DataAccessException {
    BioModelNode versionNode = new BioModelNode(mathModelInfo, true);
    if (showGeneralInfoNode) {
        String name = "Database File Info";
        BioModelNode generalInfoNode = new BioModelNode(name, true);
        generalInfoNode.setRenderHint("type", "GeneralFileInfo");
        Version version = mathModelInfo.getVersion();
        BigDecimal groupid = version.getGroupAccess().getGroupid();
        BioModelNode mNameNode = new BioModelNode(version.getName(), true);
        mNameNode.setRenderHint("type", "ModelName");
        mNameNode.setRenderHint("category", "MathModel");
        generalInfoNode.add(mNameNode);
        BioModelNode mIdentifierNode = new BioModelNode(version.getVersionKey(), true);
        mIdentifierNode.setRenderHint("type", "VCellIdentifier");
        mNameNode.add(mIdentifierNode);
        BioModelNode mOwnerNode = new BioModelNode(version.getOwner(), true);
        mOwnerNode.setRenderHint("type", "ModelOwner");
        mNameNode.add(mOwnerNode);
        BioModelNode mDateNode = new BioModelNode(version.getDate(), true);
        mDateNode.setRenderHint("type", "ModelDate");
        mNameNode.add(mDateNode);
        String permissions;
        if (groupid.equals(GroupAccess.GROUPACCESS_ALL)) {
            permissions = "Public";
        } else if (groupid.equals(GroupAccess.GROUPACCESS_NONE)) {
            permissions = "Private";
        } else {
            permissions = (version.getGroupAccess().getDescription());
        }
        if (mathModelInfo.getPublicationInfos() != null && mathModelInfo.getPublicationInfos().length > 0) {
            if (mathModelInfo.getVersion().getFlag().compareEqual(org.vcell.util.document.VersionFlag.Published)) {
                // must be Public
                permissions = "Published";
            } else {
                permissions = "Curated";
            }
        } else if (mathModelInfo.getVersion().getFlag().compareEqual(org.vcell.util.document.VersionFlag.Archived)) {
            permissions += ", Archived";
        }
        BioModelNode mPermissionsNode = new BioModelNode(permissions, true);
        mPermissionsNode.setRenderHint("type", "Permissions");
        mNameNode.add(mPermissionsNode);
        versionNode.add(generalInfoNode);
    }
    if (mathModelInfo.getPublicationInfos().length > 0) {
        String name = mathModelInfo.getPublicationInfos().length > 1 ? "Publications" : "Publication";
        BioModelNode publicationsInfoNode = new BioModelNode(name, true);
        publicationsInfoNode.setRenderHint("type", "PublicationsInfo");
        for (int i = 0; i < mathModelInfo.getPublicationInfos().length; i++) {
            BioModelNode piTitleNode = new BioModelNode(mathModelInfo.getPublicationInfos()[i], true);
            piTitleNode.setRenderHint("type", "PublicationInfoTitle");
            publicationsInfoNode.add(piTitleNode);
            BioModelNode piAuthorsNode = new BioModelNode(mathModelInfo.getPublicationInfos()[i], false);
            piAuthorsNode.setRenderHint("type", "PublicationInfoAuthors");
            piTitleNode.add(piAuthorsNode);
            BioModelNode piCitationNode = new BioModelNode(mathModelInfo.getPublicationInfos()[i], false);
            piCitationNode.setRenderHint("type", "PublicationInfoCitation");
            piTitleNode.add(piCitationNode);
            BioModelNode piDoiNode = new BioModelNode(mathModelInfo.getPublicationInfos()[i], false);
            piDoiNode.setRenderHint("type", "PublicationInfoDoi");
            piTitleNode.add(piDoiNode);
            if (mathModelInfo.getPublicationInfos()[i].getUrl() != null && !mathModelInfo.getPublicationInfos()[i].getUrl().isEmpty()) {
                if (mathModelInfo.getPublicationInfos()[i].getUrl().contains("pubmed") || mathModelInfo.getPublicationInfos()[i].getUrl().contains("PubMed")) {
                    BioModelNode piUrlNode = new BioModelNode(mathModelInfo.getPublicationInfos()[i], false);
                    piUrlNode.setRenderHint("type", "PublicationInfoUrl");
                    piTitleNode.add(piUrlNode);
                }
            }
        }
        versionNode.add(publicationsInfoNode);
    }
    if (mathModelInfo.getVersion().getAnnot() != null && mathModelInfo.getVersion().getAnnot().trim().length() > 0) {
        BioModelNode provenanceNode = new BioModelNode("Model Provenance", true);
        provenanceNode.setRenderHint("type", "Provenance");
        versionNode.add(provenanceNode);
        String annotations = mathModelInfo.getVersion().getAnnot();
        StringTokenizer tokenizer = new StringTokenizer(annotations, "\n");
        while (tokenizer.hasMoreTokens()) {
            String annotation = tokenizer.nextToken();
            provenanceNode.add(new BioModelNode(new Annotation(annotation), false));
        }
    }
    MathModelChildSummary mathModelChildSummary = mathModelInfo.getMathModelChildSummary();
    if (mathModelChildSummary == null) {
        versionNode.add(new BioModelNode("SUMMARY INFORMATION NOT AVAILABLE", false));
    } else {
        int geomDim = mathModelChildSummary.getGeometryDimension();
        String geomName = mathModelChildSummary.getGeometryName();
        MathType modelType = mathModelChildSummary.getModelType();
        // add model type tree node
        BioModelNode modelTypeNode = new BioModelNode(modelType, false);
        modelTypeNode.setRenderHint("type", "AppType");
        versionNode.add(modelTypeNode);
        BioModelNode geometryNode = null;
        if (geomDim > 0) {
            geometryNode = new BioModelNode(geomName + " (" + geomDim + "D)", false);
        } else {
            geometryNode = new BioModelNode(BioModelChildSummary.COMPARTMENTAL_GEO_STR, false);
        }
        geometryNode.setRenderHint("type", "Geometry");
        geometryNode.setRenderHint("dimension", new Integer(geomDim));
        versionNode.add(geometryNode);
        // 
        // add simulations to simulationContext
        // 
        String[] simNames = mathModelChildSummary.getSimulationNames();
        String[] simAnnot = mathModelChildSummary.getSimulationAnnotations();
        for (int j = 0; j < simNames.length; j++) {
            BioModelNode simNode = new BioModelNode(simNames[j], true);
            simNode.setRenderHint("type", "Simulation");
            versionNode.add(simNode);
            if (simAnnot[j] != null && simAnnot[j].trim().length() > 0) {
                simNode.add(new BioModelNode(new Annotation(simAnnot[j]), false));
            }
        }
    }
    return versionNode;
}
Also used : StringTokenizer(java.util.StringTokenizer) MathModelChildSummary(org.vcell.util.document.MathModelChildSummary) Version(org.vcell.util.document.Version) MathType(org.vcell.util.document.BioModelChildSummary.MathType) BigDecimal(java.math.BigDecimal)

Example 4 with MathType

use of org.vcell.util.document.BioModelChildSummary.MathType in project vcell by virtualcell.

the class MathModel method createMathModelChildSummary.

public MathModelChildSummary createMathModelChildSummary() {
    MathType modelType = getMathDescription().getMathType();
    String geoName = getMathDescription().getGeometry().getName();
    int geoDim = getMathDescription().getGeometry().getDimension();
    Simulation[] sims = getSimulations();
    String[] simNames = new String[sims.length];
    String[] simAnnots = new String[sims.length];
    for (int i = 0; i < sims.length; i += 1) {
        simNames[i] = sims[i].getName();
        simAnnots[i] = sims[i].getDescription();
    }
    return new MathModelChildSummary(modelType, geoName, geoDim, simNames, simAnnots);
}
Also used : MathModelChildSummary(org.vcell.util.document.MathModelChildSummary) Simulation(cbit.vcell.solver.Simulation) MathType(org.vcell.util.document.BioModelChildSummary.MathType)

Example 5 with MathType

use of org.vcell.util.document.BioModelChildSummary.MathType in project vcell by virtualcell.

the class BioModelInfoTreeModel method createVersionSubTree.

/**
 * Insert the method's description here.
 * Creation date: (11/28/00 2:41:43 PM)
 * @param bioModelNode cbit.vcell.desktop.BioModelNode
 * @param bioModelInfo cbit.vcell.biomodel.BioModelInfo
 */
private BioModelNode createVersionSubTree(BioModelInfo bioModelInfo) throws DataAccessException {
    BioModelNode versionNode = new BioModelNode(bioModelInfo, true);
    generalInfoNode = null;
    publicationsInfoNode = null;
    applicationsNode = null;
    if (showGeneralInfoNode) {
        String name = "Database File Info";
        generalInfoNode = new BioModelNode(name, true);
        generalInfoNode.setRenderHint("type", "GeneralFileInfo");
        Version version = bioModelInfo.getVersion();
        BigDecimal groupid = version.getGroupAccess().getGroupid();
        BioModelNode mNameNode = new BioModelNode(version.getName(), true);
        mNameNode.setRenderHint("type", "ModelName");
        mNameNode.setRenderHint("category", "BioModel");
        generalInfoNode.add(mNameNode);
        BioModelNode mIdentifierNode = new BioModelNode(version.getVersionKey(), true);
        mIdentifierNode.setRenderHint("type", "VCellIdentifier");
        mNameNode.add(mIdentifierNode);
        BioModelNode mOwnerNode = new BioModelNode(version.getOwner(), true);
        mOwnerNode.setRenderHint("type", "ModelOwner");
        mNameNode.add(mOwnerNode);
        BioModelNode mDateNode = new BioModelNode(version.getDate(), true);
        mDateNode.setRenderHint("type", "ModelDate");
        mNameNode.add(mDateNode);
        String permissions;
        if (groupid.equals(GroupAccess.GROUPACCESS_ALL)) {
            permissions = "Public";
        } else if (groupid.equals(GroupAccess.GROUPACCESS_NONE)) {
            permissions = "Private";
        } else {
            permissions = (version.getGroupAccess().getDescription());
        }
        if (bioModelInfo.getPublicationInfos() != null && bioModelInfo.getPublicationInfos().length > 0) {
            if (bioModelInfo.getVersion().getFlag().compareEqual(org.vcell.util.document.VersionFlag.Published)) {
                // must be Public
                permissions = "Published";
            } else {
                permissions = "Curated";
            }
        } else if (bioModelInfo.getVersion().getFlag().compareEqual(org.vcell.util.document.VersionFlag.Archived)) {
            permissions += ", Archived";
        }
        BioModelNode mPermissionsNode = new BioModelNode(permissions, true);
        mPermissionsNode.setRenderHint("type", "Permissions");
        mNameNode.add(mPermissionsNode);
        versionNode.add(generalInfoNode);
    }
    if (bioModelInfo.getPublicationInfos().length > 0) {
        String name = bioModelInfo.getPublicationInfos().length > 1 ? "Publications" : "Publication";
        publicationsInfoNode = new BioModelNode(name, true);
        publicationsInfoNode.setRenderHint("type", "PublicationsInfo");
        for (int i = 0; i < bioModelInfo.getPublicationInfos().length; i++) {
            BioModelNode piTitleNode = new BioModelNode(bioModelInfo.getPublicationInfos()[i], true);
            piTitleNode.setRenderHint("type", "PublicationInfoTitle");
            publicationsInfoNode.add(piTitleNode);
            BioModelNode piAuthorsNode = new BioModelNode(bioModelInfo.getPublicationInfos()[i], false);
            piAuthorsNode.setRenderHint("type", "PublicationInfoAuthors");
            piTitleNode.add(piAuthorsNode);
            BioModelNode piCitationNode = new BioModelNode(bioModelInfo.getPublicationInfos()[i], false);
            piCitationNode.setRenderHint("type", "PublicationInfoCitation");
            piTitleNode.add(piCitationNode);
            BioModelNode piDoiNode = new BioModelNode(bioModelInfo.getPublicationInfos()[i], false);
            piDoiNode.setRenderHint("type", "PublicationInfoDoi");
            piTitleNode.add(piDoiNode);
            if (bioModelInfo.getPublicationInfos()[i].getUrl() != null && !bioModelInfo.getPublicationInfos()[i].getUrl().isEmpty()) {
                if (bioModelInfo.getPublicationInfos()[i].getUrl().contains("pubmed") || bioModelInfo.getPublicationInfos()[i].getUrl().contains("PubMed")) {
                    BioModelNode piUrlNode = new BioModelNode(bioModelInfo.getPublicationInfos()[i], false);
                    piUrlNode.setRenderHint("type", "PublicationInfoUrl");
                    piTitleNode.add(piUrlNode);
                }
            }
        }
        versionNode.add(publicationsInfoNode);
    }
    if (bioModelInfo.getVersion().getAnnot() != null && bioModelInfo.getVersion().getAnnot().trim().length() > 0) {
        BioModelNode provenanceNode = new BioModelNode("Model Provenance", true);
        provenanceNode.setRenderHint("type", "Provenance");
        versionNode.add(provenanceNode);
        String annotations = bioModelInfo.getVersion().getAnnot();
        StringTokenizer tokenizer = new StringTokenizer(annotations, "\n");
        while (tokenizer.hasMoreTokens()) {
            String annotation = tokenizer.nextToken();
            provenanceNode.add(new BioModelNode(new Annotation(annotation), false));
        }
    }
    BioModelChildSummary bioModelChildSummary = bioModelInfo.getBioModelChildSummary();
    if (bioModelChildSummary == null) {
        versionNode.add(new BioModelNode("SUMMARY INFORMATION NOT AVAILABLE", false));
    } else {
        String[] scNames = bioModelChildSummary.getSimulationContextNames();
        String[] scAnnot = bioModelChildSummary.getSimulationContextAnnotations();
        int[] geomDims = bioModelChildSummary.getGeometryDimensions();
        String[] geomNames = bioModelChildSummary.getGeometryNames();
        MathType[] appTypes = bioModelChildSummary.getAppTypes();
        String name = scNames.length > 1 ? "Applications Provenance" : "Application Provenance";
        applicationsNode = new BioModelNode(name, true);
        applicationsNode.setRenderHint("type", "Applications");
        for (int i = 0; i < scNames.length; i++) {
            BioModelNode scNode = new BioModelNode(scNames[i], true);
            scNode.setRenderHint("type", "SimulationContext");
            // need these 2 hints to decide on the icon
            scNode.setRenderHint("appType", appTypes[i].getDescription());
            scNode.setRenderHint("dimension", geomDims[i] + "");
            applicationsNode.add(scNode);
            // add application type
            BioModelNode appTypeNode = new BioModelNode(appTypes[i], false);
            appTypeNode.setRenderHint("type", "AppType");
            scNode.add(appTypeNode);
            if (scAnnot[i] != null && scAnnot[i].trim().length() > 0) {
                scNode.add(new BioModelNode(new Annotation(scAnnot[i]), false));
            }
            BioModelNode geometryNode = null;
            if (geomDims[i] > 0) {
                geometryNode = new BioModelNode((geomNames[i] + " (" + geomDims[i] + "D)"), false);
            } else {
                geometryNode = new BioModelNode(BioModelChildSummary.COMPARTMENTAL_GEO_STR, false);
            }
            geometryNode.setRenderHint("type", "Geometry");
            geometryNode.setRenderHint("dimension", new Integer(geomDims[i]));
            scNode.add(geometryNode);
            // 
            // add simulations to simulationContext
            // 
            String[] simNames = bioModelChildSummary.getSimulationNames(scNames[i]);
            String[] simAnnot = bioModelChildSummary.getSimulationAnnotations(scNames[i]);
            for (int j = 0; j < simNames.length; j++) {
                BioModelNode simNode = new BioModelNode(simNames[j], true);
                simNode.setRenderHint("type", "Simulation");
                scNode.add(simNode);
                if (simAnnot[j] != null && simAnnot[j].trim().length() > 0) {
                    simNode.add(new BioModelNode(new Annotation(simAnnot[j]), false));
                }
            }
        }
        versionNode.add(applicationsNode);
    }
    return versionNode;
}
Also used : BioModelChildSummary(org.vcell.util.document.BioModelChildSummary) MathType(org.vcell.util.document.BioModelChildSummary.MathType) BigDecimal(java.math.BigDecimal) StringTokenizer(java.util.StringTokenizer) Version(org.vcell.util.document.Version)

Aggregations

MathType (org.vcell.util.document.BioModelChildSummary.MathType)6 Simulation (cbit.vcell.solver.Simulation)4 SimulationContext (cbit.vcell.mapping.SimulationContext)2 BigDecimal (java.math.BigDecimal)2 StringTokenizer (java.util.StringTokenizer)2 MathModelChildSummary (org.vcell.util.document.MathModelChildSummary)2 Version (org.vcell.util.document.Version)2 BioModel (cbit.vcell.biomodel.BioModel)1 MiriamRefGroup (cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup)1 MiriamResource (cbit.vcell.biomodel.meta.MiriamManager.MiriamResource)1 Annotation (cbit.vcell.desktop.Annotation)1 BioModelNode (cbit.vcell.desktop.BioModelNode)1 Geometry (cbit.vcell.geometry.Geometry)1 MathDescription (cbit.vcell.math.MathDescription)1 MiriamTreeModel (cbit.vcell.xml.gui.MiriamTreeModel)1 Point (java.awt.Point)1 ActionEvent (java.awt.event.ActionEvent)1 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)1 BioModelChildSummary (org.vcell.util.document.BioModelChildSummary)1