Search in sources :

Example 11 with ReactionStep

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

the class BioModelEditor method setRightBottomPanelOnSelection.

@Override
protected void setRightBottomPanelOnSelection(Object[] selections) {
    if (selections == null) {
        return;
    }
    // TODO: here
    JComponent bottomComponent = rightBottomEmptyPanel;
    JComponent annotationComponent = rightBottomEmptyAnnotationsPanel;
    // properties panel
    int destComponentIndex = DocumentEditorTabID.object_properties.ordinal();
    // annotations panel
    int annComponentIndex = DocumentEditorTabID.annotations.ordinal();
    boolean bShowInDatabaseProperties = false;
    boolean bShowPathway = false;
    if (selections.length == 1) {
        annotationComponent = getAnnotationsPanel();
        Object singleSelection = selections[0];
        if (singleSelection instanceof ReactionStep) {
            bottomComponent = getReactionPropertiesPanel();
        } else if (singleSelection instanceof ReactionRule) {
            bottomComponent = getReactionRulePropertiesPanel();
        } else if (singleSelection instanceof SpeciesContext) {
            bottomComponent = getSpeciesPropertiesPanel();
        } else if (singleSelection instanceof MolecularType) {
            bottomComponent = getMolecularTypePropertiesPanel();
        } else if (singleSelection instanceof RbmObservable) {
            bottomComponent = getObservablePropertiesPanel();
        } else if (singleSelection instanceof Structure) {
            bottomComponent = getStructurePropertiesPanel();
            getStructurePropertiesPanel().setModel(bioModel.getModel());
        } else if (singleSelection instanceof Parameter) {
            bottomComponent = getParameterPropertiesPanel();
        } else if (singleSelection instanceof SimulationContext) {
            bottomComponent = getApplicationPropertiesPanel();
        } else if (singleSelection instanceof ParameterEstimationTask) {
            bottomComponent = parameterEstimationTaskPropertiesPanel;
        } else if (singleSelection instanceof Product || singleSelection instanceof Reactant) {
            bottomComponent = getReactionParticipantPropertiesPanel();
        } else if (singleSelection instanceof BioModelNode.PublicationInfoNode) {
            bShowInDatabaseProperties = true;
            bottomComponent = bioModelMetaDataPanel;
        } else if (singleSelection instanceof BioModelInfo) {
            bShowInDatabaseProperties = true;
            bottomComponent = bioModelMetaDataPanel;
        } else if (singleSelection instanceof MathModelInfo) {
            bShowInDatabaseProperties = true;
            bottomComponent = mathModelMetaDataPanel;
        } else if (singleSelection instanceof GeometryInfo) {
            bShowInDatabaseProperties = true;
            bottomComponent = geometryMetaDataPanel;
        } else if (singleSelection instanceof SpeciesContextSpec) {
            bottomComponent = getSpeciesContextSpecPanel();
        } else if (singleSelection instanceof ReactionSpec) {
            bottomComponent = getKineticsTypeTemplatePanel();
        } else if (singleSelection instanceof ReactionRuleSpec) {
            // 
            bottomComponent = getReactionRuleSpecPropertiesPanel();
        } else if (singleSelection instanceof BioModelsNetModelInfo) {
            bShowInDatabaseProperties = true;
            bottomComponent = getBioModelsNetPropertiesPanel();
        } else if (singleSelection instanceof Simulation) {
            bottomComponent = getSimulationSummaryPanel();
        } else if (singleSelection instanceof DataSymbol) {
            bottomComponent = getDataSymbolsSpecPanel();
        } else if (singleSelection instanceof BioEvent) {
            bottomComponent = getEventPanel();
        } else if (singleSelection instanceof SpatialObject) {
            bottomComponent = getSpatialObjectPropertyPanel();
        } else if (singleSelection instanceof SpatialProcess) {
            bottomComponent = getSpatialProcessPropertyPanel();
        } else if (singleSelection instanceof BioPaxObject) {
            bottomComponent = bioPaxObjectPropertiesPanel;
        } else if (singleSelection instanceof BioModel) {
            // only contains Notes, is displayed in the Object Properties Panel
            bottomComponent = bioModelEditorAnnotationPanel;
        } else if (singleSelection instanceof VCMetaData) {
            bottomComponent = bioModelEditorAnnotationPanel;
        } else if (singleSelection instanceof PathwayData) {
            bShowPathway = true;
            bottomComponent = getBioModelEditorPathwayPanel();
        } else if (singleSelection instanceof Model) {
        } else if (singleSelection instanceof RuleParticipantSignature) {
            bottomComponent = getReactionRuleParticipantSignaturePropertiesPanel();
        } else if (singleSelection instanceof CSGObject) {
            bottomComponent = csgObjectPropertiesPanel;
            csgObjectPropertiesPanel.setSimulationContext(getSelectedSimulationContext());
        } else if (singleSelection instanceof DocumentEditorTreeFolderNode) {
            DocumentEditorTreeFolderClass folderClass = ((DocumentEditorTreeFolderNode) singleSelection).getFolderClass();
            if ((folderClass == DocumentEditorTreeFolderClass.REACTIONS_NODE) && !(singleSelection instanceof ReactionRule)) {
                bottomComponent = getReactionPropertiesPanel();
            } else if ((folderClass == DocumentEditorTreeFolderClass.REACTIONS_NODE) && (singleSelection instanceof ReactionRule)) {
                bottomComponent = getReactionRulePropertiesPanel();
            } else if (folderClass == DocumentEditorTreeFolderClass.STRUCTURES_NODE) {
                bottomComponent = getStructurePropertiesPanel();
            } else if (folderClass == DocumentEditorTreeFolderClass.SPECIES_NODE) {
                bottomComponent = getSpeciesPropertiesPanel();
            } else if (folderClass == DocumentEditorTreeFolderClass.MOLECULAR_TYPES_NODE) {
                bottomComponent = getMolecularTypePropertiesPanel();
            } else if (folderClass == DocumentEditorTreeFolderClass.OBSERVABLES_NODE) {
                bottomComponent = getObservablePropertiesPanel();
            } else if (folderClass == DocumentEditorTreeFolderClass.APPLICATIONS_NODE) {
                bottomComponent = getApplicationsPropertiesPanel();
                getApplicationsPropertiesPanel().setBioModel(bioModel);
            } else if (folderClass == DocumentEditorTreeFolderClass.PARAMETER_ESTIMATION_NODE) {
                bottomComponent = parameterEstimationTaskPropertiesPanel;
            }
        } else if (singleSelection instanceof SelectionManager.AnnotationNavigator) {
            Object entity = ((SelectionManager.AnnotationNavigator) singleSelection).getEntity();
            if (entity instanceof ReactionStep) {
                bottomComponent = getReactionPropertiesPanel();
            } else if (entity instanceof SpeciesContext) {
                bottomComponent = getSpeciesPropertiesPanel();
            } else if (entity instanceof Structure) {
                // Observables. MolecularType, Structures
                bottomComponent = getStructurePropertiesPanel();
            } else if (entity instanceof MolecularType) {
                bottomComponent = getMolecularTypePropertiesPanel();
            } else if (entity instanceof RbmObservable) {
                bottomComponent = getObservablePropertiesPanel();
            } else {
                bottomComponent = bioModelEditorAnnotationPanel;
            }
        }
    }
    if (bShowPathway) {
        int numTabs = rightBottomTabbedPane.getTabCount();
        for (destComponentIndex = 0; destComponentIndex < numTabs; destComponentIndex++) {
            Component current = rightBottomTabbedPane.getComponentAt(destComponentIndex);
            if (current == bottomComponent) {
                break;
            }
        }
        String tabTitle = "Pathway Preview";
        if (rightBottomTabbedPane.getTabCount() == destComponentIndex) {
            rightBottomTabbedPane.addTab(tabTitle, new TabCloseIcon(), bottomComponent);
        }
    } else if (bShowInDatabaseProperties) {
        for (destComponentIndex = 0; destComponentIndex < rightBottomTabbedPane.getTabCount(); destComponentIndex++) {
            Component c = rightBottomTabbedPane.getComponentAt(destComponentIndex);
            if (c == bioModelMetaDataPanel || c == mathModelMetaDataPanel || c == geometryMetaDataPanel || c == getBioModelsNetPropertiesPanel()) {
                break;
            }
        }
        if (rightBottomTabbedPane.getTabCount() == destComponentIndex) {
            rightBottomTabbedPane.addTab(DATABASE_PROPERTIES_TAB_TITLE, new TabCloseIcon(), bottomComponent);
        }
    }
    if (rightBottomTabbedPane.getComponentAt(destComponentIndex) != bottomComponent) {
        bottomComponent.setBorder(GuiConstants.TAB_PANEL_BORDER);
        annotationComponent.setBorder(GuiConstants.TAB_PANEL_BORDER);
        rightBottomTabbedPane.setComponentAt(destComponentIndex, bottomComponent);
        rightBottomTabbedPane.setComponentAt(annComponentIndex, annotationComponent);
        rightSplitPane.repaint();
    }
    Component selectedComponent = rightBottomTabbedPane.getSelectedComponent();
    if (selections.length == 1 && selections[0] instanceof BioModel && bottomComponent instanceof BioModelEditorAnnotationPanel) {
        // if the biomodel name is selected in the upper left tree, we select the Annotations tab
        rightBottomTabbedPane.setSelectedComponent(annotationComponent);
    } else if (selections.length == 1 && selections[0] instanceof SelectionManager.AnnotationNavigator && selections[0] instanceof SelectionManager.AnnotationNavigator) {
        // we want to navigate to the AnnotationPanel
        rightBottomTabbedPane.setSelectedComponent(annotationComponent);
    // } else if(selections.length == 1 && selections[0] instanceof SelectionManager.AnnotationNavigator && bottomComponent instanceof BioModelEditorAnnotationPanel) {
    // // we want to navigate to the AnnotationPanel (old way)
    // rightBottomTabbedPane.setSelectedComponent(annotationComponent);
    } else if (selectedComponent != bottomComponent) /* && rightBottomTabbedPane.getSelectedComponent() != annotationComponent */
    {
        rightBottomTabbedPane.setSelectedComponent(bottomComponent);
    }
}
Also used : RuleParticipantSignature(cbit.vcell.model.RuleParticipantSignature) BioPaxObject(org.vcell.pathway.BioPaxObject) Product(cbit.vcell.model.Product) PathwayData(cbit.vcell.client.desktop.biomodel.BioModelEditorPathwayCommonsPanel.PathwayData) SpeciesContext(cbit.vcell.model.SpeciesContext) SpeciesContextSpec(cbit.vcell.mapping.SpeciesContextSpec) Reactant(cbit.vcell.model.Reactant) SpatialObject(cbit.vcell.mapping.spatial.SpatialObject) VCMetaData(cbit.vcell.biomodel.meta.VCMetaData) SpatialProcess(cbit.vcell.mapping.spatial.processes.SpatialProcess) GeometryInfo(cbit.vcell.geometry.GeometryInfo) Structure(cbit.vcell.model.Structure) CSGObject(cbit.vcell.geometry.CSGObject) Component(java.awt.Component) JComponent(javax.swing.JComponent) PublicationInfoNode(cbit.vcell.desktop.BioModelNode.PublicationInfoNode) ReactionRule(cbit.vcell.model.ReactionRule) ReactionSpec(cbit.vcell.mapping.ReactionSpec) ReactionRuleSpec(cbit.vcell.mapping.ReactionRuleSpec) RbmObservable(cbit.vcell.model.RbmObservable) JComponent(javax.swing.JComponent) BioModelInfo(org.vcell.util.document.BioModelInfo) DocumentEditorTreeFolderNode(cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderNode) MathModelInfo(org.vcell.util.document.MathModelInfo) SimulationContext(cbit.vcell.mapping.SimulationContext) DocumentEditorTreeFolderClass(cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderClass) MolecularType(org.vcell.model.rbm.MolecularType) ParameterEstimationTask(cbit.vcell.modelopt.ParameterEstimationTask) DataSymbol(cbit.vcell.data.DataSymbol) Simulation(cbit.vcell.solver.Simulation) ReactionStep(cbit.vcell.model.ReactionStep) BioModel(cbit.vcell.biomodel.BioModel) Model(cbit.vcell.model.Model) ListSelectionModel(javax.swing.ListSelectionModel) BioModel(cbit.vcell.biomodel.BioModel) Parameter(cbit.vcell.model.Parameter) BioPaxObject(org.vcell.pathway.BioPaxObject) SpatialObject(cbit.vcell.mapping.spatial.SpatialObject) CSGObject(cbit.vcell.geometry.CSGObject) BioEvent(cbit.vcell.mapping.BioEvent)

