Search in sources :

Example 46 with ReactionRule

use of cbit.vcell.model.ReactionRule in project vcell by virtualcell.

the class BioModelEditorModelPanel method duplicateButtonPressed.

private void duplicateButtonPressed() {
    computeCurrentSelectedTable();
    int row = currentSelectedTable.getSelectedRow();
    System.out.println("Duplicate Button Pressed for row " + row);
    if (currentSelectedTable == reactionsTable) {
        ModelProcess mp = reactionTableModel.getValueAt(row);
        if (!(mp instanceof ReactionRule)) {
            return;
        }
        ReactionRule oldRule = (ReactionRule) mp;
        if (bioModel.getModel().getNumStructures() == 1) {
            duplicateReactionRule(oldRule, oldRule.getStructure());
        } else if (bioModel.getModel().getNumStructures() > 1) {
            final JPopupMenu menu = new JPopupMenu("Choose compartment");
            for (int i = 0; i < bioModel.getModel().getNumStructures(); i++) {
                String ourType = oldRule.getStructure().getTypeName();
                Structure s = bioModel.getModel().getStructure(i);
                String theirType = s.getTypeName();
                if (!ourType.equals(theirType)) {
                    // offer to duplicate only within structures of the same type as the original,
                    continue;
                // otherwise units will be meaningless (surface vs volume)
                }
                String sName = s.getName();
                JMenuItem menuItem = new JMenuItem("In " + s.getTypeName() + " " + sName);
                menuItem.setIcon(new StructureToolShapeIcon(17));
                menu.add(menuItem);
                menuItem.addActionListener(new ActionListener() {

                    @Override
                    public void actionPerformed(ActionEvent e) {
                        newObject = duplicateReactionRule(oldRule, s);
                    // moves selection on the newly created object
                    // if (newObject != null) {
                    // for (int i = 0; i < currentSelectedTableModel.getRowCount(); i ++) {
                    // if (currentSelectedTableModel.getValueAt(i) == newObject) {
                    // currentSelectedTable.setRowSelectionInterval(i, i);
                    // break;
                    // }
                    // }
                    // }
                    }
                });
            }
            menu.show(duplicateButton, 0, duplicateButton.getHeight());
        }
    } else if (currentSelectedTable == speciesTable) {
        SpeciesContext sc = speciesTableModel.getValueAt(row);
        if (!sc.hasSpeciesPattern()) {
            return;
        }
        if (bioModel.getModel().getNumStructures() == 1) {
            duplicateSpecies(sc, sc.getStructure(), bioModel.getModel());
        } else if (bioModel.getModel().getNumStructures() > 1) {
            final JPopupMenu menu = new JPopupMenu("Choose compartment");
            for (int i = 0; i < bioModel.getModel().getNumStructures(); i++) {
                String ourType = sc.getStructure().getTypeName();
                Structure s = bioModel.getModel().getStructure(i);
                String theirType = s.getTypeName();
                if (!ourType.equals(theirType)) {
                    continue;
                }
                String sName = s.getName();
                JMenuItem menuItem = new JMenuItem("In " + s.getTypeName() + " " + sName);
                menuItem.setIcon(new StructureToolShapeIcon(17));
                menu.add(menuItem);
                menuItem.addActionListener(new ActionListener() {

                    @Override
                    public void actionPerformed(ActionEvent e) {
                        newObject = duplicateSpecies(sc, s, bioModel.getModel());
                    }
                });
            }
            menu.show(duplicateButton, 0, duplicateButton.getHeight());
        }
    } else if (currentSelectedTable == observablesTable) {
        RbmObservable o = observableTableModel.getValueAt(row);
        if (o.getSpeciesPatternList().isEmpty()) {
            return;
        }
        if (bioModel.getModel().getNumStructures() == 1) {
            duplicateObservable(o, o.getStructure(), bioModel.getModel());
        } else if (bioModel.getModel().getNumStructures() > 1) {
            final JPopupMenu menu = new JPopupMenu("Choose compartment");
            for (int i = 0; i < bioModel.getModel().getNumStructures(); i++) {
                Structure s = bioModel.getModel().getStructure(i);
                String sName = s.getName();
                JMenuItem menuItem = new JMenuItem("In " + s.getTypeName() + " " + sName);
                menuItem.setIcon(new StructureToolShapeIcon(17));
                menu.add(menuItem);
                menuItem.addActionListener(new ActionListener() {

                    @Override
                    public void actionPerformed(ActionEvent e) {
                        newObject = duplicateObservable(o, s, bioModel.getModel());
                    }
                });
            }
            menu.show(duplicateButton, 0, duplicateButton.getHeight());
        }
    }
}
Also used : ReactionRule(cbit.vcell.model.ReactionRule) ActionEvent(java.awt.event.ActionEvent) RbmObservable(cbit.vcell.model.RbmObservable) ModelProcess(cbit.vcell.model.ModelProcess) SpeciesContext(cbit.vcell.model.SpeciesContext) JPopupMenu(javax.swing.JPopupMenu) StructureToolShapeIcon(cbit.vcell.graph.gui.StructureToolShapeIcon) ActionListener(java.awt.event.ActionListener) Structure(cbit.vcell.model.Structure) JMenuItem(javax.swing.JMenuItem)

