Search in sources :

Example 6 with ReactionRuleParticipant

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

the class ReactionRulePropertiesTreeModel method populateTree.

public void populateTree() {
    if (reactionRule == null) {
        // this may be legit, for example when there's a plain reaction rather than a reaction rule
        System.out.println("ReactionRulePropertiesTreeModel: reactionRule is null.");
        return;
    }
    if (bioModel == null) {
        System.out.println("ReactionRulePropertiesTreeModel: bioModel is null.");
        return;
    }
    rootNode.setUserObject(reactionRule);
    rootNode.removeAllChildren();
    int count = 0;
    List<? extends ReactionRuleParticipant> patterns = participantType == ReactionRuleParticipantType.Reactant ? reactionRule.getReactantPatterns() : reactionRule.getProductPatterns();
    for (ReactionRuleParticipant rrp : patterns) {
        BioModelNode rrNode = new BioModelNode(new ReactionRuleParticipantLocal(participantType, rrp, ++count));
        for (MolecularTypePattern mtp : rrp.getSpeciesPattern().getMolecularTypePatterns()) {
            BioModelNode node = createMolecularTypePatternNode(mtp);
            rrNode.add(node);
        }
        rootNode.add(rrNode);
    }
    nodeStructureChanged(rootNode);
    // GuiUtils.treeExpandAll(ownerTree, rootNode, true);
    GuiUtils.treeExpandAllRows(ownerTree);
    // we fire a dummy event because the species properties panel and the bio model editor species table model
    // will repaint the shape and respectively the table row for any speciesContext property change event
    reactionRule.firePropertyChange("entityChange", null, "bbb");
}
Also used : ReactionRuleParticipant(cbit.vcell.model.ReactionRuleParticipant) BioModelNode(cbit.vcell.desktop.BioModelNode) MolecularTypePattern(org.vcell.model.rbm.MolecularTypePattern)

Example 7 with ReactionRuleParticipant

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

the class ReactionRulePropertiesTreeModel method setReactionRule.

public void setReactionRule(ReactionRule newValue) {
    if (newValue == reactionRule) {
        return;
    }
    ReactionRule oldValue = reactionRule;
    if (oldValue != null) {
        oldValue.removePropertyChangeListener(this);
        List<? extends ReactionRuleParticipant> patterns = participantType == ReactionRuleParticipantType.Reactant ? oldValue.getReactantPatterns() : oldValue.getProductPatterns();
        for (ReactionRuleParticipant rrp : patterns) {
            RbmUtils.removePropertyChangeListener(rrp.getSpeciesPattern(), this);
        }
    }
    reactionRule = newValue;
    populateTree();
    if (newValue != null) {
        newValue.addPropertyChangeListener(this);
        List<? extends ReactionRuleParticipant> patterns = participantType == ReactionRuleParticipantType.Reactant ? newValue.getReactantPatterns() : newValue.getProductPatterns();
        for (ReactionRuleParticipant rrp : patterns) {
            RbmUtils.addPropertyChangeListener(rrp.getSpeciesPattern(), this);
        }
    }
}
Also used : ReactionRule(cbit.vcell.model.ReactionRule) ReactionRuleParticipant(cbit.vcell.model.ReactionRuleParticipant)

Aggregations

ReactionRuleParticipant (cbit.vcell.model.ReactionRuleParticipant)7 ReactionRule (cbit.vcell.model.ReactionRule)5 ArrayList (java.util.ArrayList)3 GraphEvent (cbit.gui.graph.GraphEvent)2 Shape (cbit.gui.graph.Shape)2 BioModelNode (cbit.vcell.desktop.BioModelNode)2 Catalyst (cbit.vcell.model.Catalyst)2 Diagram (cbit.vcell.model.Diagram)2 Feature (cbit.vcell.model.Feature)2 FluxReaction (cbit.vcell.model.FluxReaction)2 Membrane (cbit.vcell.model.Membrane)2 Product (cbit.vcell.model.Product)2 ProductPattern (cbit.vcell.model.ProductPattern)2 Reactant (cbit.vcell.model.Reactant)2 ReactantPattern (cbit.vcell.model.ReactantPattern)2 ReactionParticipant (cbit.vcell.model.ReactionParticipant)2 ReactionStep (cbit.vcell.model.ReactionStep)2 RuleParticipantLongSignature (cbit.vcell.model.RuleParticipantLongSignature)2 RuleParticipantShortSignature (cbit.vcell.model.RuleParticipantShortSignature)2 RuleParticipantSignature (cbit.vcell.model.RuleParticipantSignature)2