Search in sources :

Example 6 with MolecularComponent

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

the class MolecularTypePropertiesPanel method showPopupMenu.

private void showPopupMenu(MouseEvent e, PointLocationInShapeContext locationContext) {
    if (popupFromShapeMenu == null) {
        popupFromShapeMenu = new JPopupMenu();
    }
    if (popupFromShapeMenu.isShowing()) {
        return;
    }
    final Object deepestShape = locationContext.getDeepestShape();
    final Object selectedObject;
    if (deepestShape == null) {
        selectedObject = null;
        // when cursor is outside there's nothing to do  ???
        System.out.println("outside");
        return;
    } else if (deepestShape instanceof ComponentStateLargeShape) {
        System.out.println("inside state");
        if (((ComponentStateLargeShape) deepestShape).isHighlighted()) {
            selectedObject = ((ComponentStateLargeShape) deepestShape).getComponentStateDefinition();
        } else {
            // right click only works on highlighted entity, if it's not highlighted we simply return
            return;
        }
    } else if (deepestShape instanceof MolecularComponentLargeShape) {
        System.out.println("inside component");
        if (((MolecularComponentLargeShape) deepestShape).isHighlighted()) {
            selectedObject = ((MolecularComponentLargeShape) deepestShape).getMolecularComponent();
        } else {
            return;
        }
    } else if (deepestShape instanceof MolecularTypeLargeShape) {
        System.out.println("inside molecule");
        if (((MolecularTypeLargeShape) deepestShape).isHighlighted()) {
            selectedObject = ((MolecularTypeLargeShape) deepestShape).getMolecularType();
        } else {
            return;
        }
    } else if (deepestShape instanceof SpeciesPatternLargeShape) {
        // this cannot happen, here just for symmetry
        System.out.println("inside species pattern");
        if (((SpeciesPatternLargeShape) deepestShape).isHighlighted()) {
            selectedObject = ((SpeciesPatternLargeShape) deepestShape).getSpeciesPattern();
        } else {
            return;
        }
    } else {
        selectedObject = null;
        System.out.println("inside something else?");
        return;
    }
    System.out.println(selectedObject);
    boolean bDelete = false;
    boolean bAdd = false;
    popupFromShapeMenu.removeAll();
    Point mousePoint = e.getPoint();
    if (selectedObject instanceof MolecularType) {
        // rename, add
        if (selectedObject != molecularType) {
            throw new RuntimeException("The selected object from shape different from the current object");
        }
        JMenuItem renamMenuItem = new JMenuItem("Rename");
        popupFromShapeMenu.add(renamMenuItem);
        JMenuItem addMenuItem = new JMenuItem("Add " + MolecularComponent.typeName);
        // Icon icon = new MolecularTypeSmallShape(1, 4, mt, gc, mt);
        // menuItem.setIcon(icon);
        popupFromShapeMenu.add(new JSeparator());
        popupFromShapeMenu.add(addMenuItem);
        addMenuItem.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                MolecularComponent molecularComponent = molecularType.createMolecularComponent();
                molecularType.addMolecularComponent(molecularComponent);
                bioModel.getModel().getRbmModelContainer().adjustSpeciesContextPatterns(molecularType, molecularComponent);
                bioModel.getModel().getRbmModelContainer().adjustObservablesPatterns(molecularType, molecularComponent);
                bioModel.getModel().getRbmModelContainer().adjustRulesPatterns(molecularType, molecularComponent);
            // editInPlace((LargeShape)deepestShape);
            }
        });
        renamMenuItem.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                editInPlace((LargeShape) deepestShape);
            }
        });
    } else if (selectedObject instanceof MolecularComponent) {
        // move left / right / separator / rename, delete, separator, add
        String moveRightMenuText = "Move <b>" + "right" + "</b>";
        moveRightMenuText = "<html>" + moveRightMenuText + "</html>";
        JMenuItem moveRightMenuItem = new JMenuItem(moveRightMenuText);
        Icon icon = VCellIcons.moveRightIcon;
        moveRightMenuItem.setIcon(icon);
        moveRightMenuItem.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                MolecularComponent from = (MolecularComponent) selectedObject;
                List<MolecularComponent> mcList = molecularType.getComponentList();
                int fromIndex = mcList.indexOf(from);
                if (mcList.size() == fromIndex + 1) {
                    // already the last element
                    return;
                }
                int toIndex = fromIndex + 1;
                MolecularComponent to = mcList.remove(toIndex);
                mcList.add(fromIndex, to);
                molecularTypeTreeModel.populateTree();
                molecularType.firePropertyChange("entityChange", null, "bbb");
            }
        });
        popupFromShapeMenu.add(moveRightMenuItem);
        String moveLeftMenuText = "Move <b>" + "left" + "</b>";
        moveLeftMenuText = "<html>" + moveLeftMenuText + "</html>";
        JMenuItem moveLeftMenuItem = new JMenuItem(moveLeftMenuText);
        icon = VCellIcons.moveLeftIcon;
        moveLeftMenuItem.setIcon(icon);
        moveLeftMenuItem.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                MolecularComponent from = (MolecularComponent) selectedObject;
                List<MolecularComponent> mcList = molecularType.getComponentList();
                int fromIndex = mcList.indexOf(from);
                if (fromIndex == 0) {
                    // already the first element
                    return;
                }
                int toIndex = fromIndex - 1;
                MolecularComponent to = mcList.remove(toIndex);
                mcList.add(fromIndex, to);
                molecularTypeTreeModel.populateTree();
                molecularType.firePropertyChange("entityChange", null, "bbb");
            }
        });
        popupFromShapeMenu.add(moveLeftMenuItem);
        popupFromShapeMenu.add(new JSeparator());
        JMenuItem renamMenuItem = new JMenuItem("Rename");
        popupFromShapeMenu.add(renamMenuItem);
        JMenuItem addMenuItem = new JMenuItem("Add " + ComponentStateDefinition.typeName);
        JMenuItem deleteMenuItem = new JMenuItem("Delete ");
        popupFromShapeMenu.add(deleteMenuItem);
        popupFromShapeMenu.add(new JSeparator());
        popupFromShapeMenu.add(addMenuItem);
        deleteMenuItem.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                MolecularComponent mc = (MolecularComponent) selectedObject;
                // detailed verifications will be done there, to see if they are being used in reactions, species, observables
                if (!mc.getComponentStateDefinitions().isEmpty()) {
                    String[] options = { "OK" };
                    String errMsg = mc.getDisplayType() + " '<b>" + mc.getDisplayName() + "</b>' cannot be deleted because it contains explicit States.";
                    errMsg += "<br>Please delete each individual State first.";
                    errMsg += "<br><br>Detailed usage information will be provided at that time to help you decide.";
                    errMsg = "<html>" + errMsg + "</html>";
                    JOptionPane.showOptionDialog(shapePanel, errMsg, "Delete " + mc.getDisplayType(), JOptionPane.NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]);
                    return;
                }
                // we find and display component usage information to help the user decide
                Map<String, Pair<Displayable, SpeciesPattern>> usedHere = new LinkedHashMap<String, Pair<Displayable, SpeciesPattern>>();
                bioModel.getModel().getRbmModelContainer().findComponentUsage(molecularType, mc, usedHere);
                if (!usedHere.isEmpty()) {
                    String errMsg = mc.dependenciesToHtml(usedHere);
                    errMsg += "<br><br>Delete anyway?";
                    errMsg = "<html>" + errMsg + "</html>";
                    int dialogButton = JOptionPane.YES_NO_OPTION;
                    int returnCode = JOptionPane.showConfirmDialog(shapePanel, errMsg, "Delete " + mc.getDisplayType(), dialogButton);
                    if (returnCode == JOptionPane.YES_OPTION) {
                        // keep this code in sync with MolecularTypeTableModel.setValueAt
                        if (bioModel.getModel().getRbmModelContainer().delete(molecularType, mc) == true) {
                            molecularType.removeMolecularComponent(mc);
                        }
                    }
                } else {
                    if (bioModel.getModel().getRbmModelContainer().delete(molecularType, mc) == true) {
                        molecularType.removeMolecularComponent(mc);
                    }
                }
            }
        });
        addMenuItem.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                MolecularComponent mc = (MolecularComponent) selectedObject;
                ComponentStateDefinition componentStateDefinition = mc.createComponentStateDefinition();
                mc.addComponentStateDefinition(componentStateDefinition);
                bioModel.getModel().getRbmModelContainer().adjustObservablesPatterns(molecularType, mc, componentStateDefinition);
                bioModel.getModel().getRbmModelContainer().adjustRulesPatterns(molecularType, mc, componentStateDefinition);
                bioModel.getModel().getRbmModelContainer().adjustSpeciesPatterns(molecularType, mc, componentStateDefinition);
            // editInPlace((LargeShape)deepestShape);
            }
        });
        renamMenuItem.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                editInPlace((LargeShape) deepestShape);
            }
        });
    } else if (selectedObject instanceof ComponentStateDefinition) {
        // rename, delete
        JMenuItem renamMenuItem = new JMenuItem("Rename");
        popupFromShapeMenu.add(renamMenuItem);
        JMenuItem deleteMenuItem = new JMenuItem("Delete");
        popupFromShapeMenu.add(deleteMenuItem);
        deleteMenuItem.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                ComponentStateDefinition csd = (ComponentStateDefinition) selectedObject;
                // must exist, we're deleting one of its states
                MolecularComponent mc = locationContext.mcs.getMolecularComponent();
                Map<String, Pair<Displayable, SpeciesPattern>> usedHere = new LinkedHashMap<String, Pair<Displayable, SpeciesPattern>>();
                bioModel.getModel().getRbmModelContainer().findStateUsage(molecularType, mc, csd, usedHere);
                if (!usedHere.isEmpty()) {
                    String errMsg = csd.dependenciesToHtml(usedHere);
                    errMsg += "<br><br>Delete anyway?";
                    errMsg = "<html>" + errMsg + "</html>";
                    int dialogButton = JOptionPane.YES_NO_OPTION;
                    int returnCode = JOptionPane.showConfirmDialog(shapePanel, errMsg, "Delete " + ComponentStateDefinition.typeName, dialogButton);
                    if (returnCode == JOptionPane.YES_OPTION) {
                        // keep this code in sync with MolecularTypeTableModel.setValueAt
                        if (bioModel.getModel().getRbmModelContainer().delete(molecularType, mc, csd) == true) {
                            mc.deleteComponentStateDefinition(csd);
                        }
                    }
                } else {
                    if (bioModel.getModel().getRbmModelContainer().delete(molecularType, mc, csd) == true) {
                        mc.deleteComponentStateDefinition(csd);
                    }
                }
            }
        });
        renamMenuItem.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                editInPlace((LargeShape) deepestShape);
            }
        });
    }
    popupFromShapeMenu.show(e.getComponent(), mousePoint.x, mousePoint.y);
}
Also used : ActionEvent(java.awt.event.ActionEvent) SpeciesPatternLargeShape(cbit.vcell.graph.SpeciesPatternLargeShape) JSeparator(javax.swing.JSeparator) SpeciesPattern(org.vcell.model.rbm.SpeciesPattern) LinkedHashMap(java.util.LinkedHashMap) ComponentStateDefinition(org.vcell.model.rbm.ComponentStateDefinition) MolecularTypeLargeShape(cbit.vcell.graph.MolecularTypeLargeShape) MolecularComponent(org.vcell.model.rbm.MolecularComponent) JMenuItem(javax.swing.JMenuItem) MolecularComponentLargeShape(cbit.vcell.graph.MolecularComponentLargeShape) Pair(org.vcell.util.Pair) Displayable(org.vcell.util.Displayable) Point(java.awt.Point) JPopupMenu(javax.swing.JPopupMenu) Point(java.awt.Point) MolecularType(org.vcell.model.rbm.MolecularType) ActionListener(java.awt.event.ActionListener) ComponentStateLargeShape(cbit.vcell.graph.MolecularComponentLargeShape.ComponentStateLargeShape) MolecularTypeLargeShape(cbit.vcell.graph.MolecularTypeLargeShape) SpeciesPatternLargeShape(cbit.vcell.graph.SpeciesPatternLargeShape) ComponentStateLargeShape(cbit.vcell.graph.MolecularComponentLargeShape.ComponentStateLargeShape) LargeShape(cbit.vcell.graph.LargeShape) MolecularComponentLargeShape(cbit.vcell.graph.MolecularComponentLargeShape) RelationshipObject(org.vcell.relationship.RelationshipObject) BioPaxObject(org.vcell.pathway.BioPaxObject) Icon(javax.swing.Icon) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap) ActionMap(javax.swing.ActionMap) InputMap(javax.swing.InputMap)

