Search in sources :

Example 41 with SimulationContext

use of cbit.vcell.mapping.SimulationContext in project vcell by virtualcell.

the class BioModelEditorApplicationsPanel method getJMenuAppCopyAs.

/**
 * Return the JMenuItemCopy property value.
 * @return javax.swing.JMenuItem
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private javax.swing.JMenu getJMenuAppCopyAs() {
    if (menuAppCopyAs == null) {
        try {
            menuAppCopyAs = new javax.swing.JMenu(GuiConstants.MENU_TEXT_APP_COPYAS);
            menuItemAppNonSpatialCopyStochastic = new JMenuItem(GuiConstants.MENU_TEXT_STOCHASTIC_APPLICATION);
            menuItemAppNonSpatialCopyStochastic.setActionCommand(GuiConstants.ACTIONCMD_NON_SPATIAL_COPY_TO_STOCHASTIC_APPLICATION);
            menuItemAppNonSpatialCopyStochastic.addActionListener(eventHandler);
            menuItemNonSpatialCopyDeterministic = new javax.swing.JMenuItem(GuiConstants.MENU_TEXT_DETERMINISTIC_APPLICATION);
            menuItemNonSpatialCopyDeterministic.setActionCommand(GuiConstants.ACTIONCMD_NON_SPATIAL_COPY_TO_DETERMINISTIC_APPLICATION);
            menuItemNonSpatialCopyDeterministic.addActionListener(eventHandler);
            menuItemAppNonSpatialCopyRulebased = new javax.swing.JMenuItem(GuiConstants.MENU_TEXT_RULEBASED_APPLICATION);
            menuItemAppNonSpatialCopyRulebased.setActionCommand(GuiConstants.ACTIONCMD_NON_SPATIAL_COPY_TO_RULEBASED_APPLICATION);
            menuItemAppNonSpatialCopyRulebased.addActionListener(eventHandler);
            menuAppSpatialCopyAsNonSpatial = new JMenu(GuiConstants.MENU_TEXT_NON_SPATIAL_APPLICATION);
            menuItemAppSpatialCopyAsNonSpatialDeterministic = new JMenuItem(GuiConstants.MENU_TEXT_DETERMINISTIC_APPLICATION);
            menuItemAppSpatialCopyAsNonSpatialDeterministic.setActionCommand(GuiConstants.ACTIONCMD_SPATIAL_COPY_TO_NON_SPATIAL_DETERMINISTIC_APPLICATION);
            menuItemAppSpatialCopyAsNonSpatialDeterministic.addActionListener(eventHandler);
            menuItemAppSpatialCopyAsNonSpatialStochastic = new JMenuItem(GuiConstants.MENU_TEXT_STOCHASTIC_APPLICATION);
            menuItemAppSpatialCopyAsNonSpatialStochastic.setActionCommand(GuiConstants.ACTIONCMD_SPATIAL_COPY_TO_NON_SPATIAL_STOCHASTIC_APPLICATION);
            menuItemAppSpatialCopyAsNonSpatialStochastic.addActionListener(eventHandler);
            menuAppSpatialCopyAsNonSpatial.add(menuItemAppSpatialCopyAsNonSpatialDeterministic);
            menuAppSpatialCopyAsNonSpatial.add(menuItemAppSpatialCopyAsNonSpatialStochastic);
            menuAppSpatialCopyAsSpatial = new JMenu(GuiConstants.MENU_TEXT_SPATIAL_APPLICATION);
            menuItemAppSpatialCopyAsSpatialDeterministic = new JMenuItem(GuiConstants.MENU_TEXT_DETERMINISTIC_APPLICATION);
            menuItemAppSpatialCopyAsSpatialDeterministic.setActionCommand(GuiConstants.ACTIONCMD_SPATIAL_COPY_TO_SPATIAL_DETERMINISTIC_APPLICATION);
            menuItemAppSpatialCopyAsSpatialDeterministic.addActionListener(eventHandler);
            menuItemAppSpatialCopyAsSpatialStochastic = new JMenuItem(GuiConstants.MENU_TEXT_STOCHASTIC_APPLICATION);
            menuItemAppSpatialCopyAsSpatialStochastic.setActionCommand(GuiConstants.ACTIONCMD_SPATIAL_COPY_TO_SPATIAL_STOCHASTIC_APPLICATION);
            menuItemAppSpatialCopyAsSpatialStochastic.addActionListener(eventHandler);
            menuAppSpatialCopyAsSpatial.add(menuItemAppSpatialCopyAsSpatialDeterministic);
            menuAppSpatialCopyAsSpatial.add(menuItemAppSpatialCopyAsSpatialStochastic);
        } catch (java.lang.Throwable ivjExc) {
            handleException(ivjExc);
        }
    }
    menuAppCopyAs.removeAll();
    SimulationContext selectedSimContext = getSelectedSimulationContext();
    if (selectedSimContext != null) {
        if (selectedSimContext.getGeometry().getDimension() == 0) {
            menuAppCopyAs.add(menuItemNonSpatialCopyDeterministic);
            menuAppCopyAs.add(menuItemAppNonSpatialCopyStochastic);
            menuAppCopyAs.add(menuItemAppNonSpatialCopyRulebased);
        } else {
            menuAppCopyAs.add(menuAppSpatialCopyAsNonSpatial);
            menuAppCopyAs.add(menuAppSpatialCopyAsSpatial);
        }
    }
    return menuAppCopyAs;
}
Also used : JMenuItem(javax.swing.JMenuItem) JMenu(javax.swing.JMenu) JMenuItem(javax.swing.JMenuItem) SimulationContext(cbit.vcell.mapping.SimulationContext) JMenu(javax.swing.JMenu)

Example 42 with SimulationContext

use of cbit.vcell.mapping.SimulationContext in project vcell by virtualcell.

the class BioModelEditor method setRightTopPanel.

private void setRightTopPanel(Object selectedObject, SimulationContext simulationContext) {
    JComponent newTopPanel = emptyPanel;
    // DEFAULT_DIVIDER_LOCATION;
    int dividerLocation = rightSplitPane.getDividerLocation();
    if (selectedObject instanceof Model) {
        newTopPanel = bioModelEditorModelPanel;
    } else if (selectedObject instanceof BioModel || selectedObject instanceof VCMetaData || selectedObject instanceof MiriamResource) {
        newTopPanel = bioModelPropertiesPanel;
        bioModelPropertiesPanel.setBioModel(bioModel);
    } else if (selectedObject instanceof SimulationContext) {
        newTopPanel = bioModelEditorApplicationPanel;
        bioModelEditorApplicationPanel.setSimulationContext(simulationContext);
    } else if (selectedObject instanceof DocumentEditorTreeFolderNode) {
        DocumentEditorTreeFolderNode folderNode = (DocumentEditorTreeFolderNode) selectedObject;
        DocumentEditorTreeFolderClass folderClass = folderNode.getFolderClass();
        if (folderClass == DocumentEditorTreeFolderClass.MODEL_NODE) {
            newTopPanel = bioModelEditorModelPanel;
        } else if (folderClass == DocumentEditorTreeFolderClass.STRUCTURES_NODE || folderClass == DocumentEditorTreeFolderClass.SPECIES_NODE || folderClass == DocumentEditorTreeFolderClass.MOLECULAR_TYPES_NODE || folderClass == DocumentEditorTreeFolderClass.OBSERVABLES_NODE || folderClass == DocumentEditorTreeFolderClass.REACTIONS_NODE || folderClass == DocumentEditorTreeFolderClass.REACTION_DIAGRAM_NODE) // || folderClass == DocumentEditorTreeFolderClass.STRUCTURE_DIAGRAM_NODE
        {
            newTopPanel = bioModelEditorModelPanel;
        } else if (folderClass == DocumentEditorTreeFolderClass.PATHWAY_DIAGRAM_NODE || folderClass == DocumentEditorTreeFolderClass.PATHWAY_OBJECTS_NODE || folderClass == DocumentEditorTreeFolderClass.BIOPAX_SUMMARY_NODE || folderClass == DocumentEditorTreeFolderClass.BIOPAX_TREE_NODE) {
            newTopPanel = bioModelEditorPathwayDiagramPanel;
        } else if (folderClass == DocumentEditorTreeFolderClass.PATHWAY_NODE) {
            newTopPanel = getBioModelEditorPathwayDiagramPanel();
            getBioModelEditorPathwayDiagramPanel().setBioModel(bioModel);
        } else if (folderClass == DocumentEditorTreeFolderClass.BIOMODEL_PARAMETERS_NODE) {
            newTopPanel = bioModelParametersPanel;
        } else if (folderClass == DocumentEditorTreeFolderClass.APPLICATIONS_NODE) {
            newTopPanel = bioModelEditorApplicationsPanel;
        // } else if (folderClass == DocumentEditorTreeFolderClass.DATA_NODE) {
        // newTopPanel = dataSymbolsPanel;
        } else if (folderClass == DocumentEditorTreeFolderClass.SCRIPTING_NODE) {
            newTopPanel = getScriptingPanel();
        } else if (folderClass == DocumentEditorTreeFolderClass.SPECIFICATIONS_NODE || folderClass == DocumentEditorTreeFolderClass.PROTOCOLS_NODE || folderClass == DocumentEditorTreeFolderClass.SIMULATIONS_NODE || folderClass == DocumentEditorTreeFolderClass.GEOMETRY_NODE || folderClass == DocumentEditorTreeFolderClass.PARAMETER_ESTIMATION_NODE) {
            newTopPanel = bioModelEditorApplicationPanel;
            bioModelEditorApplicationPanel.setSimulationContext(simulationContext);
        }
    }
    Component rightTopComponent = rightSplitPane.getTopComponent();
    if (rightTopComponent != newTopPanel) {
        rightSplitPane.setTopComponent(newTopPanel);
    }
    rightSplitPane.setDividerLocation(dividerLocation);
    getSimulationConsolePanel().setSimulationContext(simulationContext);
    if (simulationContext == null) {
        rightBottomTabbedPane.remove(getSimulationConsolePanel());
    } else {
        // show the console only for bionetgen deterministic applications (flattened network)
        if (simulationContext.getApplicationType() == Application.RULE_BASED_STOCHASTIC) {
            // if(simulationContext.isRuleBased() || simulationContext.isStoch()) {
            // if(simulationContext.isStoch()) {
            rightBottomTabbedPane.remove(getSimulationConsolePanel());
            return;
        }
        boolean bHasRules = simulationContext.getModel().getRbmModelContainer().hasRules();
        if (!bHasRules) {
            rightBottomTabbedPane.remove(getSimulationConsolePanel());
            return;
        }
        // rightBottomTabbedPane.addTab("Network Console", new TabCloseIcon(), getSimulationConsolePanel());
        rightBottomTabbedPane.addTab("Network Generation Status", getSimulationConsolePanel());
    }
}
Also used : VCMetaData(cbit.vcell.biomodel.meta.VCMetaData) MiriamResource(cbit.vcell.biomodel.meta.MiriamManager.MiriamResource) BioModel(cbit.vcell.biomodel.BioModel) JComponent(javax.swing.JComponent) Model(cbit.vcell.model.Model) ListSelectionModel(javax.swing.ListSelectionModel) BioModel(cbit.vcell.biomodel.BioModel) DocumentEditorTreeFolderNode(cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderNode) SimulationContext(cbit.vcell.mapping.SimulationContext) DocumentEditorTreeFolderClass(cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderClass) Component(java.awt.Component) JComponent(javax.swing.JComponent)

Example 43 with SimulationContext

use of cbit.vcell.mapping.SimulationContext in project vcell by virtualcell.

the class BioModelEditorApplicationPanel method onActiveViewChange.

@Override
protected void onActiveViewChange(ActiveView activeView) {
    super.onActiveViewChange(activeView);
    SimulationContext selectedSimContext = activeView.getSimulationContext();
    DocumentEditorTreeFolderClass folderClass = activeView.getDocumentEditorTreeFolderClass();
    if (folderClass == null) {
        return;
    }
    switch(folderClass) {
        case GEOMETRY_NODE:
            selectTab(ApplicationPanelTabID.geometry);
            break;
        case SPECIFICATIONS_NODE:
            selectTab(ApplicationPanelTabID.settings);
            break;
        case PROTOCOLS_NODE:
            selectTab(ApplicationPanelTabID.protocols);
            applicationProtocolsPanel.selectTab(activeView.getActiveViewID());
            break;
        case SIMULATIONS_NODE:
            selectTab(ApplicationPanelTabID.simulations);
            break;
        case PARAMETER_ESTIMATION_NODE:
            selectTab(ApplicationPanelTabID.parameterEstimation);
            setSelectedObjects(new Object[] { parameterEstimationPanel.getParameterEstimationTask() });
            break;
    }
}
Also used : SimulationContext(cbit.vcell.mapping.SimulationContext) DocumentEditorTreeFolderClass(cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderClass)

Example 44 with SimulationContext

use of cbit.vcell.mapping.SimulationContext in project vcell by virtualcell.

the class BioModelEditorApplicationPanel method setSimulationContext.

public void setSimulationContext(SimulationContext newValue) {
    if (simulationContext == newValue) {
        return;
    }
    final boolean respondingToSelectionManager = selectionManager.isBusy();
    final Object[] selectedObj = selectionManager.getSelectedObjects();
    SimulationContext oldValue = simulationContext;
    if (oldValue != null) {
        oldValue.removePropertyChangeListener(eventHandler);
    }
    if (newValue != null) {
        newValue.addPropertyChangeListener(eventHandler);
    }
    simulationContext = newValue;
    AsynchClientTask task1 = new AsynchClientTask("loading application", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

        @Override
        public void run(Hashtable<String, Object> hashTable) throws Exception {
            simulationContext.getGeometry().precomputeAll(new GeometryThumbnailImageFactoryAWT());
        }
    };
    AsynchClientTask task2 = new AsynchClientTask("showing application", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

        @Override
        public void run(Hashtable<String, Object> hashTable) throws Exception {
            applicationGeometryPanel.setSimulationContext(simulationContext);
            applicationSpecificationsPanel.setSimulationContext(simulationContext);
            applicationProtocolsPanel.setSimulationContext(simulationContext);
            applicationSimulationsPanel.setSimulationContext(simulationContext);
            parameterEstimationPanel.setSelectionManager(null);
            showOrHideFittingPanel();
            parameterEstimationPanel.setSelectionManager(selectionManager);
            if (respondingToSelectionManager) {
                selectionManager.setSelectedObjects(new Object[0]);
                selectionManager.setSelectedObjects(selectedObj);
            }
        }
    };
    ClientTaskDispatcher.dispatch(this, new Hashtable<String, Object>(), new AsynchClientTask[] { task1, task2 });
}
Also used : GeometryThumbnailImageFactoryAWT(cbit.vcell.geometry.GeometryThumbnailImageFactoryAWT) AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) Hashtable(java.util.Hashtable) SimulationContext(cbit.vcell.mapping.SimulationContext)

Example 45 with SimulationContext

use of cbit.vcell.mapping.SimulationContext in project vcell by virtualcell.

the class BioModelEditorApplicationsTableModel method bioModelChange.

@Override
protected void bioModelChange(PropertyChangeEvent evt) {
    super.bioModelChange(evt);
    BioModel oldValue = (BioModel) evt.getOldValue();
    if (oldValue != null) {
        for (SimulationContext simulationContext : oldValue.getSimulationContexts()) {
            simulationContext.removePropertyChangeListener(this);
        }
    }
    BioModel newValue = (BioModel) evt.getNewValue();
    if (newValue != null) {
        for (SimulationContext simulationContext : newValue.getSimulationContexts()) {
            simulationContext.addPropertyChangeListener(this);
        }
    }
}
Also used : BioModel(cbit.vcell.biomodel.BioModel) SimulationContext(cbit.vcell.mapping.SimulationContext)

Aggregations

SimulationContext (cbit.vcell.mapping.SimulationContext)217 BioModel (cbit.vcell.biomodel.BioModel)98 Simulation (cbit.vcell.solver.Simulation)64 MathDescription (cbit.vcell.math.MathDescription)35 Model (cbit.vcell.model.Model)35 PropertyVetoException (java.beans.PropertyVetoException)35 Expression (cbit.vcell.parser.Expression)34 MathModel (cbit.vcell.mathmodel.MathModel)33 ExpressionException (cbit.vcell.parser.ExpressionException)32 Geometry (cbit.vcell.geometry.Geometry)31 XmlParseException (cbit.vcell.xml.XmlParseException)31 ArrayList (java.util.ArrayList)31 IOException (java.io.IOException)29 XMLSource (cbit.vcell.xml.XMLSource)28 DataAccessException (org.vcell.util.DataAccessException)27 SpeciesContextSpec (cbit.vcell.mapping.SpeciesContextSpec)26 KeyValue (org.vcell.util.document.KeyValue)26 SpeciesContext (cbit.vcell.model.SpeciesContext)24 Structure (cbit.vcell.model.Structure)23 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)22