use of org.vcell.model.rbm.ComponentStateDefinition in project vcell by virtualcell.
the class ObservableTreeModel method propertyChange.
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName().equals(PropertyConstants.PROPERTY_NAME_NAME)) {
nodeChanged(rootNode);
} else if (evt.getSource() == observable && evt.getPropertyName().equals(RbmObservable.PROPERTY_NAME_TYPE)) {
nodeChanged(rootNode);
} else if (evt.getPropertyName().equals("entityChange")) {
nodeChanged(rootNode);
} else {
populateTree();
Object source = evt.getSource();
if (source == observable) {
if (evt.getPropertyName().equals(RbmObservable.PROPERTY_NAME_SPECIES_PATTERN_LIST)) {
List<SpeciesPattern> oldValue = (List<SpeciesPattern>) evt.getOldValue();
if (oldValue != null) {
for (SpeciesPattern sp : oldValue) {
RbmUtils.removePropertyChangeListener(sp, this);
}
}
List<SpeciesPattern> newValue = (List<SpeciesPattern>) evt.getNewValue();
if (newValue != null) {
for (SpeciesPattern sp : newValue) {
RbmUtils.addPropertyChangeListener(sp, this);
}
}
} else if (evt.getPropertyName().equals(RbmObservable.PROPERTY_NAME_SPECIES_PATTERN)) {
SpeciesPattern newValue = (SpeciesPattern) evt.getNewValue();
if (newValue != null) {
RbmUtils.addPropertyChangeListener(newValue, this);
}
}
} else if (source instanceof SpeciesPattern) {
if (evt.getPropertyName().equals(SpeciesPattern.PROPERTY_NAME_MOLECULAR_TYPE_PATTERNS)) {
List<MolecularTypePattern> oldValue = (List<MolecularTypePattern>) evt.getOldValue();
if (oldValue != null) {
for (MolecularTypePattern mtp : oldValue) {
RbmUtils.removePropertyChangeListener(mtp, this);
}
}
List<MolecularTypePattern> newValue = (List<MolecularTypePattern>) evt.getNewValue();
if (newValue != null) {
for (MolecularTypePattern mtp : newValue) {
RbmUtils.addPropertyChangeListener(mtp, this);
}
}
}
} else if (source instanceof MolecularTypePattern) {
if (evt.getPropertyName().equals(MolecularTypePattern.PROPERTY_NAME_COMPONENT_PATTERN_LIST)) {
List<MolecularComponentPattern> oldValue = (List<MolecularComponentPattern>) evt.getOldValue();
if (oldValue != null) {
for (MolecularComponentPattern mcp : oldValue) {
RbmUtils.removePropertyChangeListener(mcp, this);
}
}
List<MolecularComponentPattern> newValue = (List<MolecularComponentPattern>) evt.getNewValue();
if (newValue != null) {
for (MolecularComponentPattern mcp : newValue) {
RbmUtils.addPropertyChangeListener(mcp, this);
}
}
}
} else if (source instanceof MolecularComponentPattern) {
if (evt.getSource().equals(MolecularComponentPattern.PROPERTY_NAME_COMPONENT_STATE)) {
ComponentStateDefinition oldValue = (ComponentStateDefinition) evt.getOldValue();
if (oldValue != null) {
oldValue.removePropertyChangeListener(this);
}
ComponentStateDefinition newValue = (ComponentStateDefinition) evt.getNewValue();
if (newValue != null) {
newValue.addPropertyChangeListener(this);
}
}
}
}
}
use of org.vcell.model.rbm.ComponentStateDefinition in project vcell by virtualcell.
the class MolecularTypeTreeModel method createMolecularComponentNode.
private BioModelNode createMolecularComponentNode(MolecularComponent molecularComponent) {
BioModelNode node = new BioModelNode(molecularComponent, true);
for (ComponentStateDefinition componentState : molecularComponent.getComponentStateDefinitions()) {
BioModelNode n = new BioModelNode(componentState, false);
node.add(n);
}
return node;
}
use of org.vcell.model.rbm.ComponentStateDefinition in project vcell by virtualcell.
the class MolecularTypeTreeModel method setMolecularType.
public void setMolecularType(MolecularType newValue) {
if (newValue == molecularType) {
return;
}
MolecularType oldValue = molecularType;
if (oldValue != null) {
oldValue.removePropertyChangeListener(this);
for (MolecularComponent molecularComponent : oldValue.getComponentList()) {
molecularComponent.removePropertyChangeListener(this);
for (ComponentStateDefinition componentState : molecularComponent.getComponentStateDefinitions()) {
componentState.removePropertyChangeListener(this);
}
}
}
molecularType = newValue;
populateTree();
if (newValue != null) {
newValue.addPropertyChangeListener(this);
for (MolecularComponent molecularComponent : newValue.getComponentList()) {
molecularComponent.addPropertyChangeListener(this);
for (ComponentStateDefinition componentState : molecularComponent.getComponentStateDefinitions()) {
componentState.addPropertyChangeListener(this);
}
}
}
}
use of org.vcell.model.rbm.ComponentStateDefinition in project vcell by virtualcell.
the class ObservableTableModel method propertyChange.
@Override
public void propertyChange(PropertyChangeEvent evt) {
super.propertyChange(evt);
Object source = evt.getSource();
// if (source == getModel().getRbmModelContainer()) {
if (source == getModel()) {
if (evt.getPropertyName().equals(RbmModelContainer.PROPERTY_NAME_OBSERVABLE_LIST)) {
refreshData();
List<RbmObservable> oldValue = (List<RbmObservable>) evt.getOldValue();
if (oldValue != null) {
for (RbmObservable observable : oldValue) {
observable.removePropertyChangeListener(this);
SpeciesPattern speciesPattern = observable.getSpeciesPattern(0);
RbmUtils.removePropertyChangeListener(speciesPattern, this);
}
}
List<RbmObservable> newValue = (List<RbmObservable>) evt.getNewValue();
if (newValue != null) {
for (RbmObservable observable : newValue) {
observable.addPropertyChangeListener(this);
SpeciesPattern speciesPattern = observable.getSpeciesPattern(0);
RbmUtils.addPropertyChangeListener(speciesPattern, this);
}
}
} else if (evt.getPropertyName().equals(RbmModelContainer.PROPERTY_NAME_MOLECULAR_TYPE_LIST)) {
// we need this?
refreshData();
}
} else if (source instanceof RbmObservable) {
RbmObservable mt = (RbmObservable) source;
int changeRow = getRowIndex(mt);
if (changeRow >= 0) {
fireTableRowsUpdated(changeRow, changeRow);
}
// if (evt.getPropertyName().equals(RbmObservable.PROPERTY_NAME_SPECIES_PATTERN_LIST)) {
// SpeciesPattern oldValue = (SpeciesPattern) evt.getOldValue();
// if (oldValue != null) {
// RbmUtils.removePropertyChangeListener(oldValue, this);
// }
// SpeciesPattern newValue = (SpeciesPattern) evt.getNewValue();
// if (newValue != null) {
// RbmUtils.addPropertyChangeListener(newValue, this);
// }
// }
} else if (source instanceof SpeciesPattern) {
fireTableRowsUpdated(0, getRowCount() - 1);
if (evt.getPropertyName().equals(SpeciesPattern.PROPERTY_NAME_MOLECULAR_TYPE_PATTERNS)) {
List<MolecularTypePattern> oldValue = (List<MolecularTypePattern>) evt.getOldValue();
if (oldValue != null) {
for (MolecularTypePattern mtp : oldValue) {
RbmUtils.removePropertyChangeListener(mtp, this);
}
}
List<MolecularTypePattern> newValue = (List<MolecularTypePattern>) evt.getNewValue();
if (newValue != null) {
for (MolecularTypePattern mtp : newValue) {
RbmUtils.addPropertyChangeListener(mtp, this);
}
}
}
} else if (source instanceof MolecularTypePattern) {
fireTableRowsUpdated(0, getRowCount() - 1);
if (evt.getPropertyName().equals(MolecularTypePattern.PROPERTY_NAME_COMPONENT_PATTERN_LIST)) {
List<MolecularComponentPattern> oldValue = (List<MolecularComponentPattern>) evt.getOldValue();
if (oldValue != null) {
for (MolecularComponentPattern mcp : oldValue) {
RbmUtils.removePropertyChangeListener(mcp, this);
}
}
List<MolecularComponentPattern> newValue = (List<MolecularComponentPattern>) evt.getNewValue();
if (newValue != null) {
for (MolecularComponentPattern mcp : newValue) {
RbmUtils.addPropertyChangeListener(mcp, this);
}
}
}
} else if (source instanceof MolecularComponentPattern) {
fireTableRowsUpdated(0, getRowCount() - 1);
if (source.equals(MolecularComponentPattern.PROPERTY_NAME_COMPONENT_STATE)) {
ComponentStateDefinition oldValue = (ComponentStateDefinition) evt.getOldValue();
if (oldValue != null) {
oldValue.removePropertyChangeListener(this);
}
ComponentStateDefinition newValue = (ComponentStateDefinition) evt.getNewValue();
if (newValue != null) {
newValue.addPropertyChangeListener(this);
}
}
} else if (evt.getSource() instanceof MolecularComponent) {
fireTableRowsUpdated(0, getRowCount() - 1);
} else if (evt.getSource() instanceof ComponentStateDefinition) {
fireTableRowsUpdated(0, getRowCount() - 1);
}
// updateStructureComboBox();
}
use of org.vcell.model.rbm.ComponentStateDefinition in project vcell by virtualcell.
the class ReactionRuleEditorPropertiesPanel method reflectStateToProduct.
private void reflectStateToProduct(MolecularComponentPattern mcpReactant, ComponentStatePattern cspReactant) {
MolecularTypePattern mtpReactant = reactionRule.getReactantMoleculeOfComponent(mcpReactant);
MolecularTypePattern mtpProduct = reactionRule.getMatchingProductMolecule(mtpReactant);
if (mtpProduct == null) {
return;
}
for (MolecularComponentPattern mcpProduct : mtpProduct.getComponentPatternList()) {
if (mcpProduct.getMolecularComponent() != mcpReactant.getMolecularComponent()) {
continue;
}
// use this if isAny
ComponentStatePattern csp = new ComponentStatePattern();
if (!cspReactant.isAny()) {
ComponentStateDefinition csd = cspReactant.getComponentStateDefinition();
csp = new ComponentStatePattern(csd);
}
mcpProduct.setComponentStatePattern(csp);
}
}
Aggregations