Search in sources :

Example 6 with ReactionRule

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

the class Xmlproducer method getXML.

// ============================================================================================================
public Element getXML(RbmModelContainer rbmModelContainer) {
    Element rbmModelContainerElement = new Element(XMLTags.RbmModelContainerTag);
    List<MolecularType> molecularTypeList = rbmModelContainer.getMolecularTypeList();
    if (!molecularTypeList.isEmpty()) {
        Element molecularTypeListElement = new Element(XMLTags.RbmMolecularTypeListTag);
        for (MolecularType mt : molecularTypeList) {
            molecularTypeListElement.addContent(getXML(mt));
        }
        rbmModelContainerElement.addContent(molecularTypeListElement);
    }
    List<RbmObservable> observablesList = rbmModelContainer.getObservableList();
    if (!observablesList.isEmpty()) {
        Element observablesListElement = new Element(XMLTags.RbmObservableListTag);
        for (RbmObservable oo : observablesList) {
            observablesListElement.addContent(getXML(oo));
        }
        rbmModelContainerElement.addContent(observablesListElement);
    }
    List<ReactionRule> reactionList = rbmModelContainer.getReactionRuleList();
    if (!reactionList.isEmpty()) {
        Element reactionListElement = new Element(XMLTags.RbmReactionRuleListTag);
        for (ReactionRule rr : reactionList) {
            reactionListElement.addContent(getXML(rr));
        }
        rbmModelContainerElement.addContent(reactionListElement);
    }
    return rbmModelContainerElement;
}
Also used : ParticleMolecularType(cbit.vcell.math.ParticleMolecularType) MolecularType(org.vcell.model.rbm.MolecularType) ReactionRule(cbit.vcell.model.ReactionRule) Element(org.jdom.Element) RbmObservable(cbit.vcell.model.RbmObservable)

Example 7 with ReactionRule

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

the class BioModelEditorReactionTableModel method propertyChange.

// public boolean isCellEditable(int row, int column) {
// if (bioModel == null) {
// return false;
// }
// ModelProcess process = getValueAt(row);
// if (column == COLUMN_NAME && process != null) {
// return true;
// }
// if (column == COLUMN_EQUATION) {
// //			if(bioModel.getModel().getNumStructures() != 1) {
// //				return false;
// //			}
// Object o = getValueAt(row);
// if(o instanceof ReactionRule) {
// ReactionRule rr = (ReactionRule)o;
// final List<ReactantPattern> rpList = rr.getReactantPatterns();
// for(ReactantPattern rp : rpList) {
// final List<MolecularTypePattern> mtpList = rp.getSpeciesPattern().getMolecularTypePatterns();
// for(MolecularTypePattern mtp : mtpList) {
// MolecularType mt = mtp.getMolecularType();
// if(mt.getComponentList().size() != 0) {
// return false;
// }
// }
// }
// final List<ProductPattern> ppList = rr.getProductPatterns();
// for(ProductPattern pp : ppList) {
// final List<MolecularTypePattern> mtpList = pp.getSpeciesPattern().getMolecularTypePatterns();
// for(MolecularTypePattern mtp : mtpList) {
// MolecularType mt = mtp.getMolecularType();
// if(mt.getComponentList().size() != 0) {
// return false;
// }
// }
// }
// }
// return true;
// }
// return false;
// }
@Override
public void propertyChange(java.beans.PropertyChangeEvent evt) {
    super.propertyChange(evt);
    if (evt.getSource() == bioModel.getModel()) {
        if (evt.getPropertyName().equals(Model.PROPERTY_NAME_STRUCTURES)) {
        // updateStructureComboBox();
        } else if (evt.getPropertyName().equals(Model.PROPERTY_NAME_REACTION_STEPS)) {
            ReactionStep[] oldValue = (ReactionStep[]) evt.getOldValue();
            if (oldValue != null) {
                for (ReactionStep rs : oldValue) {
                    rs.removePropertyChangeListener(this);
                }
            }
            ReactionStep[] newValue = (ReactionStep[]) evt.getNewValue();
            if (newValue != null) {
                for (ReactionStep rs : newValue) {
                    rs.addPropertyChangeListener(this);
                }
            }
            refreshData();
        }
    } else if (evt.getSource() instanceof ReactionStep) {
        ReactionStep reactionStep = (ReactionStep) evt.getSource();
        int changeRow = getRowIndex(reactionStep);
        if (changeRow >= 0) {
            fireTableRowsUpdated(changeRow, changeRow);
        }
    }
    // if (evt.getSource() == bioModel.getModel().getRbmModelContainer()) {
    if (evt.getSource() == bioModel.getModel()) {
        if (evt.getPropertyName().equals(RbmModelContainer.PROPERTY_NAME_REACTION_RULE_LIST)) {
            List<ReactionRule> oldValue = (List<ReactionRule>) evt.getOldValue();
            if (oldValue != null) {
                for (ReactionRule rs : oldValue) {
                    rs.removePropertyChangeListener(this);
                }
            }
            List<ReactionRule> newValue = (List<ReactionRule>) evt.getNewValue();
            if (newValue != null) {
                for (ReactionRule rs : newValue) {
                    rs.addPropertyChangeListener(this);
                }
            }
            refreshData();
        }
    } else if (evt.getSource() instanceof ReactionRule) {
        ReactionRule reactionRule = (ReactionRule) evt.getSource();
        int changeRow = getRowIndex(reactionRule);
        if (changeRow >= 0) {
            fireTableRowsUpdated(changeRow, changeRow);
        }
    }
}
Also used : ReactionRule(cbit.vcell.model.ReactionRule) ReactionStep(cbit.vcell.model.ReactionStep) ArrayList(java.util.ArrayList) List(java.util.List)

