Search in sources :

Example 1 with BioModelWindowManager

use of cbit.vcell.client.BioModelWindowManager in project vcell by virtualcell.

the class NetworkFreePanel method createModel.

private void createModel() {
    DocumentWindow dw = (DocumentWindow) BeanUtils.findTypeParentOfComponent(this, DocumentWindow.class);
    BioModelWindowManager bmwm = (BioModelWindowManager) (dw.getTopLevelWindowManager());
    RequestManager rm = dw.getTopLevelWindowManager().getRequestManager();
    rm.createBioModelFromApplication(bmwm, "Test", fieldSimulationContext);
}
Also used : DocumentWindow(cbit.vcell.client.desktop.DocumentWindow) RequestManager(cbit.vcell.client.RequestManager) BioModelWindowManager(cbit.vcell.client.BioModelWindowManager)

Example 2 with BioModelWindowManager

use of cbit.vcell.client.BioModelWindowManager in project vcell by virtualcell.

the class ApplicationSimulationsPanel method setBioModelWindowManager.

@Override
public void setBioModelWindowManager(BioModelWindowManager newValue) {
    super.setBioModelWindowManager(newValue);
    BioModelWindowManager oldValue = bioModelWindowManager;
    if (oldValue != null) {
        mathematicsPanel.removeActionListener(bioModelWindowManager);
    }
    bioModelWindowManager = newValue;
    if (newValue != null) {
        mathematicsPanel.addActionListener(newValue);
    }
}
Also used : BioModelWindowManager(cbit.vcell.client.BioModelWindowManager)

Example 3 with BioModelWindowManager

use of cbit.vcell.client.BioModelWindowManager in project vcell by virtualcell.

the class NetworkConstraintsPanel method createModel.

private void createModel() {
    if (!checkBnglRequirements()) {
        return;
    }
    DocumentWindow dw = (DocumentWindow) BeanUtils.findTypeParentOfComponent(this, DocumentWindow.class);
    BioModelWindowManager bmwm = (BioModelWindowManager) (dw.getTopLevelWindowManager());
    RequestManager rm = dw.getTopLevelWindowManager().getRequestManager();
    rm.createBioModelFromApplication(bmwm, "Test", fieldSimulationContext);
}
Also used : DocumentWindow(cbit.vcell.client.desktop.DocumentWindow) RequestManager(cbit.vcell.client.RequestManager) BioModelWindowManager(cbit.vcell.client.BioModelWindowManager)

Example 4 with BioModelWindowManager

use of cbit.vcell.client.BioModelWindowManager in project vcell by virtualcell.

the class VCellClientDataServiceImpl method getSimsFromOpenModels.

