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");
}
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);
}
}
}
Aggregations