Skip to content

Commit

Permalink
Merge pull request #1117 from virtualcell/dan-ss-molecule-edit
Browse files Browse the repository at this point in the history
Editing or adding a new molecule / species is now properly addressed in existing SS application
  • Loading branch information
danv61 authored Jan 29, 2024
2 parents 3ea8f19 + 5ceb8ca commit 28bbcfb
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,7 @@ public void actionPerformed(ActionEvent e) {
fieldSpeciesContext.setSpeciesPattern(sp);
}
fieldSpeciesContext.getSpeciesPattern().addMolecularTypePattern(molecularTypePattern);
fieldSpeciesContext.firePropertyChange(SpeciesContext.PROPERTY_NAME_SPECIES_PATTERN_CHANGED, null, fieldSpeciesContext);
}
});
}
Expand Down
10 changes: 10 additions & 0 deletions vcell-core/src/main/java/cbit/vcell/mapping/ReactionContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ public void propertyChange(java.beans.PropertyChangeEvent evt) {
if (evt.getSource().equals(getModel()) && evt.getPropertyName().equals(RbmModelContainer.PROPERTY_NAME_REACTION_RULE_LIST)){
refreshAll();
}
if(evt.getSource().equals(getModel()) && evt.getPropertyName().equals(Model.PROPERTY_NAME_SPECIES_CONTEXT_SPECIES_PATTERN)) {
refreshSpeciesContextSpecsSpeciesPatterns(); // only for springsalad, because we care about the sites (site attributes spec, internal link spec)
}
if (evt.getSource().equals(getModel()) && evt.getPropertyName().equals(RbmModelContainer.PROPERTY_NAME_MOLECULAR_TYPE_LIST)){
; // do nothing
}
Expand Down Expand Up @@ -618,6 +621,13 @@ private void refreshSpeciesContextSpecs() throws MappingException {
}
}
}
private void refreshSpeciesContextSpecsSpeciesPatterns() {
if(Application.SPRINGSALAD == simContext.getApplicationType()) {
for(SpeciesContextSpec scs : fieldSpeciesContextSpecs) {
scs.initializeForSpringSaLaD(null);
}
}
}
private void refreshSpeciesContextSpecs(MolecularType mt) {
if(Application.SPRINGSALAD == simContext.getApplicationType()) {
for(SpeciesContextSpec scs : fieldSpeciesContextSpecs) {
Expand Down
7 changes: 7 additions & 0 deletions vcell-core/src/main/java/cbit/vcell/model/Model.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public static interface Owner {
public static final String PROPERTY_NAME_SPECIES_CONTEXTS = "speciesContexts";
private static final String PROPERTY_NAME_SPECIES = "species";
public static final String PROPERTY_NAME_MODEL_ENTITY_NAME = "modelEntityName";
public static final String PROPERTY_NAME_SPECIES_CONTEXT_SPECIES_PATTERN = "speciesContextSpeciesPattern";

public static final String PROPERTY_NAME_RATERULEVARIABLES = "rateruleVariables";

Expand Down Expand Up @@ -3302,6 +3303,7 @@ public void propertyChange(java.beans.PropertyChangeEvent evt){
fieldDiagrams[i].renameNode((String) evt.getOldValue(), (String) evt.getNewValue());
}
}

if(evt.getSource() instanceof ReactionStep && evt.getPropertyName().equals("name")){
for(int i = 0; i < fieldDiagrams.length; i++){
fieldDiagrams[i].renameNode((String) evt.getOldValue(), (String) evt.getNewValue());
Expand Down Expand Up @@ -3358,6 +3360,11 @@ public void propertyChange(java.beans.PropertyChangeEvent evt){
}
}

if(evt.getSource() instanceof SpeciesContext && evt.getPropertyName().equals(SpeciesContext.PROPERTY_NAME_SPECIES_PATTERN_CHANGED)) {
System.out.println("Model: SpeciesContext test event: " + evt.getPropertyName());
firePropertyChange(PROPERTY_NAME_SPECIES_CONTEXT_SPECIES_PATTERN, evt.getOldValue(), evt.getNewValue());
}

if((evt.getSource() instanceof ModelParameter ||
evt.getSource() instanceof SpeciesContext ||
evt.getSource() instanceof StructureSize)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ public class SpeciesContext implements Cacheable, Matchable, Relatable, Editable

private String speciesPatternString = null;

public static final String PROPERTY_NAME_SPECIES_PATTERN = "speciesPattern";
public static final String PROPERTY_NAME_SPECIES_PATTERN = "speciesPattern"; // fired with an empty sp, not very useful
public static final String PROPERTY_NAME_SPECIES_PATTERN_CHANGED = "speciesPatternChanged";

// store SBML unit for speciesContext from SBML species.
// private transient VCUnitDefinition sbmlSpeciesUnit = null;
Expand Down

0 comments on commit 28bbcfb

Please sign in to comment.