Search in sources :

Example 61 with Structure

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

the class BioModelEditor method setRightBottomPanelOnSelection.

@Override
protected void setRightBottomPanelOnSelection(Object[] selections) {
    if (selections == null) {
        return;
    }
    JComponent bottomComponent = rightBottomEmptyPanel;
    int destComponentIndex = DocumentEditorTabID.object_properties.ordinal();
    boolean bShowInDatabaseProperties = false;
    boolean bShowPathway = false;
    if (selections.length == 1) {
        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 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 || 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;
            }
        }
    }
    if (bShowPathway) {
        for (destComponentIndex = 0; destComponentIndex < rightBottomTabbedPane.getTabCount(); destComponentIndex++) {
            if (rightBottomTabbedPane.getComponentAt(destComponentIndex) == 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);
        rightBottomTabbedPane.setComponentAt(destComponentIndex, bottomComponent);
        rightSplitPane.repaint();
    }
    if (rightBottomTabbedPane.getSelectedComponent() != bottomComponent) {
        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) 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 62 with Structure

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

the class BioModelEditorModelPanel method deleteButtonPressed.

private void deleteButtonPressed() {
    try {
        ArrayList<Object> deleteList = new ArrayList<Object>();
        int selectedIndex = tabbedPane.getSelectedIndex();
        if (selectedIndex == ModelPanelTabID.reaction_diagram.ordinal()) {
            deleteList.addAll(Arrays.asList(reactionCartoonEditorPanel.getReactionCartoon().getSelectedObjects()));
        // } else if (selectedIndex == ModelPanelTabID.structure_diagram.ordinal()) {
        // deleteList.addAll(Arrays.asList(cartoonEditorPanel.getStructureCartoon().getSelectedObjects()));
        } else {
            computeCurrentSelectedTable();
            int[] rows = currentSelectedTable.getSelectedRows();
            if (rows == null || rows.length == 0) {
                return;
            }
            if (currentSelectedTable == speciesTable) {
                for (int r : rows) {
                    if (r < speciesTableModel.getRowCount()) {
                        SpeciesContext speciesContext = speciesTableModel.getValueAt(r);
                        if (speciesContext != null) {
                            deleteList.add(speciesContext);
                        }
                    }
                }
            } else if (currentSelectedTable == molecularTypeTable) {
                // TODO: delete stuff
                for (int r : rows) {
                    if (r < molecularTypeTableModel.getRowCount()) {
                        MolecularType mt = molecularTypeTableModel.getValueAt(r);
                        if (mt != null) {
                            deleteList.add(mt);
                        }
                    }
                }
            } else if (currentSelectedTable == observablesTable) {
                for (int r : rows) {
                    if (r < observableTableModel.getRowCount()) {
                        RbmObservable o = observableTableModel.getValueAt(r);
                        if (o != null) {
                            deleteList.add(o);
                        }
                    }
                }
            } else if (currentSelectedTable == structuresTable) {
                for (int r : rows) {
                    if (r < structureTableModel.getRowCount()) {
                        Structure rowValue = structureTableModel.getValueAt(r);
                        if (rowValue instanceof Feature || rowValue instanceof Membrane) {
                            deleteList.add(rowValue);
                        }
                    }
                }
            } else if (currentSelectedTable == reactionsTable) {
                for (int r : rows) {
                    if (r < reactionTableModel.getRowCount()) {
                        ModelProcess reaction = reactionTableModel.getValueAt(r);
                        if (reaction != null) {
                            deleteList.add(reaction);
                        }
                    }
                }
            }
        }
        if (deleteList.size() == 0) {
            return;
        }
        StringBuilder deleteListText = new StringBuilder();
        for (Object object : deleteList) {
            if (object instanceof SpeciesContext) {
                deleteListText.append("Species\t'" + ((SpeciesContext) object).getName() + "'\n");
            } else if (object instanceof MolecularType) {
                deleteListText.append(((MolecularType) object).getDisplayType() + "\t'" + ((MolecularType) object).getDisplayName() + "'\n");
            } else if (object instanceof RbmObservable) {
                deleteListText.append("Observable\t'" + ((RbmObservable) object).getName() + "'\n");
            } else if (object instanceof ReactionStep) {
                deleteListText.append("Reaction\t'" + ((ReactionStep) object).getName() + "'\n");
            } else if (object instanceof ReactionRule) {
                deleteListText.append("Reaction rule\t'" + ((ReactionRule) object).getName() + "'\n");
            } else if (object instanceof Structure) {
                deleteListText.append("Structure\t'" + ((Structure) object).getName() + "'\n");
            }
        }
        // TODO: once we display reaction rules in the carton editor panel we'll have to change the way we delete reaction rules
        if (deleteList.get(0) instanceof SpeciesContext || deleteList.get(0) instanceof ReactionStep) {
            try {
                ArrayList<SpeciesContext> speciesContextArrList = new ArrayList<SpeciesContext>();
                ArrayList<ReactionStep> reactionStepArrList = new ArrayList<ReactionStep>();
                for (Object obj : deleteList) {
                    if (obj instanceof SpeciesContext) {
                        speciesContextArrList.add((SpeciesContext) obj);
                    } else if (obj instanceof ReactionStep) {
                        reactionStepArrList.add((ReactionStep) obj);
                    } else {
                        throw new Exception("Unexpected delete object " + obj.getClass().getName());
                    }
                }
                ReactionCartoonTool.deleteReactionsAndSpecies(reactionCartoonEditorPanel, reactionStepArrList.toArray(new ReactionStep[0]), speciesContextArrList.toArray(new SpeciesContext[0]));
            } catch (UserCancelException uce) {
                return;
            }
            return;
        } else {
            String confirm = DialogUtils.showOKCancelWarningDialog(this, "Deleting", "You are going to delete the following:\n\n" + deleteListText + "\n Continue?");
            if (confirm.equals(UserMessage.OPTION_CANCEL)) {
                return;
            }
            for (Object object : deleteList) {
                if (object instanceof ReactionRule) {
                    ReactionRule rr = (ReactionRule) object;
                    bioModel.getModel().getRbmModelContainer().removeReactionRule(rr);
                } else if (object instanceof MolecularType) {
                    Map<String, Pair<Displayable, SpeciesPattern>> usedHere = new LinkedHashMap<String, Pair<Displayable, SpeciesPattern>>();
                    MolecularType mt = (MolecularType) object;
                    if (!bioModel.getModel().getRbmModelContainer().isDeleteAllowed(mt, usedHere)) {
                        String errMsg = mt.getDisplayType() + " <b>'" + mt + "'</b> cannot be deleted because it's already being used by:<br>";
                        final int MaxListSize = 7;
                        int count = 0;
                        for (String key : usedHere.keySet()) {
                            System.out.println(key);
                            if (count >= MaxListSize) {
                                errMsg += "<br> ... and more.";
                                break;
                            }
                            Pair<Displayable, SpeciesPattern> o = usedHere.get(key);
                            Displayable e = o.one;
                            SpeciesPattern sp = o.two;
                            errMsg += "<br> - " + e.getDisplayType().toLowerCase() + " <b>" + e.getDisplayName() + "</b>";
                            errMsg += ", " + sp.getDisplayType().toLowerCase() + " " + " <b>" + sp.getDisplayName() + "</b>";
                            count++;
                        }
                        errMsg = "<html>" + errMsg + "</html>";
                        throw new RuntimeException(errMsg);
                    }
                    bioModel.getModel().getRbmModelContainer().removeMolecularType(mt);
                } else if (object instanceof RbmObservable) {
                    RbmObservable o = (RbmObservable) object;
                    bioModel.getModel().getRbmModelContainer().removeObservable(o);
                } else {
                    bioModel.getModel().removeObject(object);
                }
            }
        }
    } catch (Exception ex) {
        ex.printStackTrace();
        DialogUtils.showErrorDialog(this, ex.getMessage());
    }
}
Also used : ArrayList(java.util.ArrayList) UserCancelException(org.vcell.util.UserCancelException) SpeciesContext(cbit.vcell.model.SpeciesContext) Feature(cbit.vcell.model.Feature) SpeciesPattern(org.vcell.model.rbm.SpeciesPattern) Membrane(cbit.vcell.model.Membrane) Structure(cbit.vcell.model.Structure) Pair(org.vcell.util.Pair) Displayable(org.vcell.util.Displayable) ReactionRule(cbit.vcell.model.ReactionRule) RbmObservable(cbit.vcell.model.RbmObservable) ModelProcess(cbit.vcell.model.ModelProcess) PropertyVetoException(java.beans.PropertyVetoException) ExpressionBindingException(cbit.vcell.parser.ExpressionBindingException) ModelException(cbit.vcell.model.ModelException) UserCancelException(org.vcell.util.UserCancelException) MolecularType(org.vcell.model.rbm.MolecularType) ReactionStep(cbit.vcell.model.ReactionStep) RelationshipObject(org.vcell.relationship.RelationshipObject) BioModelEntityObject(cbit.vcell.model.BioModelEntityObject) BioPaxObject(org.vcell.pathway.BioPaxObject) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap)