Example 7 with MolecularComponent

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

the class MolecularTypeTableModel method checkInputValue.

@Override
public String checkInputValue(String inputValue, int row, int columnIndex) {
    String errMsg = null;
    final Column col = Column.values()[columnIndex];
    MolecularType selectedMolecularType = getValueAt(row);
    switch(col) {
        case name:
            {
                if (!inputValue.equals(TokenMangler.fixTokenStrict(inputValue))) {
                    errMsg = "'" + inputValue + "' not legal identifier, try '" + TokenMangler.fixTokenStrict(inputValue) + "'.";
                    errMsg += VCellErrorMessages.PressEscToUndo;
                    errMsg = "<html>" + errMsg + "</html>";
                    return errMsg;
                }
                inputValue = TokenMangler.fixTokenStrict(inputValue);
                MolecularType mt = getModel().getRbmModelContainer().getMolecularType(inputValue);
                if (mt != null && mt != selectedMolecularType) {
                    errMsg = mt.getDisplayType() + " '" + inputValue + "' already exists!";
                    errMsg += VCellErrorMessages.PressEscToUndo;
                    errMsg = "<html>" + errMsg + "</html>";
                    return errMsg;
                }
                break;
            }
        case bngl_pattern:
            {
                try {
                    inputValue = inputValue.trim();
                    if (inputValue.length() > 0) {
                        MolecularType mt = RbmUtils.parseMolecularType(inputValue);
                        MolecularType mt1 = getModel().getRbmModelContainer().getMolecularType(mt.getName());
                        if (mt1 != null && getRowIndex(mt1) != row) {
                            // molecular type with this name exists already on another row
                            errMsg = mt.getDisplayType() + " '" + mt.getDisplayName() + "' already exists!";
                            errMsg += VCellErrorMessages.PressEscToUndo;
                            errMsg = "<html>" + errMsg + "</html>";
                            return errMsg;
                        }
                        // need to check if any Component we try to delete is not already in use elsewhere
                        for (MolecularComponent selectedMolecularComponent : selectedMolecularType.getComponentList()) {
                            if (mt.getMolecularComponent(selectedMolecularComponent.getName()) == null) {
                                // the user tries to delete this mc
                                Map<String, Pair<Displayable, SpeciesPattern>> usedHere = new LinkedHashMap<String, Pair<Displayable, SpeciesPattern>>();
                                bioModel.getModel().getRbmModelContainer().findComponentUsage(selectedMolecularType, selectedMolecularComponent, usedHere);
                                if (!usedHere.isEmpty()) {
                                    errMsg = selectedMolecularComponent.dependenciesToHtml(usedHere);
                                    errMsg += "<br><br>Deleting and Renaming a Component can be done in the Object Properties tree below.";
                                    errMsg += VCellErrorMessages.PressEscToUndo;
                                    errMsg = "<html>" + errMsg + "</html>";
                                    return errMsg;
                                }
                            }
                        }
                        // need to check if any State we try to delete is not already in use elsewhere
                        for (MolecularComponent selectedMolecularComponent : selectedMolecularType.getComponentList()) {
                            for (ComponentStateDefinition selectedComponentStateDefinition : selectedMolecularComponent.getComponentStateDefinitions()) {
                                MolecularComponent mc = mt.getMolecularComponent(selectedMolecularComponent.getName());
                                if (mc.getComponentStateDefinition(selectedComponentStateDefinition.getName()) == null) {
                                    // new list is missing a state which was present in the original
                                    if (!getModel().getRbmModelContainer().isDeleteAllowed(selectedMolecularType, selectedMolecularComponent, selectedComponentStateDefinition)) {
                                        errMsg = "State '" + selectedComponentStateDefinition + "' cannot be deleted because it's already being used.";
                                        errMsg += "<br>Deleting and Renaming a State can be done in the Object Properties tree below.";
                                        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) Displayable(org.vcell.util.Displayable) MolecularComponent(org.vcell.model.rbm.MolecularComponent) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) SpeciesPattern(org.vcell.model.rbm.SpeciesPattern) Pair(org.vcell.util.Pair) ComponentStateDefinition(org.vcell.model.rbm.ComponentStateDefinition)

Example 8 with MolecularComponent

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

the class MolecularTypeTableModel method setValueAt.

@Override
public void setValueAt(Object value, int row, int column) {
    if (getModel() == null || value == null) {
        return;
    }
    String stringValue = ((String) value);
    stringValue = stringValue.trim();
    if (stringValue.length() == 0) {
        return;
    }
    Column col = Column.values()[column];
    try {
        MolecularType ourMt = getValueAt(row);
        switch(col) {
            case name:
                {
                    if (stringValue.equals(ADD_NEW_HERE_TEXT)) {
                        return;
                    }
                    if (ourMt == null) {
                        // new molecular type in empty row
                        getModel().getRbmModelContainer().addMolecularType(new MolecularType(stringValue, getModel()), true);
                    } else {
                        // rename it
                        ourMt.setName(stringValue);
                    }
                    fireTableRowsUpdated(row, row);
                    break;
                }
            case bngl_pattern:
                {
                    MolecularType tempMolecularType = RbmUtils.parseMolecularType(stringValue);
                    if (ourMt == null) {
                        // new
                        getModel().getRbmModelContainer().addMolecularType(tempMolecularType, true);
                    } else {
                        // change it
                        // if it had been renamed
                        ourMt.setName(tempMolecularType.getName());
                        // here we add components
                        for (MolecularComponent tempMc : tempMolecularType.getComponentList()) {
                            if (ourMt.getMolecularComponent(tempMc.getName()) == null) {
                                // component not found in the existing molecular type, it's a new component
                                // add the new component (and its states, if any)
                                ourMt.addMolecularComponent(tempMc);
                                getModel().getRbmModelContainer().adjustSpeciesContextPatterns(ourMt, tempMc);
                            } else {
                                // existing component being modified (by adding or removing states)
                                // check for new states added to the existing components
                                MolecularComponent ourMc = ourMt.getMolecularComponent(tempMc.getName());
                                for (ComponentStateDefinition tempCsd : tempMc.getComponentStateDefinitions()) {
                                    if (ourMc.getComponentStateDefinition(tempCsd.getName()) == null) {
                                        // state not found in the existing component, it's a new state
                                        ourMc.addComponentStateDefinition(tempCsd);
                                    }
                                }
                            // TODO: check for deleted states from existing components
                            }
                        }
                        // TODO: here we delete components
                        for (MolecularComponent ourMc : ourMt.getComponentList()) {
                            if (tempMolecularType.getMolecularComponent(ourMc.getName()) == null) {
                                // ATTENTION! renaming doesn't work here because we can't know the user's mind, we always consider addition + deletion here
                                if (getModel().getRbmModelContainer().delete(ourMt, ourMc) == true) {
                                    ourMt.removeMolecularComponent(ourMc);
                                }
                            }
                        }
                    }
                    fireTableRowsUpdated(row, row);
                    break;
                }
        }
    } catch (Exception e) {
        e.printStackTrace(System.out);
        DialogUtils.showErrorDialog(ownerTable, e.getMessage(), e);
    }
}
Also used : MolecularType(org.vcell.model.rbm.MolecularType) MolecularComponent(org.vcell.model.rbm.MolecularComponent) ComponentStateDefinition(org.vcell.model.rbm.ComponentStateDefinition)

Example 9 with MolecularComponent

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

the class MolecularTypeTableModel method propertyChange.

@Override
public void propertyChange(PropertyChangeEvent evt) {
    super.propertyChange(evt);
    // if (evt.getSource() == getModel().getRbmModelContainer()) {
    if (evt.getSource() == getModel()) {
        if (evt.getPropertyName().equals(RbmModelContainer.PROPERTY_NAME_MOLECULAR_TYPE_LIST)) {
            refreshData();
            List<MolecularType> oldValue = (List<MolecularType>) evt.getOldValue();
            for (MolecularType molecularType : oldValue) {
                RbmUtils.removePropertyChangeListener(molecularType, this);
            }
            List<MolecularType> newValue = (List<MolecularType>) evt.getNewValue();
            for (MolecularType molecularType : newValue) {
                RbmUtils.addPropertyChangeListener(molecularType, this);
            }
        }
        refreshData();
    // } else if (evt.getSource() == getModel().getRbmModelContainer().getNetworkConstraints()) {
    // if (evt.getPropertyName().equals(NetworkConstraints.PROPERTY_NAME_MAX_STOICHIOMETRY)) {
    // fireTableRowsUpdated(0, getRowCount() - 1);
    // }
    // refreshData();
    } else if (evt.getSource() instanceof MolecularType) {
        MolecularType mt = (MolecularType) evt.getSource();
        int changeRow = getRowIndex(mt);
        if (changeRow >= 0) {
            fireTableRowsUpdated(changeRow, changeRow);
        }
        if (evt.getPropertyName().equals(MolecularType.PROPERTY_NAME_COMPONENT_LIST)) {
            List<MolecularComponent> oldValue = (List<MolecularComponent>) evt.getOldValue();
            if (oldValue != null) {
                for (MolecularComponent molecularComponent : oldValue) {
                    RbmUtils.removePropertyChangeListener(molecularComponent, this);
                }
            }
            List<MolecularComponent> newValue = (List<MolecularComponent>) evt.getNewValue();
            if (newValue != null) {
                for (MolecularComponent molecularComponent : newValue) {
                    RbmUtils.addPropertyChangeListener(molecularComponent, this);
                }
            }
        }
        refreshData();
    } else if (evt.getSource() instanceof MolecularComponent) {
        fireTableRowsUpdated(0, getRowCount() - 1);
        if (evt.getPropertyName().equals(MolecularComponent.PROPERTY_NAME_COMPONENT_STATE_DEFINITIONS)) {
            List<ComponentStateDefinition> oldValue = (List<ComponentStateDefinition>) evt.getOldValue();
            if (oldValue != null) {
                for (ComponentStateDefinition componentState : oldValue) {
                    componentState.removePropertyChangeListener(this);
                }
            }
            List<ComponentStateDefinition> newValue = (List<ComponentStateDefinition>) evt.getNewValue();
            if (newValue != null) {
                for (ComponentStateDefinition componentState : newValue) {
                    componentState.addPropertyChangeListener(this);
                }
            }
        }
        refreshData();
    } else if (evt.getSource() instanceof ComponentStateDefinition) {
        fireTableRowsUpdated(0, getRowCount() - 1);
        refreshData();
    }
}
Also used : MolecularType(org.vcell.model.rbm.MolecularType) MolecularComponent(org.vcell.model.rbm.MolecularComponent) ArrayList(java.util.ArrayList) List(java.util.List) ComponentStateDefinition(org.vcell.model.rbm.ComponentStateDefinition)

Example 10 with MolecularComponent

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

the class MolecularTypeTreeModel method populateTree.

public void populateTree() {
    if (molecularType == null) {
        return;
    }
    rootNode.setUserObject(molecularType);
    rootNode.removeAllChildren();
    for (MolecularComponent molecularComponent : molecularType.getComponentList()) {
        BioModelNode node = createMolecularComponentNode(molecularComponent);
        rootNode.add(node);
    }
    nodeStructureChanged(rootNode);
    GuiUtils.treeExpandAllRows(ownerTree);
}
Also used : MolecularComponent(org.vcell.model.rbm.MolecularComponent) BioModelNode(cbit.vcell.desktop.BioModelNode)

Aggregations

MolecularComponent (org.vcell.model.rbm.MolecularComponent)42 ComponentStateDefinition (org.vcell.model.rbm.ComponentStateDefinition)23 MolecularType (org.vcell.model.rbm.MolecularType)23 BioModelNode (cbit.vcell.desktop.BioModelNode)17 MolecularComponentPattern (org.vcell.model.rbm.MolecularComponentPattern)14 SpeciesPattern (org.vcell.model.rbm.SpeciesPattern)11 ComponentStatePattern (org.vcell.model.rbm.ComponentStatePattern)10 MolecularTypePattern (org.vcell.model.rbm.MolecularTypePattern)10 LinkedHashMap (java.util.LinkedHashMap)7 Icon (javax.swing.Icon)7 BondType (org.vcell.model.rbm.MolecularComponentPattern.BondType)7 Point (java.awt.Point)6 List (java.util.List)6 ParticleMolecularComponent (cbit.vcell.math.ParticleMolecularComponent)5 ArrayList (java.util.ArrayList)5 RbmObservable (cbit.vcell.model.RbmObservable)4 ReactionRule (cbit.vcell.model.ReactionRule)4 Structure (cbit.vcell.model.Structure)4 Graphics (java.awt.Graphics)4 ActionEvent (java.awt.event.ActionEvent)4