Search in sources :

Example 6 with SpeciesPattern

use of org.vcell.model.rbm.SpeciesPattern in project vcell by virtualcell.

the class XmlReader method getRbmReactantPatternsList.

private void getRbmReactantPatternsList(Element e, ReactionRule r, Model newModel) {
    if (e != null) {
        List<Element> rpChildren = e.getChildren(XMLTags.RbmReactantPatternTag, vcNamespace);
        for (Element rpElement : rpChildren) {
            Structure structure = null;
            String structureName = rpElement.getAttributeValue(XMLTags.StructureAttrTag);
            if (structureName == null || structureName.isEmpty()) {
                // the tag is missing
                throw new RuntimeException("XMLReader: structure missing for reaction rule pattern.");
            } else {
                structure = newModel.getStructure(structureName);
            }
            Element spe = rpElement.getChild(XMLTags.RbmSpeciesPatternTag, vcNamespace);
            SpeciesPattern s = getSpeciesPattern(spe, newModel);
            if (s != null) {
                r.addReactant(new ReactantPattern(s, structure), false);
            }
        }
        // older models have the species pattern saved directly and using the structure or the rule
        List<Element> spChildren = e.getChildren(XMLTags.RbmSpeciesPatternTag, vcNamespace);
        for (Element element : spChildren) {
            SpeciesPattern s = getSpeciesPattern(element, newModel);
            if (s != null) {
                r.addReactant(new ReactantPattern(s, r.getStructure()), false);
            }
        }
    }
}
Also used : Element(org.jdom.Element) Structure(cbit.vcell.model.Structure) ParticleSpeciesPattern(cbit.vcell.math.ParticleSpeciesPattern) VolumeParticleSpeciesPattern(cbit.vcell.math.VolumeParticleSpeciesPattern) SpeciesPattern(org.vcell.model.rbm.SpeciesPattern) ReactantPattern(cbit.vcell.model.ReactantPattern)

Example 7 with SpeciesPattern

use of org.vcell.model.rbm.SpeciesPattern in project vcell by virtualcell.

the class BioModelEditorSpeciesTableModel method isCellEditable.

public boolean isCellEditable(int row, int column) {
    switch(column) {
        case COLUMN_NAME:
            return true;
        case COLUMN_DEFINITION:
            SpeciesContext sc = getValueAt(row);
            if (sc == null) {
                return false;
            }
            SpeciesPattern sp = sc.getSpeciesPattern();
            if (sp == null) {
                // we can edit a species pattern if none is present
                return true;
            }
            final List<MolecularTypePattern> mtpList = sp.getMolecularTypePatterns();
            for (MolecularTypePattern mtp : mtpList) {
                MolecularType mt = mtp.getMolecularType();
                if (mt.getComponentList().size() != 0) {
                    return false;
                }
            }
            return true;
        default:
            return false;
    }
}
Also used : MolecularType(org.vcell.model.rbm.MolecularType) SpeciesContext(cbit.vcell.model.SpeciesContext) MolecularTypePattern(org.vcell.model.rbm.MolecularTypePattern) SpeciesPattern(org.vcell.model.rbm.SpeciesPattern)

Example 8 with SpeciesPattern

use of org.vcell.model.rbm.SpeciesPattern in project vcell by virtualcell.

the class BioModelEditorSpeciesTableModel method checkInputValue.