@Override
public List<SimulationDataSetRef> getSimsFromOpenModels() {
    ArrayList<SimulationDataSetRef> simulationDataSetRefs = new ArrayList<SimulationDataSetRef>();
    for (TopLevelWindowManager windowManager : vcellClient.getMdiManager().getWindowManagers()) {
        Simulation[] simulations = null;
        VCDocument modelDocument = null;
        if (windowManager instanceof BioModelWindowManager) {
            BioModelWindowManager selectedBioWindowManager = (BioModelWindowManager) windowManager;
            BioModel bioModel = selectedBioWindowManager.getBioModel();
            simulations = bioModel.getSimulations();
            modelDocument = bioModel;
        // simOwnerCount = bioModel.getNumSimulationContexts();
        } else if (windowManager instanceof MathModelWindowManager) {
            MathModelWindowManager selectedMathWindowManager = (MathModelWindowManager) windowManager;
            MathModel mathModel = selectedMathWindowManager.getMathModel();
            simulations = mathModel.getSimulations();
            modelDocument = mathModel;
        // simOwnerCount = 1;
        }
        if (simulations != null) {
            for (Simulation simulation : simulations) {
                if (!isVtkSupported(simulation)) {
                    continue;
                }
                Origin origin = simulation.getMathDescription().getGeometry().getOrigin();
                Extent extent = simulation.getMathDescription().getGeometry().getExtent();
                SimulationInfo simInfo = simulation.getSimulationInfo();
                SimulationStatus simStatus = vcellClient.getRequestManager().getServerSimulationStatus(simInfo);
                for (int jobIndex = 0; jobIndex < simulation.getScanCount(); jobIndex++) {
                    if (simStatus != null && simStatus.getHasData()) {
                        SimulationDataSetRef simulationDataSetReference = VCellClientDataServiceImpl.createSimulationDataSetRef(simulation, modelDocument, jobIndex, false);
                        simulationDataSetRefs.add(simulationDataSetReference);
                    }
                }
            }
        }
    }
    File localSimDir = ResourceUtil.getLocalSimDir(User.tempUser.getName());
    String[] simtaskFilenames = localSimDir.list((dir, name) -> (name.endsWith(".simtask.xml")));
    for (String simtaskFilename : simtaskFilenames) {
        try {
            SimulationTask simTask = XmlHelper.XMLToSimTask(org.apache.commons.io.FileUtils.readFileToString(new File(localSimDir, simtaskFilename)));
            VCDocument modelDocument = null;
            SimulationDataSetRef simulationDataSetReference = VCellClientDataServiceImpl.createSimulationDataSetRef(simTask.getSimulation(), modelDocument, simTask.getSimulationJob().getJobIndex(), true);
            simulationDataSetRefs.add(simulationDataSetReference);
        } catch (ExpressionException | XmlParseException | IOException e) {
            e.printStackTrace();
        }
    }
    return simulationDataSetRefs;
}
Also used : Origin(org.vcell.util.Origin) MathModel(cbit.vcell.mathmodel.MathModel) SimulationTask(cbit.vcell.messaging.server.SimulationTask) VCDocument(org.vcell.util.document.VCDocument) TopLevelWindowManager(cbit.vcell.client.TopLevelWindowManager) Extent(org.vcell.util.Extent) ArrayList(java.util.ArrayList) XmlParseException(cbit.vcell.xml.XmlParseException) IOException(java.io.IOException) SimulationDataSetRef(cbit.vcell.client.pyvcellproxy.SimulationDataSetRef) MathModelWindowManager(cbit.vcell.client.MathModelWindowManager) ExpressionException(cbit.vcell.parser.ExpressionException) Simulation(cbit.vcell.solver.Simulation) BioModelWindowManager(cbit.vcell.client.BioModelWindowManager) SimulationStatus(cbit.vcell.server.SimulationStatus) BioModel(cbit.vcell.biomodel.BioModel) File(java.io.File) SimulationInfo(cbit.vcell.solver.SimulationInfo)

Example 5 with BioModelWindowManager

use of cbit.vcell.client.BioModelWindowManager in project vcell by virtualcell.

the class DocumentWindow method getJMenuItemMIRIAM.

/**
 * This method initializes jMenuItemMIRIAM
 *
 * @return javax.swing.JMenuItem
 */
private JMenuItem getJMenuItemMIRIAM() {
    if (jMenuItemMIRIAM == null) {
        jMenuItemMIRIAM = new JMenuItem();
        jMenuItemMIRIAM.setText("Model Annotation ...");
        jMenuItemMIRIAM.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent e) {
                if (getTopLevelWindowManager() instanceof BioModelWindowManager) {
                    ((BioModelWindowManager) getTopLevelWindowManager()).showMIRIAMWindow();
                } else {
                    PopupGenerator.showInfoDialog(DocumentWindow.this, "Sorry, Currently only BioModels have a MIRIAM editor.");
                }
            }
        });
    }
    return jMenuItemMIRIAM;
}
Also used : ActionListener(java.awt.event.ActionListener) BioModelWindowManager(cbit.vcell.client.BioModelWindowManager) JMenuItem(javax.swing.JMenuItem) ActionEvent(java.awt.event.ActionEvent)

Aggregations

BioModelWindowManager (cbit.vcell.client.BioModelWindowManager)5 RequestManager (cbit.vcell.client.RequestManager)2 DocumentWindow (cbit.vcell.client.desktop.DocumentWindow)2 BioModel (cbit.vcell.biomodel.BioModel)1 MathModelWindowManager (cbit.vcell.client.MathModelWindowManager)1 TopLevelWindowManager (cbit.vcell.client.TopLevelWindowManager)1 SimulationDataSetRef (cbit.vcell.client.pyvcellproxy.SimulationDataSetRef)1 MathModel (cbit.vcell.mathmodel.MathModel)1 SimulationTask (cbit.vcell.messaging.server.SimulationTask)1 ExpressionException (cbit.vcell.parser.ExpressionException)1 SimulationStatus (cbit.vcell.server.SimulationStatus)1 Simulation (cbit.vcell.solver.Simulation)1 SimulationInfo (cbit.vcell.solver.SimulationInfo)1 XmlParseException (cbit.vcell.xml.XmlParseException)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 File (java.io.File)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 JMenuItem (javax.swing.JMenuItem)1