Example 12 with ReactionStep

use of cbit.vcell.model.ReactionStep 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 13 with ReactionStep

use of cbit.vcell.model.ReactionStep 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 14 with ReactionStep

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

the class AnnotationsPanel method addIdentifier.

// -------------------------------------------------------------------------------------------------------
private void addIdentifier() {
    if (PopupGenerator.showComponentOKCancelDialog(AnnotationsPanel.this, getJPanelNewIdentifier(), "Define New Formal Identifier") != JOptionPane.OK_OPTION) {
        return;
    }
    MIRIAMQualifier qualifier = (MIRIAMQualifier) getJComboBoxQualifier().getSelectedItem();
    MiriamManager.DataType objectNamespace = (MiriamManager.DataType) getJComboBoxURI().getSelectedItem();
    String objectID = getJTextFieldFormalID().getText();
    if (objectID.compareTo("NewID") == 0) {
        return;
    }
    MiriamManager miriamManager = vcMetaData.getMiriamManager();
    HashSet<MiriamResource> miriamResources = new HashSet<MiriamResource>();
    try {
        Identifiable entity = getIdentifiable(selectedObject);
        MiriamResource mr = miriamManager.createMiriamResource(objectNamespace.getBaseURN() + ":" + objectID);
        miriamResources.add(mr);
        miriamManager.addMiriamRefGroup(entity, qualifier, miriamResources);
        // System.out.println(vcMetaData.printRdfStatements());
        updateInterface();
        if (selectedObject instanceof ReactionStep) {
            // we tell ReactionPropertiesPanel to refresh the annotation icon
            ((ReactionStep) selectedObject).firePropertyChange("addIdentifier", false, true);
        }
    } catch (Exception e) {
        e.printStackTrace();
        DialogUtils.showErrorDialog(this, "Add Identifier failed:\n" + e.getMessage(), e);
    }
}
Also used : MiriamManager(cbit.vcell.biomodel.meta.MiriamManager) VCMetaDataMiriamManager(cbit.vcell.biomodel.meta.VCMetaDataMiriamManager) MiriamResource(cbit.vcell.biomodel.meta.MiriamManager.MiriamResource) ReactionStep(cbit.vcell.model.ReactionStep) DataType(cbit.vcell.biomodel.meta.MiriamManager.DataType) VCMetaDataDataType(cbit.vcell.biomodel.meta.VCMetaDataMiriamManager.VCMetaDataDataType) MIRIAMQualifier(org.vcell.sybil.models.miriam.MIRIAMQualifier) DataType(cbit.vcell.biomodel.meta.MiriamManager.DataType) URNParseFailureException(org.vcell.sybil.models.miriam.MIRIAMRef.URNParseFailureException) HashSet(java.util.HashSet) Identifiable(org.vcell.util.document.Identifiable)