Example 63 with Structure

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

the class StructurePropertiesPanel method setModel.

public void setModel(Model model) {
    fieldModel = model;
    DefaultComboBoxModel<String> dataModelPos = new DefaultComboBoxModel<String>();
    DefaultComboBoxModel<String> dataModelNeg = new DefaultComboBoxModel<String>();
    dataModelPos.addElement("");
    dataModelNeg.addElement("");
    for (Structure s : model.getStructures()) {
        if (s instanceof Feature) {
            dataModelPos.addElement(s.getName());
            dataModelNeg.addElement(s.getName());
        }
    }
    // fill the comboBoxes with feature names from the model.
    positiveFeatureComboBox.setModel(dataModelPos);
    // if selected structure is a membrane, if it has +ve/-ve feature set, set the comboBox with that selection.
    if (structure instanceof Membrane) {
        Membrane membrane = (Membrane) structure;
        if (fieldModel.getElectricalTopology().getPositiveFeature(membrane) != null) {
            positiveFeatureComboBox.setSelectedItem(fieldModel.getElectricalTopology().getPositiveFeature(membrane).getName());
        }
    }
    negativeFeatureComboBox.setModel(dataModelNeg);
    if (structure instanceof Membrane) {
        Membrane membrane = (Membrane) structure;
        if (fieldModel.getElectricalTopology().getNegativeFeature(membrane) != null) {
            negativeFeatureComboBox.setSelectedItem(fieldModel.getElectricalTopology().getNegativeFeature(membrane).getName());
        }
    }
}
Also used : Membrane(cbit.vcell.model.Membrane) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) Structure(cbit.vcell.model.Structure) Feature(cbit.vcell.model.Feature)

