use of cbit.vcell.mapping.ReactionRuleSpec in project vcell by virtualcell.
the class ReactionRuleSpecPropertiesPanel method onSelectedObjectsChange.
@Override
protected void onSelectedObjectsChange(Object[] selectedObjects) {
ReactionRuleSpec reactionRuleSpec = null;
if (selectedObjects != null && selectedObjects.length == 1 && selectedObjects[0] instanceof ReactionRuleSpec) {
reactionRuleSpec = (ReactionRuleSpec) selectedObjects[0];
}
setReactionRule(reactionRuleSpec);
}
use of cbit.vcell.mapping.ReactionRuleSpec in project vcell by virtualcell.
the class ModelProcessSpecsTableModel method setSimulationContext.
/**
* Sets the simulationContext property (cbit.vcell.mapping.SimulationContext) value.
* @param simulationContext The new value for the property.
* @see #getSimulationContext
*/
public void setSimulationContext(SimulationContext simulationContext) {
SimulationContext oldValue = fieldSimulationContext;
if (oldValue != null) {
oldValue.removePropertyChangeListener(this);
ReactionContext reactionContext = oldValue.getReactionContext();
reactionContext.removePropertyChangeListener(this);
ReactionSpec[] oldReactionSpecs = reactionContext.getReactionSpecs();
for (int i = 0; i < oldReactionSpecs.length; i++) {
oldReactionSpecs[i].getReactionStep().removePropertyChangeListener(this);
oldReactionSpecs[i].removePropertyChangeListener(this);
}
ReactionRuleSpec[] oldReactionRuleSpecs = reactionContext.getReactionRuleSpecs();
for (int i = 0; i < oldReactionRuleSpecs.length; i++) {
oldReactionRuleSpecs[i].getReactionRule().removePropertyChangeListener(this);
oldReactionRuleSpecs[i].removePropertyChangeListener(this);
}
}
fieldSimulationContext = simulationContext;
refreshColumns();
if (simulationContext != null) {
simulationContext.addPropertyChangeListener(this);
ReactionContext reactionContext = fieldSimulationContext.getReactionContext();
reactionContext.addPropertyChangeListener(this);
ReactionSpec[] newReactionSpecs = reactionContext.getReactionSpecs();
for (int i = 0; i < newReactionSpecs.length; i++) {
newReactionSpecs[i].getReactionStep().addPropertyChangeListener(this);
newReactionSpecs[i].addPropertyChangeListener(this);
}
ReactionRuleSpec[] newReactionRuleSpecs = reactionContext.getReactionRuleSpecs();
for (int i = 0; i < newReactionRuleSpecs.length; i++) {
newReactionRuleSpecs[i].getReactionRule().addPropertyChangeListener(this);
newReactionRuleSpecs[i].addPropertyChangeListener(this);
}
}
firePropertyChange("simulationContext", oldValue, simulationContext);
}
use of cbit.vcell.mapping.ReactionRuleSpec in project vcell by virtualcell.
the class BioModelEditor method setRightBottomPanelOnSelection.
@Override
protected void setRightBottomPanelOnSelection(Object[] selections) {
if (selections == null) {
return;
}
// TODO: here
JComponent bottomComponent = rightBottomEmptyPanel;
JComponent annotationComponent = rightBottomEmptyAnnotationsPanel;
// properties panel
int destComponentIndex = DocumentEditorTabID.object_properties.ordinal();
// annotations panel
int annComponentIndex = DocumentEditorTabID.annotations.ordinal();
boolean bShowInDatabaseProperties = false;
boolean bShowPathway = false;
if (selections.length == 1) {
annotationComponent = getAnnotationsPanel();
Object singleSelection = selections[0];
if (singleSelection instanceof ReactionStep) {
bottomComponent = getReactionPropertiesPanel();
} else if (singleSelection instanceof ReactionRule) {
bottomComponent = getReactionRulePropertiesPanel();
} else if (singleSelection instanceof SpeciesContext) {
bottomComponent = getSpeciesPropertiesPanel();
} else if (singleSelection instanceof MolecularType) {
bottomComponent = getMolecularTypePropertiesPanel();
} else if (singleSelection instanceof RbmObservable) {
bottomComponent = getObservablePropertiesPanel();
} else if (singleSelection instanceof Structure) {
bottomComponent = getStructurePropertiesPanel();
getStructurePropertiesPanel().setModel(bioModel.getModel());
} else if (singleSelection instanceof Parameter) {
bottomComponent = getParameterPropertiesPanel();
} else if (singleSelection instanceof SimulationContext) {
bottomComponent = getApplicationPropertiesPanel();
} else if (singleSelection instanceof ParameterEstimationTask) {
bottomComponent = parameterEstimationTaskPropertiesPanel;
} else if (singleSelection instanceof Product || singleSelection instanceof Reactant) {
bottomComponent = getReactionParticipantPropertiesPanel();
} else if (singleSelection instanceof BioModelNode.PublicationInfoNode) {
bShowInDatabaseProperties = true;
bottomComponent = bioModelMetaDataPanel;
} else if (singleSelection instanceof BioModelInfo) {
bShowInDatabaseProperties = true;
bottomComponent = bioModelMetaDataPanel;
} else if (singleSelection instanceof MathModelInfo) {
bShowInDatabaseProperties = true;
bottomComponent = mathModelMetaDataPanel;
} else if (singleSelection instanceof GeometryInfo) {
bShowInDatabaseProperties = true;
bottomComponent = geometryMetaDataPanel;
} else if (singleSelection instanceof SpeciesContextSpec) {
bottomComponent = getSpeciesContextSpecPanel();
} else if (singleSelection instanceof ReactionSpec) {
bottomComponent = getKineticsTypeTemplatePanel();
} else if (singleSelection instanceof ReactionRuleSpec) {
//
bottomComponent = getReactionRuleSpecPropertiesPanel();
} else if (singleSelection instanceof BioModelsNetModelInfo) {
bShowInDatabaseProperties = true;
bottomComponent = getBioModelsNetPropertiesPanel();
} else if (singleSelection instanceof Simulation) {
bottomComponent = getSimulationSummaryPanel();
} else if (singleSelection instanceof DataSymbol) {
bottomComponent = getDataSymbolsSpecPanel();
} else if (singleSelection instanceof BioEvent) {
bottomComponent = getEventPanel();
} else if (singleSelection instanceof SpatialObject) {
bottomComponent = getSpatialObjectPropertyPanel();
} else if (singleSelection instanceof SpatialProcess) {
bottomComponent = getSpatialProcessPropertyPanel();
} else if (singleSelection instanceof BioPaxObject) {
bottomComponent = bioPaxObjectPropertiesPanel;
} else if (singleSelection instanceof BioModel) {
// only contains Notes, is displayed in the Object Properties Panel
bottomComponent = bioModelEditorAnnotationPanel;
} else if (singleSelection instanceof VCMetaData) {
bottomComponent = bioModelEditorAnnotationPanel;
} else if (singleSelection instanceof PathwayData) {
bShowPathway = true;
bottomComponent = getBioModelEditorPathwayPanel();
} else if (singleSelection instanceof Model) {
} else if (singleSelection instanceof RuleParticipantSignature) {
bottomComponent = getReactionRuleParticipantSignaturePropertiesPanel();
} else if (singleSelection instanceof CSGObject) {
bottomComponent = csgObjectPropertiesPanel;
csgObjectPropertiesPanel.setSimulationContext(getSelectedSimulationContext());
} else if (singleSelection instanceof DocumentEditorTreeFolderNode) {
DocumentEditorTreeFolderClass folderClass = ((DocumentEditorTreeFolderNode) singleSelection).getFolderClass();
if ((folderClass == DocumentEditorTreeFolderClass.REACTIONS_NODE) && !(singleSelection instanceof ReactionRule)) {
bottomComponent = getReactionPropertiesPanel();
} else if ((folderClass == DocumentEditorTreeFolderClass.REACTIONS_NODE) && (singleSelection instanceof ReactionRule)) {
bottomComponent = getReactionRulePropertiesPanel();
} else if (folderClass == DocumentEditorTreeFolderClass.STRUCTURES_NODE) {
bottomComponent = getStructurePropertiesPanel();
} else if (folderClass == DocumentEditorTreeFolderClass.SPECIES_NODE) {
bottomComponent = getSpeciesPropertiesPanel();
} else if (folderClass == DocumentEditorTreeFolderClass.MOLECULAR_TYPES_NODE) {
bottomComponent = getMolecularTypePropertiesPanel();
} else if (folderClass == DocumentEditorTreeFolderClass.OBSERVABLES_NODE) {
bottomComponent = getObservablePropertiesPanel();
} else if (folderClass == DocumentEditorTreeFolderClass.APPLICATIONS_NODE) {
bottomComponent = getApplicationsPropertiesPanel();
getApplicationsPropertiesPanel().setBioModel(bioModel);
} else if (folderClass == DocumentEditorTreeFolderClass.PARAMETER_ESTIMATION_NODE) {
bottomComponent = parameterEstimationTaskPropertiesPanel;
}
} else if (singleSelection instanceof SelectionManager.AnnotationNavigator) {
Object entity = ((SelectionManager.AnnotationNavigator) singleSelection).getEntity();
if (entity instanceof ReactionStep) {
bottomComponent = getReactionPropertiesPanel();
} else if (entity instanceof SpeciesContext) {
bottomComponent = getSpeciesPropertiesPanel();
} else if (entity instanceof Structure) {
// Observables. MolecularType, Structures
bottomComponent = getStructurePropertiesPanel();
} else if (entity instanceof MolecularType) {
bottomComponent = getMolecularTypePropertiesPanel();
} else if (entity instanceof RbmObservable) {
bottomComponent = getObservablePropertiesPanel();
} else {
bottomComponent = bioModelEditorAnnotationPanel;
}
}
}
if (bShowPathway) {
int numTabs = rightBottomTabbedPane.getTabCount();
for (destComponentIndex = 0; destComponentIndex < numTabs; destComponentIndex++) {
Component current = rightBottomTabbedPane.getComponentAt(destComponentIndex);
if (current == bottomComponent) {
break;
}
}
String tabTitle = "Pathway Preview";
if (rightBottomTabbedPane.getTabCount() == destComponentIndex) {
rightBottomTabbedPane.addTab(tabTitle, new TabCloseIcon(), bottomComponent);
}
} else if (bShowInDatabaseProperties) {
for (destComponentIndex = 0; destComponentIndex < rightBottomTabbedPane.getTabCount(); destComponentIndex++) {
Component c = rightBottomTabbedPane.getComponentAt(destComponentIndex);
if (c == bioModelMetaDataPanel || c == mathModelMetaDataPanel || c == geometryMetaDataPanel || c == getBioModelsNetPropertiesPanel()) {
break;
}
}
if (rightBottomTabbedPane.getTabCount() == destComponentIndex) {
rightBottomTabbedPane.addTab(DATABASE_PROPERTIES_TAB_TITLE, new TabCloseIcon(), bottomComponent);
}
}
if (rightBottomTabbedPane.getComponentAt(destComponentIndex) != bottomComponent) {
bottomComponent.setBorder(GuiConstants.TAB_PANEL_BORDER);
annotationComponent.setBorder(GuiConstants.TAB_PANEL_BORDER);
rightBottomTabbedPane.setComponentAt(destComponentIndex, bottomComponent);
rightBottomTabbedPane.setComponentAt(annComponentIndex, annotationComponent);
rightSplitPane.repaint();
}
Component selectedComponent = rightBottomTabbedPane.getSelectedComponent();
if (selections.length == 1 && selections[0] instanceof BioModel && bottomComponent instanceof BioModelEditorAnnotationPanel) {
// if the biomodel name is selected in the upper left tree, we select the Annotations tab
rightBottomTabbedPane.setSelectedComponent(annotationComponent);
} else if (selections.length == 1 && selections[0] instanceof SelectionManager.AnnotationNavigator && selections[0] instanceof SelectionManager.AnnotationNavigator) {
// we want to navigate to the AnnotationPanel
rightBottomTabbedPane.setSelectedComponent(annotationComponent);
// } else if(selections.length == 1 && selections[0] instanceof SelectionManager.AnnotationNavigator && bottomComponent instanceof BioModelEditorAnnotationPanel) {
// // we want to navigate to the AnnotationPanel (old way)
// rightBottomTabbedPane.setSelectedComponent(annotationComponent);
} else if (selectedComponent != bottomComponent) /* && rightBottomTabbedPane.getSelectedComponent() != annotationComponent */
{
rightBottomTabbedPane.setSelectedComponent(bottomComponent);
}
}
use of cbit.vcell.mapping.ReactionRuleSpec in project vcell by virtualcell.
the class RbmNetworkGenerator method writeReactions.
public static void writeReactions(PrintWriter writer, RbmModelContainer rbmModelContainer, SimulationContext sc, boolean applyApplicationFilters, CompartmentMode compartmentMode) {
writer.println(BEGIN_REACTIONS);
List<ReactionRule> reactionList = rbmModelContainer.getReactionRuleList();
for (ReactionRule rr : reactionList) {
if (applyApplicationFilters && sc != null) {
ReactionRuleSpec rrs = sc.getReactionContext().getReactionRuleSpec(rr);
if (rrs != null && rrs.isExcluded()) {
// we skip those rules which are disabled (excluded)
continue;
}
}
writer.println(RbmUtils.toBnglStringLong(rr, compartmentMode));
}
writer.println(END_REACTIONS);
writer.println();
}
use of cbit.vcell.mapping.ReactionRuleSpec in project vcell by virtualcell.
the class RbmNetworkGenerator method writeReactions_internal.
private static void writeReactions_internal(PrintWriter writer, SimulationContext sc, CompartmentMode compartmentMode) {
writer.println(BEGIN_REACTIONS);
for (ReactionRuleSpec rrSpec : sc.getReactionContext().getReactionRuleSpecs()) {
if (rrSpec.isExcluded()) {
// we skip those rules which are disabled (excluded)
continue;
}
writer.println(RbmUtils.toBnglStringLong_internal(rrSpec.getReactionRule(), compartmentMode));
}
writer.println(END_REACTIONS);
writer.println();
}
Aggregations