Example 8 with ReactionRule

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

the class BioModelEditorReactionTableModel method setValueAt.

public void setValueAt(Object value, int row, int column) {
    if (getModel() == null || value == null) {
        return;
    }
    try {
        ModelProcess modelProcess = getValueAt(row);
        if (modelProcess != null) {
            switch(column) {
                case COLUMN_NAME:
                    {
                        String inputValue = ((String) value);
                        inputValue = inputValue.trim();
                        modelProcess.setName(inputValue);
                        break;
                    }
                case COLUMN_EQUATION:
                    {
                        String inputValue = (String) value;
                        inputValue = inputValue.trim();
                        if (modelProcess instanceof ReactionStep) {
                            ReactionStep reactionStep = (ReactionStep) modelProcess;
                            ReactionParticipant[] rpArray = ModelProcessEquation.parseReaction(reactionStep, getModel(), inputValue);
                            for (ReactionParticipant rp : rpArray) {
                                SpeciesContext speciesContext = rp.getSpeciesContext();
                                if (bioModel.getModel().getSpeciesContext(speciesContext.getName()) == null) {
                                    bioModel.getModel().addSpecies(speciesContext.getSpecies());
                                    bioModel.getModel().addSpeciesContext(speciesContext);
                                }
                            }
                            reactionStep.setReactionParticipants(rpArray);
                        } else if (modelProcess instanceof ReactionRule) {
                            ReactionRule oldReactionRule = (ReactionRule) modelProcess;
                            // when editing an existing reaction rule
                            ReactionRule newReactionRule = (ReactionRule) RbmUtils.parseReactionRule(inputValue, oldReactionRule.getStructure(), bioModel);
                            if (newReactionRule != null) {
                                oldReactionRule.setProductPatterns(newReactionRule.getProductPatterns(), false, false);
                                oldReactionRule.setReactantPatterns(newReactionRule.getReactantPatterns(), false, false);
                            // String name = oldReactionRule.getName();
                            // RbmKineticLaw kl = oldReactionRule.getKineticLaw();
                            // Structure st = oldReactionRule.getStructure();
                            // getModel().getRbmModelContainer().removeReactionRule(oldReactionRule);
                            // newReactionRule.setName(name);
                            // newReactionRule.setKineticLaw(kl);
                            // newReactionRule.setStructure(st);
                            // getModel().getRbmModelContainer().addReactionRule(newReactionRule);
                            }
                        }
                        break;
                    }
                case COLUMN_STRUCTURE:
                    {
                        Structure s = (Structure) value;
                        modelProcess.setStructure(s);
                        break;
                    }
            }
        } else {
            switch(column) {
                case COLUMN_EQUATION:
                    {
                        if (getModel().getNumStructures() == 1) {
                            String inputValue = ((String) value);
                            inputValue = inputValue.trim();
                            if (inputValue.contains("(") && inputValue.contains(")")) {
                                ReactionRule reactionRule = (ReactionRule) RbmUtils.parseReactionRule(inputValue, getModel().getStructure(0), bioModel);
                                getModel().getRbmModelContainer().addReactionRule(reactionRule);
                            } else {
                                if (BioModelEditorRightSideTableModel.ADD_NEW_HERE_REACTION_TEXT.equals(inputValue)) {
                                    return;
                                }
                                ReactionStep reactionStep = getModel().createSimpleReaction(getModel().getStructure(0));
                                ReactionParticipant[] rpArray = ModelProcessEquation.parseReaction(reactionStep, getModel(), inputValue);
                                for (ReactionParticipant rp : rpArray) {
                                    SpeciesContext speciesContext = rp.getSpeciesContext();
                                    if (bioModel.getModel().getSpeciesContext(speciesContext.getName()) == null) {
                                        bioModel.getModel().addSpecies(speciesContext.getSpecies());
                                        bioModel.getModel().addSpeciesContext(speciesContext);
                                    }
                                }
                                reactionStep.setReactionParticipants(rpArray);
                            }
                        }
                        break;
                    }
            }
        }
    } catch (Exception e) {
        e.printStackTrace(System.out);
        DialogUtils.showErrorDialog(ownerTable, e.getMessage(), e);
    }
}
Also used : ReactionRule(cbit.vcell.model.ReactionRule) ReactionStep(cbit.vcell.model.ReactionStep) ModelProcess(cbit.vcell.model.ModelProcess) SpeciesContext(cbit.vcell.model.SpeciesContext) Structure(cbit.vcell.model.Structure) ReactionParticipant(cbit.vcell.model.ReactionParticipant)