Example 64 with Structure

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

the class StructurePropertiesPanel method setStructure.

/**
 * Sets the speciesContext property (cbit.vcell.model.SpeciesContext) value.
 * @param speciesContext The new value for the property.
 * @see #getSpeciesContext
 */
void setStructure(Structure newValue) {
    if (newValue == structure) {
        return;
    }
    Structure oldValue = structure;
    if (oldValue != null) {
        oldValue.removePropertyChangeListener(eventHandler);
        oldValue.getStructureSize().removePropertyChangeListener(eventHandler);
        if (oldValue instanceof Membrane) {
            ((Membrane) oldValue).getMembraneVoltage().removePropertyChangeListener(eventHandler);
        }
    }
    // commit the changes before switch to another structure
    changeName();
    changeAnnotation();
    structure = newValue;
    if (newValue != null) {
        newValue.addPropertyChangeListener(eventHandler);
        newValue.getStructureSize().addPropertyChangeListener(eventHandler);
        if (newValue instanceof Membrane) {
            ((Membrane) newValue).getMembraneVoltage().addPropertyChangeListener(eventHandler);
        }
    }
    updateInterface();
}
Also used : Membrane(cbit.vcell.model.Membrane) Structure(cbit.vcell.model.Structure)

Example 65 with Structure

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