Example 47 with ReactionRule

use of cbit.vcell.model.ReactionRule 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 AssignmentRule) {
            AssignmentRule ar = (AssignmentRule) object;
            SimulationContext sc = ar.getSimulationContext();
            followHyperlink(new ActiveView(sc, DocumentEditorTreeFolderClass.PROTOCOLS_NODE, ActiveViewID.assignmentRules), new Object[] { ar });
        } else if (object instanceof RateRule) {
            RateRule rr = (RateRule) object;
            SimulationContext sc = rr.getSimulationContext();
            followHyperlink(new ActiveView(sc, DocumentEditorTreeFolderClass.PROTOCOLS_NODE, ActiveViewID.rateRules), new Object[] { rr });
        } 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, nc.getMaxMoleculesPerSpecies() + "", NetworkTransformer.defaultMaxMoleculesPerSpecies + "");
                        followHyperlink(new ActiveView(sc, DocumentEditorTreeFolderClass.SPECIFICATIONS_NODE, ActiveViewID.network_setting), new Object[] { nce });
                    } else {
                        NetworkConstraintsEntity nce = new NetworkConstraintsEntity(NetworkConstraintsTableModel.sMaxIterationName, nc.getMaxIteration() + "", NetworkTransformer.defaultMaxIteration + "");
                        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) RateRule(cbit.vcell.mapping.RateRule) 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) AssignmentRule(cbit.vcell.mapping.AssignmentRule) 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)

Example 48 with ReactionRule

use of cbit.vcell.model.ReactionRule in project vcell by virtualcell.

the class BioModelEditorReactionTableModel method checkInputValue.