public String checkInputValue(String inputValue, int row, int column) {
    SpeciesContext speciesContext = getValueAt(row);
    String errMsg = null;
    switch(column) {
        case COLUMN_NAME:
            if (speciesContext == null || !speciesContext.getName().equals(inputValue)) {
                if (getModel().getSpeciesContext(inputValue) != null) {
                    errMsg = "Species '" + inputValue + "' already exists!";
                    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;
        case COLUMN_DEFINITION:
            try {
                inputValue = inputValue.trim();
                if (inputValue.length() > 0) {
                    // parsing will throw appropriate exception if molecular type or component don't exist
                    // our change
                    SpeciesPattern spThis = RbmUtils.parseSpeciesPattern(inputValue, bioModel.getModel());
                    // here we can restrict what the user can do
                    for (MolecularTypePattern mtpThis : spThis.getMolecularTypePatterns()) {
                        MolecularType mtThis = mtpThis.getMolecularType();
                        for (MolecularComponent mcThis : mtThis.getComponentList()) {
                            // we check that each component is present in the molecular type pattern (as component pattern)
                            if (mtpThis.getMolecularComponentPattern(mcThis) == null) {
                                // not found
                                errMsg = "All " + MolecularComponent.typeName + "s in the " + mtThis.getDisplayType() + " definition must be present. Missing: " + mcThis.getName();
                                errMsg += VCellErrorMessages.PressEscToUndo;
                                errMsg = "<html>" + errMsg + "</html>";
                                return errMsg;
                            } else if (mtpThis.getMolecularComponentPattern(mcThis).isImplied()) {
                                errMsg = "All " + MolecularComponent.typeName + "s in the " + mtThis.getDisplayType() + " definition must be present. Missing: " + mcThis.getName();
                                errMsg += VCellErrorMessages.PressEscToUndo;
                                errMsg = "<html>" + errMsg + "</html>";
                                return errMsg;
                            } else {
                                // now need to also check the states
                                if (mcThis.getComponentStateDefinitions().size() == 0) {
                                    // nothing to do if the molecular component has no component state definition
                                    continue;
                                // note that we raise exception in parseSpeciesPattern() if we attempt to use an undefined state
                                // so no need to check that here
                                }
                                boolean found = false;
                                for (ComponentStateDefinition csThis : mcThis.getComponentStateDefinitions()) {
                                    MolecularComponentPattern mcpThis = mtpThis.getMolecularComponentPattern(mcThis);
                                    if ((mcpThis.getComponentStatePattern() == null) || mcpThis.getComponentStatePattern().isAny()) {
                                        // no component state pattern means no state, there's no point to check for this component again
                                        break;
                                    // we get out of the for and complain that we found no matching state
                                    }
                                    if (csThis.getName().equals(mcpThis.getComponentStatePattern().getComponentStateDefinition().getName())) {
                                        found = true;
                                    }
                                }
                                if (found == false) {
                                    // we should have found a matching state for the molecular component pattern
                                    errMsg = MolecularComponent.typeName + " " + mcThis.getDisplayName() + " of " + mtThis.getDisplayType() + " " + mtThis.getDisplayName() + " must be in one of the following states: ";
                                    for (int i = 0; i < mcThis.getComponentStateDefinitions().size(); i++) {
                                        ComponentStateDefinition csThis = mcThis.getComponentStateDefinitions().get(i);
                                        errMsg += csThis.getName();
                                        if (i < mcThis.getComponentStateDefinitions().size() - 1) {
                                            errMsg += ", ";
                                        }
                                    }
                                    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;
    }
    return null;
}
Also used : MolecularType(org.vcell.model.rbm.MolecularType) MolecularComponent(org.vcell.model.rbm.MolecularComponent) MolecularComponentPattern(org.vcell.model.rbm.MolecularComponentPattern) SpeciesContext(cbit.vcell.model.SpeciesContext) MolecularTypePattern(org.vcell.model.rbm.MolecularTypePattern) SpeciesPattern(org.vcell.model.rbm.SpeciesPattern) ComponentStateDefinition(org.vcell.model.rbm.ComponentStateDefinition)

Example 9 with SpeciesPattern

use of org.vcell.model.rbm.SpeciesPattern in project vcell by virtualcell.

the class OutputSpeciesResultsPanel method initialize.

private void initialize() {
    try {
        setName("ViewGeneratedSpeciesPanel");
        setLayout(new GridBagLayout());
        shapePanel = new LargeShapePanel() {

            @Override
            public void paintComponent(Graphics g) {
                super.paintComponent(g);
                if (spls != null) {
                    spls.paintSelf(g);
                }
            }

            @Override
            public DisplayMode getDisplayMode() {
                return DisplayMode.other;
            }

            @Override
            public RuleAnalysisChanged hasStateChanged(String reactionRuleName, MolecularComponentPattern molecularComponentPattern) {
                return RuleAnalysisChanged.UNCHANGED;
            }

            @Override
            public RuleAnalysisChanged hasStateChanged(MolecularComponentPattern molecularComponentPattern) {
                return RuleAnalysisChanged.UNCHANGED;
            }

            @Override
            public RuleAnalysisChanged hasBondChanged(String reactionRuleName, MolecularComponentPattern molecularComponentPattern) {
                return RuleAnalysisChanged.UNCHANGED;
            }

            @Override
            public RuleAnalysisChanged hasBondChanged(MolecularComponentPattern molecularComponentPattern) {
                return RuleAnalysisChanged.UNCHANGED;
            }

            @Override
            public RuleAnalysisChanged hasNoMatch(String reactionRuleName, MolecularTypePattern mtp) {
                return RuleAnalysisChanged.UNCHANGED;
            }

            @Override
            public RuleAnalysisChanged hasNoMatch(MolecularTypePattern molecularTypePattern) {
                return RuleAnalysisChanged.UNCHANGED;
            }

            @Override
            public RuleParticipantSignature getSignature() {
                return null;
            }

            @Override
            public GroupingCriteria getCriteria() {
                return null;
            }

            @Override
            public boolean isViewSingleRow() {
                return true;
            }
        };
        Border loweredBevelBorder = BorderFactory.createLoweredBevelBorder();
        shapePanel.setLayout(new GridBagLayout());
        shapePanel.setBackground(Color.white);
        // not really editable but we don't want the brown contours here
        shapePanel.setEditable(true);
        shapePanel.setShowMoleculeColor(true);
        shapePanel.setShowNonTrivialOnly(true);
        JScrollPane scrollPane = new JScrollPane(shapePanel);
        scrollPane.setBorder(loweredBevelBorder);
        scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
        scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
        JPanel optionsPanel = new JPanel();
        optionsPanel.setLayout(new GridBagLayout());
        getZoomSmallerButton().setEnabled(true);
        getZoomLargerButton().setEnabled(false);
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 0;
        gbc.insets = new Insets(0, 0, 0, 10);
        gbc.anchor = GridBagConstraints.WEST;
        optionsPanel.add(getZoomLargerButton(), gbc);
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 1;
        gbc.insets = new Insets(2, 0, 4, 10);
        gbc.anchor = GridBagConstraints.WEST;
        optionsPanel.add(getZoomSmallerButton(), gbc);
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 2;
        gbc.weightx = 1;
        // fake cell used for filling all the vertical empty space
        gbc.weighty = 1;
        gbc.anchor = GridBagConstraints.WEST;
        gbc.insets = new Insets(4, 4, 4, 10);
        optionsPanel.add(new JLabel(""), gbc);
        JPanel containerOfScrollPanel = new JPanel();
        containerOfScrollPanel.setLayout(new BorderLayout());
        containerOfScrollPanel.add(optionsPanel, BorderLayout.WEST);
        containerOfScrollPanel.add(scrollPane, BorderLayout.CENTER);
        Dimension dim = new Dimension(500, 135);
        // dimension of shape panel
        containerOfScrollPanel.setPreferredSize(dim);
        containerOfScrollPanel.setMinimumSize(dim);
        containerOfScrollPanel.setMaximumSize(dim);
        // ------------------------------------------------------------------------
        table = new EditorScrollTable();
        tableModel = new OutputSpeciesResultsTableModel();
        table.setModel(tableModel);
        table.getSelectionModel().addListSelectionListener(eventHandler);
        table.getModel().addTableModelListener(eventHandler);
        DefaultTableCellRenderer rightRenderer = new DefaultTableCellRenderer();
        rightRenderer.setHorizontalAlignment(JLabel.RIGHT);
        int gridy = 0;
        gbc = new java.awt.GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = gridy;
        gbc.weightx = 1.0;
        gbc.weighty = 1.0;
        gbc.gridwidth = 8;
        gbc.fill = GridBagConstraints.BOTH;
        gbc.insets = new Insets(4, 4, 4, 4);
        table.setPreferredScrollableViewportSize(new Dimension(400, 200));
        add(table.getEnclosingScrollPane(), gbc);
        // add toolTipText for each table cell
        table.addMouseMotionListener(new MouseMotionAdapter() {

            public void mouseMoved(MouseEvent e) {
                Point p = e.getPoint();
                int row = table.rowAtPoint(p);
                int column = table.columnAtPoint(p);
                table.setToolTipText(String.valueOf(table.getValueAt(row, column)));
            }
        });
        gridy++;
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = gridy;
        gbc.anchor = GridBagConstraints.LINE_END;
        gbc.insets = new Insets(4, 4, 4, 4);
        add(new JLabel("Search "), gbc);
        textFieldSearch = new JTextField(70);
        textFieldSearch.addActionListener(eventHandler);
        textFieldSearch.getDocument().addDocumentListener(eventHandler);
        textFieldSearch.putClientProperty("JTextField.variant", "search");
        gbc = new java.awt.GridBagConstraints();
        gbc.weightx = 1.0;
        gbc.gridx = 1;
        gbc.gridy = gridy;
        gbc.gridwidth = 3;
        gbc.anchor = GridBagConstraints.LINE_START;
        gbc.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gbc.insets = new Insets(4, 0, 4, 4);
        add(textFieldSearch, gbc);
        gbc = new GridBagConstraints();
        gbc.gridx = 4;
        gbc.gridy = gridy;
        gbc.fill = GridBagConstraints.HORIZONTAL;
        gbc.insets = new Insets(4, 4, 4, 10);
        add(totalSpeciesLabel, gbc);
        gridy++;
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = gridy;
        // gbc.weightx = 1.0;
        gbc.gridwidth = 8;
        gbc.anchor = GridBagConstraints.LINE_END;
        gbc.fill = java.awt.GridBagConstraints.BOTH;
        gbc.insets = new Insets(4, 4, 4, 4);
        add(containerOfScrollPanel, gbc);
        gridy++;
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = gridy;
        gbc.weightx = 1.0;
        gbc.gridwidth = 2;
        gbc.anchor = GridBagConstraints.WEST;
        gbc.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gbc.insets = new Insets(4, 4, 4, 4);
        add(getSpeciesFileLocationPanel(), gbc);
        // // button to copy to clipboard the content of the JTextField.
        // // TODO: do not delete! this is how it's done
        // JButton buttonCopy = new JButton("Copy");
        // buttonCopy.setToolTipText("Copy to clipboard the species file path");
        // buttonCopy.addActionListener(new ActionListener() {
        // public void actionPerformed(ActionEvent le) {
        // if(speciesFileLocationTextField.getSelectionStart() == speciesFileLocationTextField.getSelectionEnd()) {
        // speciesFileLocationTextField.setSelectionStart(0);
        // speciesFileLocationTextField.setSelectionEnd(speciesFileLocationTextField.getText().length());
        // }
        // speciesFileLocationTextField.copy();
        // speciesFileLocationTextField.setSelectionStart(0);
        // speciesFileLocationTextField.setSelectionEnd(0);
        // }
        // });
        // gbc = new GridBagConstraints();
        // gbc.gridx = 4;
        // gbc.gridy = gridy;
        // gbc.fill = java.awt.GridBagConstraints.HORIZONTAL;
        // gbc.insets = new Insets(4,4,4,4);
        // add(buttonCopy, gbc);
        // rendering the small shapes of the flattened species in the Depiction column of this viewer table)
        DefaultScrollTableCellRenderer rbmSpeciesShapeDepictionCellRenderer = new DefaultScrollTableCellRenderer() {

            SpeciesPatternSmallShape spss = null;

            @Override
            public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
                super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
                if (table.getModel() instanceof VCellSortTableModel<?>) {
                    Object selectedObject = null;
                    if (table.getModel() == tableModel) {
                        selectedObject = tableModel.getValueAt(row);
                    }
                    if (selectedObject != null) {
                        if (selectedObject instanceof GeneratedSpeciesTableRow) {
                            SpeciesContext sc = ((GeneratedSpeciesTableRow) selectedObject).species;
                            if (sc == null || sc.getSpeciesPattern() == null) {
                                spss = null;
                            } else {
                                SpeciesPattern sp = sc.getSpeciesPattern();
                                Graphics panelContext = table.getGraphics();
                                spss = new SpeciesPatternSmallShape(4, 2, sp, panelContext, sc, isSelected, issueManager);
                            }
                        }
                    } else {
                        spss = null;
                    }
                }
                setText("");
                return this;
            }

            @Override
            public void paintComponent(Graphics g) {
                super.paintComponent(g);
                if (spss != null) {
                    spss.paintSelf(g);
                }
            }
        };
        table.getColumnModel().getColumn(OutputSpeciesResultsTableModel.iColDepiction).setCellRenderer(rbmSpeciesShapeDepictionCellRenderer);
        table.getColumnModel().getColumn(OutputSpeciesResultsTableModel.iColDepiction).setPreferredWidth(400);
        table.getColumnModel().getColumn(OutputSpeciesResultsTableModel.iColDepiction).setMinWidth(400);
        table.getColumnModel().getColumn(OutputSpeciesResultsTableModel.iColDefinition).setPreferredWidth(30);
        table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
    } catch (java.lang.Throwable ivjExc) {
        handleException(ivjExc);
    }
}
Also used : GeneratedSpeciesTableRow(org.vcell.model.rbm.gui.GeneratedSpeciesTableRow) JPanel(javax.swing.JPanel) RuleParticipantSignature(cbit.vcell.model.RuleParticipantSignature) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) SpeciesPatternSmallShape(cbit.vcell.graph.SpeciesPatternSmallShape) SpeciesContext(cbit.vcell.model.SpeciesContext) JTextField(javax.swing.JTextField) SpeciesPattern(org.vcell.model.rbm.SpeciesPattern) ASTSpeciesPattern(org.vcell.model.bngl.ASTSpeciesPattern) LargeShapePanel(cbit.vcell.graph.gui.LargeShapePanel) DefaultTableCellRenderer(javax.swing.table.DefaultTableCellRenderer) BorderLayout(java.awt.BorderLayout) VCellSortTableModel(cbit.vcell.client.desktop.biomodel.VCellSortTableModel) RuleAnalysisChanged(cbit.vcell.graph.ReactionCartoon.RuleAnalysisChanged) JScrollPane(javax.swing.JScrollPane) MouseEvent(java.awt.event.MouseEvent) MolecularComponentPattern(org.vcell.model.rbm.MolecularComponentPattern) GroupingCriteria(cbit.vcell.model.GroupingCriteria) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) Point(java.awt.Point) GridBagConstraints(java.awt.GridBagConstraints) Point(java.awt.Point) Graphics(java.awt.Graphics) MouseMotionAdapter(java.awt.event.MouseMotionAdapter) JTable(javax.swing.JTable) DefaultScrollTableCellRenderer(org.vcell.util.gui.DefaultScrollTableCellRenderer) EditorScrollTable(org.vcell.util.gui.EditorScrollTable) MolecularTypePattern(org.vcell.model.rbm.MolecularTypePattern) Border(javax.swing.border.Border)

Example 10 with SpeciesPattern

use of org.vcell.model.rbm.SpeciesPattern 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)

Aggregations

SpeciesPattern (org.vcell.model.rbm.SpeciesPattern)93 MolecularTypePattern (org.vcell.model.rbm.MolecularTypePattern)39 MolecularComponentPattern (org.vcell.model.rbm.MolecularComponentPattern)30 MolecularType (org.vcell.model.rbm.MolecularType)25 RbmObservable (cbit.vcell.model.RbmObservable)22 SpeciesContext (cbit.vcell.model.SpeciesContext)22 Structure (cbit.vcell.model.Structure)22 Point (java.awt.Point)18 ReactionRule (cbit.vcell.model.ReactionRule)16 ArrayList (java.util.ArrayList)16 ComponentStatePattern (org.vcell.model.rbm.ComponentStatePattern)16 Graphics (java.awt.Graphics)13 PropertyVetoException (java.beans.PropertyVetoException)13 SpeciesPatternLargeShape (cbit.vcell.graph.SpeciesPatternLargeShape)12 ProductPattern (cbit.vcell.model.ProductPattern)12 ReactantPattern (cbit.vcell.model.ReactantPattern)12 Dimension (java.awt.Dimension)12 ComponentStateDefinition (org.vcell.model.rbm.ComponentStateDefinition)12 Model (cbit.vcell.model.Model)11 ModelException (cbit.vcell.model.ModelException)11