Search in sources :

Example 1 with IssueCategory

use of org.vcell.util.Issue.IssueCategory in project vcell by virtualcell.

the class IssueTableModel method getSourceObjectPathDescription.

private String getSourceObjectPathDescription(VCDocument vcDocument, Issue issue) {
    VCAssert.assertValid(issue);
    Object source = issue.getSource();
    {
        IssueOrigin io = BeanUtils.downcast(IssueOrigin.class, source);
        if (io != null) {
            return io.getDescription();
        }
    }
    if (vcDocument instanceof BioModel) {
        BioModel bioModel = (BioModel) vcDocument;
        String description = "";
        if (source instanceof SymbolTableEntry) {
            if (source instanceof SpeciesContext) {
                description = "Model / Species";
            } else if (source instanceof RbmObservable) {
                description = "Model / Observables";
            } else {
                description = ((SymbolTableEntry) source).getNameScope().getPathDescription();
            }
        } else if (source instanceof MolecularType) {
            description = "Model / Molecules";
        } else if (source instanceof ReactionStep) {
            ReactionStep reactionStep = (ReactionStep) source;
            description = ((ReactionNameScope) reactionStep.getNameScope()).getPathDescription();
        } else if (source instanceof ReactionRule) {
            ReactionRule reactionRule = (ReactionRule) source;
            description = ((ReactionRuleNameScope) reactionRule.getNameScope()).getPathDescription();
        } else if (source instanceof SpeciesPattern) {
            // if (issue.getIssueContext().hasContextType(ContextType.SpeciesContext)){
            // description = "Model / Species";
            // }else if(issue.getIssueContext().hasContextType(ContextType.ReactionRule)) {
            // ReactionRule thing = (ReactionRule)issue.getIssueContext().getContextObject(ContextType.ReactionRule);
            // description = ((ReactionRuleNameScope)thing.getNameScope()).getPathDescription();
            // }else if(issue.getIssueContext().hasContextType(ContextType.RbmObservable)) {
            // description = "Model / Observables";
            // } else {
            System.err.println("Bad issue context for " + ((SpeciesPattern) source).toString());
            description = ((SpeciesPattern) source).toString();
        // }
        } else if (source instanceof Structure) {
            Structure structure = (Structure) source;
            description = "Model / " + structure.getTypeName() + "(" + structure.getName() + ")";
        } else if (source instanceof StructureMapping) {
            StructureMapping structureMapping = (StructureMapping) source;
            description = ((StructureMappingNameScope) structureMapping.getNameScope()).getPathDescription();
        } else if (source instanceof OutputFunctionIssueSource) {
            SimulationContext simulationContext = (SimulationContext) ((OutputFunctionIssueSource) source).getOutputFunctionContext().getSimulationOwner();
            description = "App(" + simulationContext.getName() + ") / " + "Simulations" + " / " + "Output Functions";
        } else if (source instanceof Simulation) {
            Simulation simulation = (Simulation) source;
            try {
                SimulationContext simulationContext = bioModel.getSimulationContext(simulation);
                description = "App(" + simulationContext.getName() + ") / Simulations";
            } catch (ObjectNotFoundException e) {
                e.printStackTrace();
                description = "App(" + "unknown" + ") / Simulations";
            }
        } else if (source instanceof UnmappedGeometryClass) {
            UnmappedGeometryClass unmappedGC = (UnmappedGeometryClass) source;
            description = "App(" + unmappedGC.getSimulationContext().getName() + ") / Subdomain(" + unmappedGC.getGeometryClass().getName() + ")";
        } else if (source instanceof GeometryContext) {
            description = "App(" + ((GeometryContext) source).getSimulationContext().getName() + ")";
        } else if (source instanceof ModelOptimizationSpec) {
            description = "App(" + ((ModelOptimizationSpec) source).getSimulationContext().getName() + ") / Parameter Estimation";
        } else if (source instanceof MicroscopeMeasurement) {
            description = "App(" + ((MicroscopeMeasurement) source).getSimulationContext().getName() + ") / Microscope Measurements";
        } else if (source instanceof SpatialObject) {
            description = "App(" + ((SpatialObject) source).getSimulationContext().getName() + ") / Spatial Objects";
        } else if (source instanceof SpatialProcess) {
            description = "App(" + ((SpatialProcess) source).getSimulationContext().getName() + ") / Spatial Processes";
        } else if (source instanceof SpeciesContextSpec) {
            SpeciesContextSpec scs = (SpeciesContextSpec) source;
            description = "App(" + scs.getSimulationContext().getName() + ") / Specifications / Species";
        } else if (source instanceof ReactionCombo) {
            ReactionCombo rc = (ReactionCombo) source;
            description = "App(" + rc.getReactionContext().getSimulationContext().getName() + ") / Specifications / Reactions";
        } else if (source instanceof RbmModelContainer) {
            IssueCategory ic = issue.getCategory();
            switch(ic) {
                case RbmMolecularTypesTableBad:
                    description = "Model / " + MolecularType.typeName + "s";
                    break;
                case RbmReactionRulesTableBad:
                    description = "Model / Reactions";
                    break;
                case RbmObservablesTableBad:
                    description = "Model / Observables";
                    break;
                case RbmNetworkConstraintsBad:
                    description = "Network Constrains";
                    break;
                default:
                    description = "Model";
                    break;
            }
        } else if (source instanceof SimulationContext) {
            SimulationContext sc = (SimulationContext) source;
            IssueCategory ic = issue.getCategory();
            switch(ic) {
                case RbmNetworkConstraintsBad:
                    description = "Specifications / Network";
                    break;
                default:
                    description = "Application";
                    break;
            }
        } else if (source instanceof Model) {
            description = "Model";
        } else if (source instanceof BioEvent) {
            return "Protocols / Events";
        } else if (source instanceof MathDescription) {
            return "Math Description";
        } else {
            System.err.println("unknown source type in IssueTableModel.getSourceObjectPathDescription(): " + source.getClass());
        }
        return description;
    } else if (vcDocument instanceof MathModel) {
        if (source instanceof Geometry) {
            return GuiConstants.DOCUMENT_EDITOR_FOLDERNAME_MATH_GEOMETRY;
        } else if (source instanceof OutputFunctionIssueSource) {
            return GuiConstants.DOCUMENT_EDITOR_FOLDERNAME_MATH_OUTPUTFUNCTIONS;
        } else if (source instanceof Simulation) {
            return "Simulation(" + ((Simulation) source).getName() + ")";
        } else {
            return GuiConstants.DOCUMENT_EDITOR_FOLDERNAME_MATH_VCML;
        }
    } else {
        System.err.println("unknown document type in IssueTableModel.getSourceObjectPathDescription()");
        return "";
    }
}
Also used : MathModel(cbit.vcell.mathmodel.MathModel) IssueCategory(org.vcell.util.Issue.IssueCategory) MathDescription(cbit.vcell.math.MathDescription) IssueOrigin(org.vcell.util.Issue.IssueOrigin) SpeciesContext(cbit.vcell.model.SpeciesContext) SpeciesContextSpec(cbit.vcell.mapping.SpeciesContextSpec) StructureMapping(cbit.vcell.mapping.StructureMapping) SpeciesPattern(org.vcell.model.rbm.SpeciesPattern) SpatialObject(cbit.vcell.mapping.spatial.SpatialObject) SymbolTableEntry(cbit.vcell.parser.SymbolTableEntry) OutputFunctionIssueSource(cbit.vcell.solver.OutputFunctionContext.OutputFunctionIssueSource) RbmModelContainer(cbit.vcell.model.Model.RbmModelContainer) ModelOptimizationSpec(cbit.vcell.modelopt.ModelOptimizationSpec) SpatialProcess(cbit.vcell.mapping.spatial.processes.SpatialProcess) UnmappedGeometryClass(cbit.vcell.mapping.GeometryContext.UnmappedGeometryClass) MicroscopeMeasurement(cbit.vcell.mapping.MicroscopeMeasurement) GeometryContext(cbit.vcell.mapping.GeometryContext) ReactionRuleNameScope(cbit.vcell.model.ReactionRule.ReactionRuleNameScope) Structure(cbit.vcell.model.Structure) ReactionCombo(cbit.vcell.mapping.ReactionSpec.ReactionCombo) ReactionRule(cbit.vcell.model.ReactionRule) RbmObservable(cbit.vcell.model.RbmObservable) SimulationContext(cbit.vcell.mapping.SimulationContext) MolecularType(org.vcell.model.rbm.MolecularType) Geometry(cbit.vcell.geometry.Geometry) Simulation(cbit.vcell.solver.Simulation) BioModel(cbit.vcell.biomodel.BioModel) ReactionStep(cbit.vcell.model.ReactionStep) ObjectNotFoundException(org.vcell.util.ObjectNotFoundException) MathModel(cbit.vcell.mathmodel.MathModel) Model(cbit.vcell.model.Model) BioModel(cbit.vcell.biomodel.BioModel) SpatialObject(cbit.vcell.mapping.spatial.SpatialObject) BioEvent(cbit.vcell.mapping.BioEvent)