the class InitialConditionsPanel method initialize.

/**
 * Initialize the class.
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private void initialize() {
    try {
        // user code begin {1}
        // user code end
        setName("InitialConditionsPanel");
        setLayout(new BorderLayout());
        add(getRadioButtonAndCheckboxPanel(), BorderLayout.NORTH);
        add(getScrollPaneTable().getEnclosingScrollPane(), BorderLayout.CENTER);
        getScrollPaneTable().getSelectionModel().addListSelectionListener(ivjEventHandler);
        getJMenuItemPaste().addActionListener(ivjEventHandler);
        getJMenuItemCopy().addActionListener(ivjEventHandler);
        getJMenuItemCopyAll().addActionListener(ivjEventHandler);
        getJMenuItemPasteAll().addActionListener(ivjEventHandler);
        getAmountRadioButton().addActionListener(ivjEventHandler);
        getConcentrationRadioButton().addActionListener(ivjEventHandler);
        getRandomizeInitCondnCheckbox().addActionListener(ivjEventHandler);
        DefaultTableCellRenderer renderer = new DefaultScrollTableCellRenderer() {

            public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
                super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
                setIcon(null);
                defaultToolTipText = null;
                if (value instanceof Species) {
                    setText(((Species) value).getCommonName());
                    defaultToolTipText = getText();
                    setToolTipText(defaultToolTipText);
                } else if (value instanceof SpeciesContext) {
                    setText(((SpeciesContext) value).getName());
                    defaultToolTipText = getText();
                    setToolTipText(defaultToolTipText);
                } else if (value instanceof Structure) {
                    setText(((Structure) value).getName());
                    defaultToolTipText = getText();
                    setToolTipText(defaultToolTipText);
                } else if (value instanceof ScopedExpression) {
                    SpeciesContextSpec scSpec = tableModel.getValueAt(row);
                    VCUnitDefinition unit = null;
                    if (table.getColumnName(column).equals(SpeciesContextSpecsTableModel.ColumnType.COLUMN_INITIAL.label)) {
                        SpeciesContextSpecParameter initialConditionParameter = scSpec.getInitialConditionParameter();
                        unit = initialConditionParameter.getUnitDefinition();
                    } else if (table.getColumnName(column).equals(SpeciesContextSpecsTableModel.ColumnType.COLUMN_DIFFUSION.label)) {
                        SpeciesContextSpecParameter diffusionParameter = scSpec.getDiffusionParameter();
                        unit = diffusionParameter.getUnitDefinition();
                    }
                    if (unit != null) {
                        setHorizontalTextPosition(JLabel.LEFT);
                        setIcon(new TextIcon("[" + unit.getSymbolUnicode() + "]", DefaultScrollTableCellRenderer.uneditableForeground));
                    }
                    int rgb = 0x00ffffff & DefaultScrollTableCellRenderer.uneditableForeground.getRGB();
                    defaultToolTipText = "<html>" + StringEscapeUtils.escapeHtml4(getText()) + " <font color=#" + Integer.toHexString(rgb) + "> [" + unit.getSymbolUnicode() + "] </font></html>";
                    setToolTipText(defaultToolTipText);
                    if (unit != null) {
                        setText(defaultToolTipText);
                    }
                }
                TableModel tableModel = table.getModel();
                if (tableModel instanceof SortTableModel) {
                    DefaultScrollTableCellRenderer.issueRenderer(this, defaultToolTipText, table, row, column, (SortTableModel) tableModel);
                    setHorizontalTextPosition(JLabel.TRAILING);
                }
                return this;
            }
        };
        DefaultTableCellRenderer 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 SpeciesContextSpec) {
                            SpeciesContextSpec scs = (SpeciesContextSpec) selectedObject;
                            SpeciesContext sc = scs.getSpeciesContext();
                            // sp may be null for "plain" species contexts
                            SpeciesPattern sp = sc.getSpeciesPattern();
                            Graphics panelContext = table.getGraphics();
                            spss = new SpeciesPatternSmallShape(4, 2, sp, shapeManager, 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);
                }
            }
        };
        getScrollPaneTable().setDefaultRenderer(SpeciesContext.class, renderer);
        getScrollPaneTable().setDefaultRenderer(Structure.class, renderer);
        getScrollPaneTable().setDefaultRenderer(SpeciesPattern.class, rbmSpeciesShapeDepictionCellRenderer);
        getScrollPaneTable().setDefaultRenderer(Species.class, renderer);
        getScrollPaneTable().setDefaultRenderer(ScopedExpression.class, renderer);
        getScrollPaneTable().setDefaultRenderer(Boolean.class, new ScrollTableBooleanCellRenderer());
    } catch (java.lang.Throwable ivjExc) {
        handleException(ivjExc);
    }
}
Also used : VCellSortTableModel(cbit.vcell.client.desktop.biomodel.VCellSortTableModel) SortTableModel(org.vcell.util.gui.sorttable.SortTableModel) TextIcon(cbit.vcell.mapping.gui.StructureMappingTableRenderer.TextIcon) SpeciesPatternSmallShape(cbit.vcell.graph.SpeciesPatternSmallShape) SpeciesContext(cbit.vcell.model.SpeciesContext) SpeciesContextSpec(cbit.vcell.mapping.SpeciesContextSpec) ScrollTableBooleanCellRenderer(org.vcell.util.gui.ScrollTable.ScrollTableBooleanCellRenderer) SpeciesPattern(org.vcell.model.rbm.SpeciesPattern) DefaultTableCellRenderer(javax.swing.table.DefaultTableCellRenderer) Graphics(java.awt.Graphics) VCUnitDefinition(cbit.vcell.units.VCUnitDefinition) ScopedExpression(cbit.gui.ScopedExpression) BorderLayout(java.awt.BorderLayout) VCellSortTableModel(cbit.vcell.client.desktop.biomodel.VCellSortTableModel) JTable(javax.swing.JTable) DefaultScrollTableCellRenderer(org.vcell.util.gui.DefaultScrollTableCellRenderer) Structure(cbit.vcell.model.Structure) Species(cbit.vcell.model.Species) TableModel(javax.swing.table.TableModel) VCellSortTableModel(cbit.vcell.client.desktop.biomodel.VCellSortTableModel) SortTableModel(org.vcell.util.gui.sorttable.SortTableModel) SpeciesContextSpecParameter(cbit.vcell.mapping.SpeciesContextSpec.SpeciesContextSpecParameter)

Aggregations

Structure (cbit.vcell.model.Structure)159 SpeciesContext (cbit.vcell.model.SpeciesContext)57 Membrane (cbit.vcell.model.Membrane)47 PropertyVetoException (java.beans.PropertyVetoException)42 Feature (cbit.vcell.model.Feature)36 Model (cbit.vcell.model.Model)35 ArrayList (java.util.ArrayList)35 ReactionStep (cbit.vcell.model.ReactionStep)33 Expression (cbit.vcell.parser.Expression)33 ReactionRule (cbit.vcell.model.ReactionRule)27 ExpressionException (cbit.vcell.parser.ExpressionException)27 BioModel (cbit.vcell.biomodel.BioModel)23 StructureMapping (cbit.vcell.mapping.StructureMapping)22 SpeciesPattern (org.vcell.model.rbm.SpeciesPattern)22 Species (cbit.vcell.model.Species)21 MolecularType (org.vcell.model.rbm.MolecularType)20 ReactionParticipant (cbit.vcell.model.ReactionParticipant)19 SimpleReaction (cbit.vcell.model.SimpleReaction)19 SimulationContext (cbit.vcell.mapping.SimulationContext)18 ModelException (cbit.vcell.model.ModelException)18