Example 9 with ReactionRule

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

the class BioModelParametersTableModel method computeData.

/**
 * Insert the method's description here.
 * Creation date: (9/23/2003 1:24:52 PM)
 * @return cbit.vcell.model.EditableSymbolTableEntry
 * @param row int
 */
protected List<EditableSymbolTableEntry> computeData() {
    ArrayList<EditableSymbolTableEntry> allEditableSymbolTableEntryList = new ArrayList<EditableSymbolTableEntry>();
    if (bioModel == null) {
        return null;
    }
    if (bGlobal) {
        Map<String, SymbolTableEntry> entryMap = new HashMap<String, SymbolTableEntry>();
        bioModel.getModel().getEntries(entryMap);
        for (SymbolTableEntry ste : entryMap.values()) {
            if (ste instanceof EditableSymbolTableEntry && !(ste instanceof ReservedSymbol)) {
                allEditableSymbolTableEntryList.add((EditableSymbolTableEntry) ste);
            }
        }
    }
    if (bReactions) {
        for (ReactionStep reactionStep : bioModel.getModel().getReactionSteps()) {
            allEditableSymbolTableEntryList.addAll(Arrays.asList(reactionStep.getKinetics().getUnresolvedParameters()));
            allEditableSymbolTableEntryList.addAll(Arrays.asList(reactionStep.getKinetics().getKineticsParameters()));
        }
        if (!bioModel.getModel().getRbmModelContainer().isEmpty()) {
            for (ReactionRule reactionRule : bioModel.getModel().getRbmModelContainer().getReactionRuleList()) {
                allEditableSymbolTableEntryList.addAll(Arrays.asList(reactionRule.getKineticLaw().getLocalParameters()));
                allEditableSymbolTableEntryList.addAll(Arrays.asList(reactionRule.getKineticLaw().getProxyParameters()));
                allEditableSymbolTableEntryList.addAll(Arrays.asList(reactionRule.getKineticLaw().getUnresolvedParameters()));
            }
        }
    }
    if (bApplications) {
        for (SimulationContext simContext : bioModel.getSimulationContexts()) {
            if (applicationSelection != null && (applicationSelection.isAll() || applicationSelection.getSimulationContext() == simContext)) {
                allEditableSymbolTableEntryList.addAll(getApplicationEditableSymbolTableEntryList(simContext));
            }
        }
    }
    boolean bSearchInactive = searchText == null || searchText.length() == 0;
    String lowerCaseSearchText = bSearchInactive ? null : searchText.toLowerCase();
    ArrayList<EditableSymbolTableEntry> parameterList = new ArrayList<EditableSymbolTableEntry>();
    for (EditableSymbolTableEntry parameter : allEditableSymbolTableEntryList) {
        boolean bNumeric = parameter.getExpression() == null || parameter.getExpression().isNumeric();
        if (bConstants && bNumeric || bFunctions && !bNumeric) {
            if (bSearchInactive || parameter.getNameScope().getPathDescription().toLowerCase().contains(lowerCaseSearchText) || parameter.getName().toLowerCase().contains(lowerCaseSearchText) || parameter.getExpression() != null && parameter.getExpression().infix().toLowerCase().contains(lowerCaseSearchText) || parameter.getDescription().toLowerCase().contains(lowerCaseSearchText)) {
                parameterList.add(parameter);
            }
        }
    }
    return parameterList;
}
Also used : SymbolTableEntry(cbit.vcell.parser.SymbolTableEntry) EditableSymbolTableEntry(cbit.vcell.model.EditableSymbolTableEntry) ReactionRule(cbit.vcell.model.ReactionRule) HashMap(java.util.HashMap) ReservedSymbol(cbit.vcell.model.Model.ReservedSymbol) ReactionStep(cbit.vcell.model.ReactionStep) ArrayList(java.util.ArrayList) SimulationContext(cbit.vcell.mapping.SimulationContext) EditableSymbolTableEntry(cbit.vcell.model.EditableSymbolTableEntry)