Example 15 with ReactionStep

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

the class VCellCopyPasteHelper method chooseApplyPaste.

/**
 * Insert the method's description here.
 * Creation date: (7/10/2006 11:05:19 AM)
 */
public static void chooseApplyPaste(Component requester, String[] pasteDetails, Parameter[] changingParamters, Expression[] newParameterExpression) {
    if (pasteDetails.length != changingParamters.length || changingParamters.length != newParameterExpression.length) {
        throw new IllegalArgumentException(VCellCopyPasteHelper.class.getName() + ".chooseApplyPaste(...) arguments must have unequal lengths");
    }
    // Only present things that will actually change
    boolean bAtLeatOneDifferent = false;
    boolean[] bEnableDisplay = new boolean[changingParamters.length];
    for (int i = 0; i < changingParamters.length; i += 1) {
        // bEnableDisplay[i] = !changingParamters[i].getExpression().equals(newParameterExpression[i]);
        bEnableDisplay[i] = !Compare.isEqualOrNull(changingParamters[i].getExpression(), newParameterExpression[i]);
        bAtLeatOneDifferent = bAtLeatOneDifferent || bEnableDisplay[i];
    }
    if (!bAtLeatOneDifferent) {
        PopupGenerator.showInfoDialog(requester, "All valid paste values are equal to the destination values.\nNo paste needed.");
        return;
    }
    boolean[] bChoices = showChoices(requester, pasteDetails, bEnableDisplay);
    if (bChoices != null) {
        StringBuffer statusMessages = new StringBuffer();
        boolean bFailure = false;
        for (int i = 0; i < changingParamters.length; i += 1) {
            try {
                if (bChoices[i]) {
                    if (changingParamters[i] instanceof Kinetics.KineticsParameter) {
                        Kinetics kinetics = ((ReactionStep) changingParamters[i].getNameScope().getScopedSymbolTable()).getKinetics();
                        kinetics.setParameterValue((Kinetics.KineticsParameter) changingParamters[i], newParameterExpression[i]);
                    } else {
                        throw new Exception("Changing " + changingParamters[i].getNameScope().getName() + " " + changingParamters[i].getName() + " not yet implemented");
                    }
                }
                statusMessages.append("(OK) " + pasteDetails + "\n");
            } catch (Exception e) {
                bFailure = true;
                statusMessages.append("(Failed) " + pasteDetails + " " + e.getMessage() + " " + e.getClass().getName() + "\n");
            }
        }
        if (bFailure) {
            PopupGenerator.showErrorDialog(requester, "Paste Results:\n" + statusMessages.toString());
        }
    }
}
Also used : ReactionStep(cbit.vcell.model.ReactionStep) Kinetics(cbit.vcell.model.Kinetics)

Aggregations

ReactionStep (cbit.vcell.model.ReactionStep)111 SpeciesContext (cbit.vcell.model.SpeciesContext)55 Structure (cbit.vcell.model.Structure)37 ReactionParticipant (cbit.vcell.model.ReactionParticipant)33 Expression (cbit.vcell.parser.Expression)33 Model (cbit.vcell.model.Model)32 KineticsParameter (cbit.vcell.model.Kinetics.KineticsParameter)30 ArrayList (java.util.ArrayList)29 ReactionRule (cbit.vcell.model.ReactionRule)26 ModelParameter (cbit.vcell.model.Model.ModelParameter)25 Reactant (cbit.vcell.model.Reactant)25 Kinetics (cbit.vcell.model.Kinetics)24 Product (cbit.vcell.model.Product)23 PropertyVetoException (java.beans.PropertyVetoException)23 SimpleReaction (cbit.vcell.model.SimpleReaction)20 ExpressionException (cbit.vcell.parser.ExpressionException)20 Vector (java.util.Vector)19 SimulationContext (cbit.vcell.mapping.SimulationContext)18 Membrane (cbit.vcell.model.Membrane)18 BioModel (cbit.vcell.biomodel.BioModel)17