Skip to content

Commit

Permalink
If reaction annotations have content show it in the Properties Panel.
Browse files Browse the repository at this point in the history
Notify the ReactionPropertiesPanel when a change has been done to the
reaction in the AnnotationsPanel (added, removed, modified, etc)
  • Loading branch information
danv61 committed Sep 28, 2020
1 parent ae62536 commit 21160a1
Showing 1 changed file with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
import cbit.vcell.model.RbmObservable;
import cbit.vcell.model.ReactionRule;
import cbit.vcell.model.ReactionStep;
import cbit.vcell.model.SimpleReaction;
import cbit.vcell.model.Species;
import cbit.vcell.model.SpeciesContext;
import cbit.vcell.model.Structure;
Expand Down Expand Up @@ -782,10 +783,18 @@ private void changeTextAnnotation() {

if(textAreaStr == null || textAreaStr.isEmpty() || emptyHtmlText.equals(textAreaStr)) { // no annotation now, the field is empty
bioModel.getVCMetaData().deleteFreeTextAnnotation(entity); // delete, if there's something previously saved
if(selectedObject instanceof SimpleReaction) {
// we tell ReactionPropertiesPanel to refresh the annotation icon
((SimpleReaction) selectedObject).firePropertyChange("addIdentifier", false, true);
}
} else if(!Compare.isEqualOrNull(oldText,textAreaStr)) { // some text annotation different from what's already saved
bioModel.getVCMetaData().setFreeTextAnnotation(entity, textAreaStr); // overwrite
if(selectedObject instanceof SimpleReaction) {
// we tell ReactionPropertiesPanel to refresh the text annotation icon
((SimpleReaction) selectedObject).firePropertyChange("addIdentifier", false, true);
}
}
} catch(Exception e){
} catch(Exception e) {
e.printStackTrace(System.out);
PopupGenerator.showErrorDialog(this,"Annotation Error\n"+e.getMessage(), e);
}
Expand All @@ -797,6 +806,9 @@ private void removeText() {
Identifiable entity = getIdentifiable(selectedObject);
annotationTextArea.setText(null);
bioModel.getVCMetaData().deleteFreeTextAnnotation(entity); // delete, if there's something previously saved
if(selectedObject instanceof SimpleReaction) {
((SimpleReaction) selectedObject).firePropertyChange("addIdentifier", false, true);
}
}

public void setBioModel(BioModel newValue) {
Expand Down Expand Up @@ -928,6 +940,10 @@ private void addIdentifier() {
miriamManager.addMiriamRefGroup(entity, qualifier, miriamResources);
// System.out.println(vcMetaData.printRdfStatements());
updateInterface();
if(selectedObject instanceof SimpleReaction) {
// we tell ReactionPropertiesPanel to refresh the annotation icon
((SimpleReaction) selectedObject).firePropertyChange("addIdentifier", false, true);
}
} catch (Exception e) {
e.printStackTrace();
DialogUtils.showErrorDialog(this,"Add Identifier failed:\n"+e.getMessage(), e);
Expand Down Expand Up @@ -963,6 +979,9 @@ private void removeIdentifier() {
}
if(found == true) {
updateInterface();
if(selectedObject instanceof SimpleReaction) {
((SimpleReaction) selectedObject).firePropertyChange("addIdentifier", true, false);
}
break;
}
}
Expand Down

0 comments on commit 21160a1

Please sign in to comment.