Example 2 with IssueCategory

use of org.vcell.util.Issue.IssueCategory in project vcell by virtualcell.

the class IssuePanel method invokeHyperlink.

private void invokeHyperlink(Issue issue) {
    if (selectionManager != null) {
        // followHyperlink is no-op if selectionManger null, so no point in proceeding if it is
        IssueContext issueContext = issue.getIssueContext();
        IssueSource object = issue.getSource();
        if (object instanceof DecoratedIssueSource) {
            DecoratedIssueSource dis = (DecoratedIssueSource) object;
            dis.activateView(selectionManager);
        } else if (object instanceof Parameter) {
            followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.BIOMODEL_PARAMETERS_NODE, ActiveViewID.parameters_functions), new Object[] { object });
        } else if (object instanceof StructureMapping) {
            StructureMapping structureMapping = (StructureMapping) object;
            StructureMappingNameScope structureMappingNameScope = (StructureMappingNameScope) structureMapping.getNameScope();
            SimulationContext simulationContext = ((SimulationContextNameScope) (structureMappingNameScope.getParent())).getSimulationContext();
            followHyperlink(new ActiveView(simulationContext, DocumentEditorTreeFolderClass.GEOMETRY_NODE, ActiveViewID.structure_mapping), new Object[] { object });
        } else if (object instanceof SpatialObject) {
            SpatialObject spatialObject = (SpatialObject) object;
            SimulationContext simulationContext = spatialObject.getSimulationContext();
            followHyperlink(new ActiveView(simulationContext, DocumentEditorTreeFolderClass.GEOMETRY_NODE, ActiveViewID.spatial_objects), new Object[] { object });
        } else if (object instanceof SpatialProcess) {
            SpatialProcess spatialProcess = (SpatialProcess) object;
            SimulationContext simulationContext = spatialProcess.getSimulationContext();
            followHyperlink(new ActiveView(simulationContext, DocumentEditorTreeFolderClass.GEOMETRY_NODE, ActiveViewID.spatial_processes), new Object[] { object });
        } else if (object instanceof GeometryContext.UnmappedGeometryClass) {
            UnmappedGeometryClass unmappedGeometryClass = (UnmappedGeometryClass) object;
            SimulationContext simulationContext = unmappedGeometryClass.getSimulationContext();
            followHyperlink(new ActiveView(simulationContext, DocumentEditorTreeFolderClass.GEOMETRY_NODE, ActiveViewID.structure_mapping), new Object[] { object });
        } else if (object instanceof MicroscopeMeasurement) {
            SimulationContext simulationContext = ((MicroscopeMeasurement) object).getSimulationContext();
            followHyperlink(new ActiveView(simulationContext, DocumentEditorTreeFolderClass.PROTOCOLS_NODE, ActiveViewID.microscope_measuremments), new Object[] { object });
        } else if (object instanceof BioEvent) {
            BioEvent be = (BioEvent) object;
            SimulationContext simulationContext = be.getSimulationContext();
            followHyperlink(new ActiveView(simulationContext, DocumentEditorTreeFolderClass.PROTOCOLS_NODE, ActiveViewID.events), new Object[] { object });
        } else if (object instanceof OutputFunctionIssueSource) {
            SimulationOwner simulationOwner = ((OutputFunctionIssueSource) object).getOutputFunctionContext().getSimulationOwner();
            if (simulationOwner instanceof SimulationContext) {
                SimulationContext simulationContext = (SimulationContext) simulationOwner;
                followHyperlink(new ActiveView(simulationContext, DocumentEditorTreeFolderClass.SIMULATIONS_NODE, ActiveViewID.output_functions), new Object[] { ((OutputFunctionIssueSource) object).getAnnotatedFunction() });
            } else if (simulationOwner instanceof MathModel) {
                followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.MATH_OUTPUT_FUNCTIONS_NODE, ActiveViewID.math_output_functions), new Object[] { ((OutputFunctionIssueSource) object).getAnnotatedFunction() });
            }
        } else if (object instanceof Simulation) {
            Simulation simulation = (Simulation) object;
            SimulationOwner simulationOwner = simulation.getSimulationOwner();
            if (simulationOwner instanceof SimulationContext) {
                SimulationContext simulationContext = (SimulationContext) simulationOwner;
                followHyperlink(new ActiveView(simulationContext, DocumentEditorTreeFolderClass.SIMULATIONS_NODE, ActiveViewID.simulations), new Object[] { simulation });
            } else if (simulationOwner instanceof MathModel) {
                followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.MATH_SIMULATIONS_NODE, ActiveViewID.math_simulations), new Object[] { simulation });
            }
        } else if (object instanceof GeometryContext) {
            setActiveView(new ActiveView(((GeometryContext) object).getSimulationContext(), DocumentEditorTreeFolderClass.GEOMETRY_NODE, ActiveViewID.geometry_definition));
        } else if (object instanceof Structure) {
            followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.STRUCTURES_NODE, ActiveViewID.structures), new Object[] { object });
        } else if (object instanceof MolecularType) {
            followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.MOLECULAR_TYPES_NODE, ActiveViewID.structures), new Object[] { object });
        } else if (object instanceof ReactionStep) {
            followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.REACTIONS_NODE, ActiveViewID.reactions), new Object[] { object });
        } else if (object instanceof ReactionRule) {
            followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.REACTIONS_NODE, ActiveViewID.reactions), new Object[] { object });
        } else if (object instanceof SpeciesContextSpec) {
            SpeciesContextSpec scs = (SpeciesContextSpec) object;
            ActiveView av = new ActiveView(scs.getSimulationContext(), DocumentEditorTreeFolderClass.SPECIFICATIONS_NODE, ActiveViewID.species_settings);
            followHyperlink(av, new Object[] { object });
        } else if (object instanceof ReactionCombo) {
            ReactionCombo rc = (ReactionCombo) object;
            followHyperlink(new ActiveView(rc.getReactionContext().getSimulationContext(), DocumentEditorTreeFolderClass.SPECIFICATIONS_NODE, ActiveViewID.reaction_setting), new Object[] { ((ReactionCombo) object).getReactionSpec() });
        } else if (object instanceof SpeciesContext) {
            followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.SPECIES_NODE, ActiveViewID.species), new Object[] { object });
        } else if (object instanceof RbmObservable) {
            followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.OBSERVABLES_NODE, ActiveViewID.observables), new Object[] { object });
        } else if (object instanceof MathDescription) {
            // followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.MATH_SIMULATIONS_NODE, ActiveViewID.generated_math), new Object[] {object});
            followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.GEOMETRY_NODE, ActiveViewID.structure_mapping), new Object[] { object });
        } else if (object instanceof SpeciesPattern) {
            // if (issue.getIssueContext().hasContextType(ContextType.SpeciesContext)){
            // SpeciesContext thing = (SpeciesContext)issue.getIssueContext().getContextObject(ContextType.SpeciesContext);
            // followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.SPECIES_NODE, ActiveViewID.species), new Object[] {thing});
            // }else if(issue.getIssueContext().hasContextType(ContextType.ReactionRule)) {
            // ReactionRule thing = (ReactionRule)issue.getIssueContext().getContextObject(ContextType.ReactionRule);
            // followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.REACTIONS_NODE, ActiveViewID.reactions), new Object[] {thing});
            // }else if(issue.getIssueContext().hasContextType(ContextType.RbmObservable)) {
            // RbmObservable thing = (RbmObservable)issue.getIssueContext().getContextObject(ContextType.RbmObservable);
            // followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.OBSERVABLES_NODE, ActiveViewID.observables), new Object[] {thing});
            // } else {
            System.err.println("SpeciesPattern object missing a proper issue context.");
        // }
        } else if (object instanceof SimulationContext) {
            SimulationContext sc = (SimulationContext) object;
            IssueCategory ic = issue.getCategory();
            switch(ic) {
                case RbmNetworkConstraintsBad:
                    NetworkConstraints nc = sc.getNetworkConstraints();
                    if (issue.getMessage() == SimulationContext.IssueInsufficientMolecules) {
                        NetworkConstraintsEntity nce = new NetworkConstraintsEntity(NetworkConstraintsTableModel.sMaxMoleculesName, NetworkConstraintsTableModel.sValueType, nc.getMaxMoleculesPerSpecies() + "");
                        followHyperlink(new ActiveView(sc, DocumentEditorTreeFolderClass.SPECIFICATIONS_NODE, ActiveViewID.network_setting), new Object[] { nce });
                    } else {
                        NetworkConstraintsEntity nce = new NetworkConstraintsEntity(NetworkConstraintsTableModel.sMaxIterationName, NetworkConstraintsTableModel.sValueType, nc.getMaxIteration() + "");
                        followHyperlink(new ActiveView(sc, DocumentEditorTreeFolderClass.SPECIFICATIONS_NODE, ActiveViewID.network_setting), new Object[] { nce });
                    }
                    break;
                default:
                    followHyperlink(new ActiveView(sc, DocumentEditorTreeFolderClass.SPECIFICATIONS_NODE, ActiveViewID.network_setting), new Object[] { object });
                    break;
            }
        } else if (object instanceof Geometry) {
            if (issueContext.hasContextType(ContextType.SimContext)) {
                SimulationContext simContext = (SimulationContext) issueContext.getContextObject(ContextType.SimContext);
                followHyperlink(new ActiveView(simContext, DocumentEditorTreeFolderClass.GEOMETRY_NODE, ActiveViewID.geometry_definition), new Object[] { object });
            } else if (issueContext.hasContextType(ContextType.MathModel)) {
                followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.MATH_GEOMETRY_NODE, ActiveViewID.math_geometry), new Object[] { object });
            } else if (issueContext.hasContextType(ContextType.MathDescription)) {
                followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.GEOMETRY_NODE, ActiveViewID.geometry_definition), new Object[] { object });
            }
        } else {
            System.err.println("unknown object type in IssuePanel.invokeHyperlink(): " + object.getClass() + ", context type: " + issueContext.getContextType());
        }
    }
}
Also used : MathModel(cbit.vcell.mathmodel.MathModel) IssueCategory(org.vcell.util.Issue.IssueCategory) MathDescription(cbit.vcell.math.MathDescription) NetworkConstraintsEntity(org.vcell.model.rbm.common.NetworkConstraintsEntity) SpeciesContext(cbit.vcell.model.SpeciesContext) ActiveView(cbit.vcell.client.desktop.biomodel.SelectionManager.ActiveView) SpeciesContextSpec(cbit.vcell.mapping.SpeciesContextSpec) StructureMapping(cbit.vcell.mapping.StructureMapping) SpeciesPattern(org.vcell.model.rbm.SpeciesPattern) StructureMappingNameScope(cbit.vcell.mapping.StructureMapping.StructureMappingNameScope) SpatialObject(cbit.vcell.mapping.spatial.SpatialObject) UnmappedGeometryClass(cbit.vcell.mapping.GeometryContext.UnmappedGeometryClass) SimulationOwner(cbit.vcell.solver.SimulationOwner) DecoratedIssueSource(cbit.vcell.client.desktop.DecoratedIssueSource) IssueSource(org.vcell.util.Issue.IssueSource) OutputFunctionIssueSource(cbit.vcell.solver.OutputFunctionContext.OutputFunctionIssueSource) OutputFunctionIssueSource(cbit.vcell.solver.OutputFunctionContext.OutputFunctionIssueSource) SpatialProcess(cbit.vcell.mapping.spatial.processes.SpatialProcess) IssueContext(org.vcell.util.IssueContext) UnmappedGeometryClass(cbit.vcell.mapping.GeometryContext.UnmappedGeometryClass) MicroscopeMeasurement(cbit.vcell.mapping.MicroscopeMeasurement) GeometryContext(cbit.vcell.mapping.GeometryContext) Structure(cbit.vcell.model.Structure) ReactionCombo(cbit.vcell.mapping.ReactionSpec.ReactionCombo) ReactionRule(cbit.vcell.model.ReactionRule) DecoratedIssueSource(cbit.vcell.client.desktop.DecoratedIssueSource) RbmObservable(cbit.vcell.model.RbmObservable) SimulationContextNameScope(cbit.vcell.mapping.SimulationContext.SimulationContextNameScope) SimulationContext(cbit.vcell.mapping.SimulationContext) MolecularType(org.vcell.model.rbm.MolecularType) Geometry(cbit.vcell.geometry.Geometry) Simulation(cbit.vcell.solver.Simulation) ReactionStep(cbit.vcell.model.ReactionStep) Parameter(cbit.vcell.model.Parameter) SpatialObject(cbit.vcell.mapping.spatial.SpatialObject) BioEvent(cbit.vcell.mapping.BioEvent) NetworkConstraints(org.vcell.model.rbm.NetworkConstraints)