public String checkInputValue(String inputValue, int row, int column) {
    ModelProcess modelProcess = getValueAt(row);
    String errMsg = null;
    switch(column) {
        case COLUMN_NAME:
            if (modelProcess == null || !modelProcess.getName().equals(inputValue)) {
                if (getModel().getReactionStep(inputValue) != null) {
                    errMsg = "Reaction '" + inputValue + "' already exist!";
                    errMsg += VCellErrorMessages.PressEscToUndo;
                    errMsg = "<html>" + errMsg + "</html>";
                    return errMsg;
                }
                if (getModel().getRbmModelContainer().getReactionRule(inputValue) != null) {
                    errMsg = "ReactionRule '" + inputValue + "' already exist!";
                    errMsg += VCellErrorMessages.PressEscToUndo;
                    errMsg = "<html>" + errMsg + "</html>";
                    return errMsg;
                }
            }
            break;
        case COLUMN_EQUATION:
            try {
                if (modelProcess instanceof ReactionStep) {
                    ReactionStep reactionStep = (ReactionStep) modelProcess;
                    ModelProcessEquation.parseReaction(reactionStep, getModel(), inputValue);
                } else if (modelProcess instanceof ReactionRule) {
                    // ReactionRuleEmbedded reactionRule = (ReactionRuleEmbedded)modelProcess;
                    ReactionRule newlyParsedReactionRule_NotUsedForValidation = RbmUtils.parseReactionRule(inputValue, getModel().getStructures()[0], bioModel);
                } else {
                    // new row ... it's a rule if contains parentheses, plain reaction if it does not
                    if (inputValue.contains("(") && inputValue.contains(")")) {
                        ReactionRule newlyParsedReactionRule_NotUsedForValidation = RbmUtils.parseReactionRule(inputValue, getModel().getStructures()[0], bioModel);
                        if (newlyParsedReactionRule_NotUsedForValidation == null) {
                            throw new RuntimeException("Unable to generate a reaction rule for this input.");
                        }
                    } else {
                        ReactionStep reactionStep = (ReactionStep) modelProcess;
                        ModelProcessEquation.parseReaction(reactionStep, getModel(), inputValue);
                    }
                }
            } catch (org.vcell.model.bngl.ParseException ex) {
                errMsg = ex.getMessage();
                errMsg += VCellErrorMessages.PressEscToUndo;
                errMsg = "<html>" + errMsg + "</html>";
                return errMsg;
            } catch (Exception ex) {
                errMsg = ex.getMessage();
                errMsg += VCellErrorMessages.PressEscToUndo;
                errMsg = "<html>" + errMsg + "</html>";
                return errMsg;
            }
            break;
        case COLUMN_STRUCTURE:
            if (getModel().getStructure(inputValue) == null) {
                errMsg = "Structure '" + inputValue + "' does not exist!";
                errMsg += VCellErrorMessages.PressEscToUndo;
                errMsg = "<html>" + errMsg + "</html>";
                return errMsg;
            }
            break;
    }
    return null;
}
Also used : ReactionRule(cbit.vcell.model.ReactionRule) ReactionStep(cbit.vcell.model.ReactionStep) ModelProcess(cbit.vcell.model.ModelProcess)

Example 49 with ReactionRule

use of cbit.vcell.model.ReactionRule in project vcell by virtualcell.

the class ClientRequestManager method createBioModelFromApplication.