Example 10 with ReactionRule

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

the class BioModelParametersTableModel method propertyChange.

@Override
public void propertyChange(java.beans.PropertyChangeEvent evt) {
    super.propertyChange(evt);
    if (evt.getSource() instanceof EditableSymbolTableEntry) {
        int changeRow = getRowIndex((EditableSymbolTableEntry) evt.getSource());
        if (changeRow >= 0) {
            fireTableRowsUpdated(changeRow, changeRow);
        }
    } else {
        String propertyName = evt.getPropertyName();
        if (evt.getSource() == bioModel.getModel()) {
            if (propertyName.equals(Model.PROPERTY_NAME_MODEL_PARAMETERS)) {
                ModelParameter[] oldValue = (ModelParameter[]) evt.getOldValue();
                if (oldValue != null) {
                    for (EditableSymbolTableEntry parameter : oldValue) {
                        parameter.removePropertyChangeListener(this);
                    }
                }
                ModelParameter[] newValue = (ModelParameter[]) evt.getNewValue();
                if (newValue != null) {
                    for (EditableSymbolTableEntry parameter : newValue) {
                        parameter.addPropertyChangeListener(this);
                    }
                }
                refreshData();
            } else if (propertyName.equals(Model.PROPERTY_NAME_SPECIES_CONTEXTS)) {
                SpeciesContext[] oldValue = (SpeciesContext[]) evt.getOldValue();
                if (oldValue != null) {
                    for (SpeciesContext sc : oldValue) {
                        sc.removePropertyChangeListener(this);
                    }
                }
                SpeciesContext[] newValue = (SpeciesContext[]) evt.getNewValue();
                if (newValue != null) {
                    for (SpeciesContext sc : newValue) {
                        sc.addPropertyChangeListener(this);
                    }
                }
                refreshData();
            } else if (propertyName.equals(Model.PROPERTY_NAME_REACTION_STEPS)) {
                ReactionStep[] oldValue = (ReactionStep[]) evt.getOldValue();
                if (oldValue != null) {
                    for (ReactionStep reactionStep : oldValue) {
                        reactionStep.removePropertyChangeListener(this);
                        reactionStep.getKinetics().removePropertyChangeListener(this);
                        for (KineticsParameter kineticsEditableSymbolTableEntry : reactionStep.getKinetics().getKineticsParameters()) {
                            kineticsEditableSymbolTableEntry.removePropertyChangeListener(this);
                        }
                        for (ProxyParameter proxyEditableSymbolTableEntry : reactionStep.getKinetics().getProxyParameters()) {
                            proxyEditableSymbolTableEntry.removePropertyChangeListener(this);
                        }
                        for (UnresolvedParameter unresolvedEditableSymbolTableEntry : reactionStep.getKinetics().getUnresolvedParameters()) {
                            unresolvedEditableSymbolTableEntry.removePropertyChangeListener(this);
                        }
                    }
                }
                ReactionStep[] newValue = (ReactionStep[]) evt.getNewValue();
                if (newValue != null) {
                    for (ReactionStep reactionStep : newValue) {
                        reactionStep.addPropertyChangeListener(this);
                        reactionStep.getKinetics().addPropertyChangeListener(this);
                        for (KineticsParameter kineticsEditableSymbolTableEntry : reactionStep.getKinetics().getKineticsParameters()) {
                            kineticsEditableSymbolTableEntry.addPropertyChangeListener(this);
                        }
                        for (ProxyParameter proxyEditableSymbolTableEntry : reactionStep.getKinetics().getProxyParameters()) {
                            proxyEditableSymbolTableEntry.addPropertyChangeListener(this);
                        }
                        for (UnresolvedParameter unresolvedEditableSymbolTableEntry : reactionStep.getKinetics().getUnresolvedParameters()) {
                            unresolvedEditableSymbolTableEntry.addPropertyChangeListener(this);
                        }
                    }
                }
                refreshData();
            } else if (evt.getPropertyName().equals(RbmModelContainer.PROPERTY_NAME_REACTION_RULE_LIST)) {
                List<ReactionRule> oldValue = (List<ReactionRule>) evt.getOldValue();
                if (oldValue != null) {
                    for (ReactionRule rs : oldValue) {
                        rs.removePropertyChangeListener(this);
                    }
                }
                List<ReactionRule> newValue = (List<ReactionRule>) evt.getNewValue();
                if (newValue != null) {
                    for (ReactionRule rs : newValue) {
                        rs.addPropertyChangeListener(this);
                    }
                }
                refreshData();
            }
        } else if (evt.getSource() == bioModel) {
            if (propertyName.equals(BioModel.PROPERTY_NAME_SIMULATION_CONTEXTS)) {
                SimulationContext[] oldValue = (SimulationContext[]) evt.getOldValue();
                for (SimulationContext simulationContext : oldValue) {
                    simulationContext.removePropertyChangeListener(this);
                    simulationContext.getGeometryContext().removePropertyChangeListener(this);
                    for (StructureMapping mapping : simulationContext.getGeometryContext().getStructureMappings()) {
                        mapping.removePropertyChangeListener(this);
                        for (EditableSymbolTableEntry parameter : mapping.getParameters()) {
                            parameter.removePropertyChangeListener(this);
                        }
                    }
                    simulationContext.getReactionContext().removePropertyChangeListener(this);
                    for (SpeciesContextSpec spec : simulationContext.getReactionContext().getSpeciesContextSpecs()) {
                        spec.removePropertyChangeListener(this);
                        for (EditableSymbolTableEntry parameter : spec.getParameters()) {
                            parameter.removePropertyChangeListener(this);
                        }
                    }
                    for (ElectricalStimulus elect : simulationContext.getElectricalStimuli()) {
                        elect.removePropertyChangeListener(this);
                        for (EditableSymbolTableEntry parameter : elect.getParameters()) {
                            parameter.removePropertyChangeListener(this);
                        }
                    }
                    for (SpatialObject spatialObject : simulationContext.getSpatialObjects()) {
                        spatialObject.removePropertyChangeListener(this);
                    }
                    for (SpatialProcess spatialProcess : simulationContext.getSpatialProcesses()) {
                        spatialProcess.removePropertyChangeListener(this);
                        for (LocalParameter p : spatialProcess.getParameters()) {
                            p.removePropertyChangeListener(this);
                        }
                    }
                    for (SimulationContextParameter p : simulationContext.getSimulationContextParameters()) {
                        p.removePropertyChangeListener(this);
                    }
                }
                SimulationContext[] newValue = (SimulationContext[]) evt.getNewValue();
                for (SimulationContext simulationContext : newValue) {
                    simulationContext.addPropertyChangeListener(this);
                    simulationContext.getGeometryContext().addPropertyChangeListener(this);
                    for (StructureMapping mapping : simulationContext.getGeometryContext().getStructureMappings()) {
                        mapping.addPropertyChangeListener(this);
                        for (EditableSymbolTableEntry parameter : mapping.getParameters()) {
                            parameter.addPropertyChangeListener(this);
                        }
                    }
                    simulationContext.getReactionContext().addPropertyChangeListener(this);
                    for (SpeciesContextSpec spec : simulationContext.getReactionContext().getSpeciesContextSpecs()) {
                        spec.addPropertyChangeListener(this);
                        for (EditableSymbolTableEntry parameter : spec.getParameters()) {
                            parameter.addPropertyChangeListener(this);
                        }
                    }
                    for (ElectricalStimulus elect : simulationContext.getElectricalStimuli()) {
                        elect.addPropertyChangeListener(this);
                        for (EditableSymbolTableEntry parameter : elect.getParameters()) {
                            parameter.addPropertyChangeListener(this);
                        }
                    }
                    for (SpatialObject spatialObject : simulationContext.getSpatialObjects()) {
                        spatialObject.addPropertyChangeListener(this);
                    }
                    for (SpatialProcess spatialProcess : simulationContext.getSpatialProcesses()) {
                        spatialProcess.addPropertyChangeListener(this);
                        for (LocalParameter p : spatialProcess.getParameters()) {
                            p.addPropertyChangeListener(this);
                        }
                    }
                    for (SimulationContextParameter p : simulationContext.getSimulationContextParameters()) {
                        p.addPropertyChangeListener(this);
                    }
                }
                refreshData();
            }
        } else if (evt.getSource() instanceof GeometryContext && evt.getPropertyName().equals(GeometryContext.PROPERTY_STRUCTURE_MAPPINGS)) {
            StructureMapping[] oldValue = (StructureMapping[]) evt.getOldValue();
            if (oldValue != null) {
                for (StructureMapping mapping : oldValue) {
                    mapping.removePropertyChangeListener(this);
                    for (EditableSymbolTableEntry parameter : mapping.getParameters()) {
                        parameter.removePropertyChangeListener(this);
                    }
                }
            }
            StructureMapping[] newValue = (StructureMapping[]) evt.getNewValue();
            if (newValue != null) {
                for (StructureMapping mapping : newValue) {
                    mapping.addPropertyChangeListener(this);
                    for (EditableSymbolTableEntry parameter : mapping.getParameters()) {
                        parameter.addPropertyChangeListener(this);
                    }
                }
            }
            refreshData();
        } else if (evt.getSource() instanceof ReactionStep && (evt.getPropertyName().equals(ReactionStep.PROPERTY_NAME_KINETICS))) {
            Kinetics oldValue = (Kinetics) evt.getOldValue();
            if (oldValue != null) {
                oldValue.removePropertyChangeListener(this);
                for (KineticsParameter kineticsEditableSymbolTableEntry : oldValue.getKineticsParameters()) {
                    kineticsEditableSymbolTableEntry.removePropertyChangeListener(this);
                }
                for (ProxyParameter proxyEditableSymbolTableEntry : oldValue.getProxyParameters()) {
                    proxyEditableSymbolTableEntry.removePropertyChangeListener(this);
                }
                for (UnresolvedParameter unresolvedEditableSymbolTableEntry : oldValue.getUnresolvedParameters()) {
                    unresolvedEditableSymbolTableEntry.removePropertyChangeListener(this);
                }
            }
            Kinetics newValue = (Kinetics) evt.getNewValue();
            if (newValue != null) {
                newValue.addPropertyChangeListener(this);
                for (KineticsParameter kineticsEditableSymbolTableEntry : newValue.getKineticsParameters()) {
                    kineticsEditableSymbolTableEntry.addPropertyChangeListener(this);
                }
                for (ProxyParameter proxyEditableSymbolTableEntry : newValue.getProxyParameters()) {
                    proxyEditableSymbolTableEntry.addPropertyChangeListener(this);
                }
                for (UnresolvedParameter unresolvedEditableSymbolTableEntry : newValue.getUnresolvedParameters()) {
                    unresolvedEditableSymbolTableEntry.addPropertyChangeListener(this);
                }
            }
            refreshData();
        } else if (evt.getSource() instanceof SimulationContext && evt.getPropertyName().equals(SimulationContext.PROPERTY_NAME_SPATIALPROCESSES)) {
            SpatialProcess[] oldValue = (SpatialProcess[]) evt.getOldValue();
            if (oldValue != null) {
                for (SpatialProcess process : oldValue) {
                    process.removePropertyChangeListener(this);
                    for (EditableSymbolTableEntry parameter : process.getParameters()) {
                        parameter.removePropertyChangeListener(this);
                    }
                }
            }
            SpatialProcess[] newValue = (SpatialProcess[]) evt.getNewValue();
            if (newValue != null) {
                for (SpatialProcess process : newValue) {
                    process.addPropertyChangeListener(this);
                    for (EditableSymbolTableEntry parameter : process.getParameters()) {
                        parameter.addPropertyChangeListener(this);
                    }
                }
            }
            refreshData();
        } else if (evt.getSource() instanceof SimulationContext && evt.getPropertyName().equals(SimulationContext.PROPERTY_NAME_SPATIALOBJECTS)) {
            SpatialObject[] oldValue = (SpatialObject[]) evt.getOldValue();
            if (oldValue != null) {
                for (SpatialObject spatialObject : oldValue) {
                    spatialObject.removePropertyChangeListener(this);
                }
            }
            SpatialObject[] newValue = (SpatialObject[]) evt.getNewValue();
            if (newValue != null) {
                for (SpatialObject spatialObject : newValue) {
                    spatialObject.addPropertyChangeListener(this);
                }
            }
            refreshData();
        } else if (evt.getSource() instanceof SpatialObject && evt.getPropertyName().equals(SpatialObject.PROPERTY_NAME_QUANTITYCATEGORIESENABLED)) {
            refreshData();
        } else if (evt.getSource() instanceof SimulationContext && evt.getPropertyName().equals(SimulationContext.PROPERTY_NAME_SIMULATIONCONTEXTPARAMETERS)) {
            SimulationContextParameter[] oldValue = (SimulationContextParameter[]) evt.getOldValue();
            if (oldValue != null) {
                for (SimulationContextParameter param : oldValue) {
                    param.removePropertyChangeListener(this);
                }
            }
            SimulationContextParameter[] newValue = (SimulationContextParameter[]) evt.getNewValue();
            if (newValue != null) {
                for (SimulationContextParameter param : newValue) {
                    param.addPropertyChangeListener(this);
                }
            }
            refreshData();
        } else if (evt.getSource() instanceof Kinetics && (evt.getPropertyName().equals(Kinetics.PROPERTY_NAME_KINETICS_PARAMETERS))) {
            EditableSymbolTableEntry[] oldValue = (EditableSymbolTableEntry[]) evt.getOldValue();
            if (oldValue != null) {
                for (int i = 0; i < oldValue.length; i++) {
                    oldValue[i].removePropertyChangeListener(this);
                }
            }
            EditableSymbolTableEntry[] newValue = (EditableSymbolTableEntry[]) evt.getNewValue();
            if (newValue != null) {
                for (int i = 0; i < newValue.length; i++) {
                    newValue[i].addPropertyChangeListener(this);
                }
            }
            refreshData();
        // } else if(evt.getSource() instanceof ReactionRuleEmbedded) {
        // ReactionRuleEmbedded reactionRule = (ReactionRuleEmbedded) evt.getSource();
        // int changeRow = getRowIndex(reactionRule);
        // if (changeRow >= 0) {
        // fireTableRowsUpdated(changeRow, changeRow);
        // }
        }
    }
}
Also used : UnresolvedParameter(cbit.vcell.model.Kinetics.UnresolvedParameter) SpeciesContext(cbit.vcell.model.SpeciesContext) SpeciesContextSpec(cbit.vcell.mapping.SpeciesContextSpec) StructureMapping(cbit.vcell.mapping.StructureMapping) SpatialObject(cbit.vcell.mapping.spatial.SpatialObject) KineticsParameter(cbit.vcell.model.Kinetics.KineticsParameter) SpatialProcess(cbit.vcell.mapping.spatial.processes.SpatialProcess) ArrayList(java.util.ArrayList) List(java.util.List) GeometryContext(cbit.vcell.mapping.GeometryContext) ReactionRule(cbit.vcell.model.ReactionRule) SimulationContext(cbit.vcell.mapping.SimulationContext) SimulationContextParameter(cbit.vcell.mapping.SimulationContext.SimulationContextParameter) LocalParameter(cbit.vcell.mapping.ParameterContext.LocalParameter) ModelParameter(cbit.vcell.model.Model.ModelParameter) ElectricalStimulus(cbit.vcell.mapping.ElectricalStimulus) ProxyParameter(cbit.vcell.model.ProxyParameter) ReactionStep(cbit.vcell.model.ReactionStep) Kinetics(cbit.vcell.model.Kinetics) EditableSymbolTableEntry(cbit.vcell.model.EditableSymbolTableEntry)

Aggregations

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