Aggregations

Geometry (cbit.vcell.geometry.Geometry)2 BioEvent (cbit.vcell.mapping.BioEvent)2 GeometryContext (cbit.vcell.mapping.GeometryContext)2 UnmappedGeometryClass (cbit.vcell.mapping.GeometryContext.UnmappedGeometryClass)2 MicroscopeMeasurement (cbit.vcell.mapping.MicroscopeMeasurement)2 ReactionCombo (cbit.vcell.mapping.ReactionSpec.ReactionCombo)2 SimulationContext (cbit.vcell.mapping.SimulationContext)2 SpeciesContextSpec (cbit.vcell.mapping.SpeciesContextSpec)2 StructureMapping (cbit.vcell.mapping.StructureMapping)2 SpatialObject (cbit.vcell.mapping.spatial.SpatialObject)2 SpatialProcess (cbit.vcell.mapping.spatial.processes.SpatialProcess)2 MathDescription (cbit.vcell.math.MathDescription)2 MathModel (cbit.vcell.mathmodel.MathModel)2 RbmObservable (cbit.vcell.model.RbmObservable)2 ReactionRule (cbit.vcell.model.ReactionRule)2 ReactionStep (cbit.vcell.model.ReactionStep)2 SpeciesContext (cbit.vcell.model.SpeciesContext)2 Structure (cbit.vcell.model.Structure)2 OutputFunctionIssueSource (cbit.vcell.solver.OutputFunctionContext.OutputFunctionIssueSource)2 Simulation (cbit.vcell.solver.Simulation)2