public void createBioModelFromApplication(final BioModelWindowManager requester, final String name, final SimulationContext simContext) {
    if (simContext == null) {
        PopupGenerator.showErrorDialog(requester, "Selected Application is null, cannot generate corresponding bio model");
        return;
    }
    if (simContext.isRuleBased()) {
        createRuleBasedBioModelFromApplication(requester, name, simContext);
        return;
    }
    AsynchClientTask task1 = new AsynchClientTask("Creating BioModel from BioModel Application", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

        @Override
        public void run(Hashtable<String, Object> hashTable) throws Exception {
            MathMappingCallback dummyCallback = new MathMappingCallback() {

                public void setProgressFraction(float percentDone) {
                }

                public void setMessage(String message) {
                }

                public boolean isInterrupted() {
                    return false;
                }
            };
            MathMapping transformedMathMapping = simContext.createNewMathMapping(dummyCallback, NetworkGenerationRequirements.ComputeFullStandardTimeout);
            BioModel newBioModel = new BioModel(null);
            SimulationContext transformedSimContext = transformedMathMapping.getTransformation().transformedSimContext;
            Model newModel = transformedSimContext.getModel();
            newBioModel.setModel(newModel);
            RbmModelContainer rbmmc = newModel.getRbmModelContainer();
            for (RbmObservable o : rbmmc.getObservableList()) {
                rbmmc.removeObservable(o);
            }
            for (ReactionRule r : rbmmc.getReactionRuleList()) {
                rbmmc.removeReactionRule(r);
            }
            for (ReactionStep rs : newModel.getReactionSteps()) {
                String oldName = rs.getName();
                if (oldName.startsWith("_reverse_")) {
                    String newName = newModel.getReactionName("rev", oldName.substring("_reverse_".length()));
                    rs.setName(newName);
                }
            }
            hashTable.put("newBioModel", newBioModel);
        }
    };
    AsynchClientTask task2 = new AsynchClientTask("Creating BioModel from BioModel Application", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

        @Override
        public void run(Hashtable<String, Object> hashTable) throws Exception {
            BioModel newBioModel = (BioModel) hashTable.get("newBioModel");
            DocumentWindowManager windowManager = createDocumentWindowManager(newBioModel);
            // if(simContext.getBioModel().getVersion() != null){
            // ((BioModelWindowManager)windowManager). setCopyFromBioModelAppVersionableTypeVersion(
            // new VersionableTypeVersion(VersionableType.BioModelMetaData, simContext.getBioModel().getVersion()));
            // }
            getMdiManager().createNewDocumentWindow(windowManager);
        }
    };
    ClientTaskDispatcher.dispatch(requester.getComponent(), new Hashtable<String, Object>(), new AsynchClientTask[] { task1, task2 }, false);
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) MathMappingCallback(cbit.vcell.mapping.SimulationContext.MathMappingCallback) ReactionRule(cbit.vcell.model.ReactionRule) Hashtable(java.util.Hashtable) RbmObservable(cbit.vcell.model.RbmObservable) SimulationContext(cbit.vcell.mapping.SimulationContext) RbmModelContainer(cbit.vcell.model.Model.RbmModelContainer) BioModel(cbit.vcell.biomodel.BioModel) ReactionStep(cbit.vcell.model.ReactionStep) MathMapping(cbit.vcell.mapping.MathMapping) ASTModel(org.vcell.model.bngl.ASTModel) MathModel(cbit.vcell.mathmodel.MathModel) Model(cbit.vcell.model.Model) ListSelectionModel(javax.swing.ListSelectionModel) BioModel(cbit.vcell.biomodel.BioModel) CSGObject(cbit.vcell.geometry.CSGObject)

Example 50 with ReactionRule

use of cbit.vcell.model.ReactionRule in project vcell by virtualcell.

the class ReactionRuleEditorPropertiesPanel method setReactionRule.

public void setReactionRule(ReactionRule newValue) {
    if (reactionRule == newValue) {
        return;
    }
    ReactionRule oldValue = reactionRule;
    if (oldValue != null) {
        oldValue.removePropertyChangeListener(eventHandler);
    }
    // commit the changes before switch to another reaction step
    // changeName();
    reactionRule = newValue;
    if (newValue != null) {
        newValue.addPropertyChangeListener(eventHandler);
    }
    shapePanel.setReactionRule(reactionRule);
    productTreeModel.setReactionRule(reactionRule);
    reactantTreeModel.setReactionRule(reactionRule);
    updateInterface();
}
Also used : ReactionRule(cbit.vcell.model.ReactionRule)

Aggregations

ReactionRule (cbit.vcell.model.ReactionRule)78 ArrayList (java.util.ArrayList)29 ReactionStep (cbit.vcell.model.ReactionStep)26 SpeciesContext (cbit.vcell.model.SpeciesContext)26 Structure (cbit.vcell.model.Structure)26 MolecularType (org.vcell.model.rbm.MolecularType)20 RbmObservable (cbit.vcell.model.RbmObservable)19 ProductPattern (cbit.vcell.model.ProductPattern)17 ReactantPattern (cbit.vcell.model.ReactantPattern)17 Model (cbit.vcell.model.Model)16 SpeciesPattern (org.vcell.model.rbm.SpeciesPattern)16 PropertyVetoException (java.beans.PropertyVetoException)15 SimulationContext (cbit.vcell.mapping.SimulationContext)14 LocalParameter (cbit.vcell.mapping.ParameterContext.LocalParameter)11 Expression (cbit.vcell.parser.Expression)10 BioModel (cbit.vcell.biomodel.BioModel)9 List (java.util.List)9 ModelParameter (cbit.vcell.model.Model.ModelParameter)8 Parameter (cbit.vcell.model.Parameter)8 Product (cbit.vcell.model.Product)8