Search in sources :

Example 1 with ApplicationComponents

use of cbit.vcell.client.desktop.biomodel.ApplicationComponents in project vcell by virtualcell.

the class BioModelWindowManager method updateApplicationHash.

/**
 * Insert the method's description here.
 * Creation date: (6/1/2004 2:33:41 AM)
 */
private void updateApplicationHash(boolean reset) {
    SimulationContext[] scs = getBioModel().getSimulationContexts();
    Enumeration<SimulationContext> en = getApplicationsHash().keys();
    while (en.hasMoreElements()) {
        SimulationContext sc = (SimulationContext) en.nextElement();
        ApplicationComponents appComponents = getApplicationsHash().get(sc);
        if (!getBioModel().contains(sc)) {
            if (reset) {
                // find one with the same name, if available
                SimulationContext found = null;
                if (scs != null) {
                    for (int i = 0; i < scs.length; i++) {
                        if (scs[i].getName().equals(sc.getName())) {
                            found = scs[i];
                            break;
                        }
                    }
                }
                if (found != null) {
                    // update hash
                    getApplicationsHash().remove(sc);
                    getApplicationsHash().put(found, appComponents);
                    appComponents.resetSimulationContext(found);
                    // check simulation data windows
                    updateSimulationDataViewers(appComponents, found);
                    // rewire listener
                    sc.removePropertyChangeListener(this);
                    found.removePropertyChangeListener(this);
                    found.addPropertyChangeListener(this);
                } else {
                    // we didn't find one, so remove from hash and close all of its windows
                    remove(appComponents, sc);
                }
            } else {
                // shouldn't have it
                remove(appComponents, sc);
            }
        }
    }
}
Also used : ApplicationComponents(cbit.vcell.client.desktop.biomodel.ApplicationComponents) SimulationContext(cbit.vcell.mapping.SimulationContext)

Example 2 with ApplicationComponents

use of cbit.vcell.client.desktop.biomodel.ApplicationComponents in project vcell by virtualcell.

the class BioModelWindowManager method createAppComponents.

/**
 * create components
 */
private void createAppComponents(SimulationContext simContext) {
    ApplicationComponents appComponents = new ApplicationComponents(simContext, this);
    getApplicationsHash().put(simContext, appComponents);
    // register for events
    simContext.addPropertyChangeListener(this);
// appComponents.getAppEditor().addActionListener(this);
// appComponents.getGeometrySummaryViewer().addActionListener(this);
}
Also used : ApplicationComponents(cbit.vcell.client.desktop.biomodel.ApplicationComponents)

Example 3 with ApplicationComponents

use of cbit.vcell.client.desktop.biomodel.ApplicationComponents in project vcell by virtualcell.

the class BioModelWindowManager method addResultsFrame.

/**
 * Insert the method's description here.
 * Creation date: (6/11/2004 7:32:07 AM)
 * @param newDocument cbit.vcell.document.VCDocument
 */
public void addResultsFrame(SimulationWindow simWindow) {
    ApplicationComponents appComponents = getApplicationsHash().get(simWindow.getSimOwner());
    appComponents.addDataViewer(simWindow);
    ChildWindowManager childWindowManager = ChildWindowManager.findChildWindowManager(getJPanel());
    ChildWindow childWindow = childWindowManager.getChildWindowFromContext(simWindow);
    if (childWindow == null) {
        childWindow = childWindowManager.addChildWindow(simWindow.getDataViewer(), simWindow);
        simWindow.setChildWindow(childWindow);
        childWindow.setIsCenteredOnParent();
        childWindow.pack();
    }
    childWindow.show();
}
Also used : ApplicationComponents(cbit.vcell.client.desktop.biomodel.ApplicationComponents) ChildWindow(cbit.vcell.client.ChildWindowManager.ChildWindow)

Example 4 with ApplicationComponents

use of cbit.vcell.client.desktop.biomodel.ApplicationComponents in project vcell by virtualcell.

the class BioModelWindowManager method propertyChange.

/**
 * This method gets called when a bound property is changed.
 * @param evt A PropertyChangeEvent object describing the event source
 *   	and the property that has changed.
 */
public void propertyChange(java.beans.PropertyChangeEvent evt) {
    if (evt.getSource() == getBioModel() && evt.getPropertyName().equals("simulationContexts")) {
        // close any window we should not have anymore
        updateApplicationHash(false);
    }
    if (evt.getSource() == getBioModel() && evt.getPropertyName().equals("simulations")) {
        // close any window we should not have anymore
        Enumeration<SimulationContext> en = getApplicationsHash().keys();
        while (en.hasMoreElements()) {
            SimulationContext sc = (SimulationContext) en.nextElement();
            ApplicationComponents appComponents = getApplicationsHash().get(sc);
            updateSimulationDataViewers(appComponents, sc);
            appComponents.cleanSimWindowsHash();
        }
    }
}
Also used : ApplicationComponents(cbit.vcell.client.desktop.biomodel.ApplicationComponents) SimulationContext(cbit.vcell.mapping.SimulationContext)

Example 5 with ApplicationComponents

use of cbit.vcell.client.desktop.biomodel.ApplicationComponents in project vcell by virtualcell.

the class BioModelWindowManager method simStatusChanged.

/**
 * Insert the method's description here.
 * Creation date: (6/9/2004 3:58:21 PM)
 * @param newJobStatus cbit.vcell.messaging.db.SimulationJobStatus
 * @param progress java.lang.Double
 * @param timePoint java.lang.Double
 */
public void simStatusChanged(SimStatusEvent simStatusEvent) {
    // ** events are only generated from server side job statuses **
    KeyValue simKey = simStatusEvent.getVCSimulationIdentifier().getSimulationKey();
    // do we have the sim?
    Simulation[] sims = getBioModel().getSimulations();
    if (sims == null) {
        // we don't have it
        return;
    }
    Simulation simulation = null;
    for (int i = 0; i < sims.length; i++) {
        if (sims[i].getSimulationInfo() != null && simKey.equals(sims[i].getSimulationInfo().getAuthoritativeVCSimulationIdentifier().getSimulationKey())) {
            simulation = sims[i];
            break;
        }
    }
    if (simulation == null) {
        // we don't have it
        return;
    }
    // we have it; get current server side status
    SimulationStatus simStatus = getRequestManager().getServerSimulationStatus(simulation.getSimulationInfo());
    // if failed, notify
    if (simStatusEvent.isNewFailureEvent()) {
        String qualifier = "";
        if (simulation.getScanCount() > 1) {
            qualifier += "One job from ";
        }
        PopupGenerator.showErrorDialog(this, qualifier + "Simulation '" + simulation.getName() + "' failed\n" + simStatus.getDetails());
    }
    // was the gui on it ever opened?
    SimulationContext simContext = null;
    simulation = null;
    Enumeration<SimulationContext> en = getApplicationsHash().keys();
    while (en.hasMoreElements()) {
        SimulationContext sc = (SimulationContext) en.nextElement();
        sims = sc.getSimulations();
        if (sims != null) {
        }
        for (int i = 0; i < sims.length; i++) {
            if (sims[i].getSimulationInfo() != null && simKey.equals(sims[i].getSimulationInfo().getAuthoritativeVCSimulationIdentifier().getSimulationKey())) {
                simulation = sims[i];
                break;
            }
        }
        if (simulation != null) {
            simContext = sc;
            break;
        }
    }
    if (simulation == null || simContext == null) {
        return;
    }
    // the gui was opened, update status display
    ApplicationComponents appComponents = (ApplicationComponents) getApplicationsHash().get(simContext);
    ClientSimManager simManager = appComponents.getSimulationWorkspace().getClientSimManager();
    simManager.updateStatusFromServer(simulation);
    // is there new data?
    if (simStatusEvent.isNewDataEvent()) {
        fireNewData(new DataEvent(this, new VCSimulationDataIdentifier(simulation.getSimulationInfo().getAuthoritativeVCSimulationIdentifier(), simStatusEvent.getJobIndex())));
    }
}
Also used : KeyValue(org.vcell.util.document.KeyValue) Simulation(cbit.vcell.solver.Simulation) SimulationStatus(cbit.vcell.server.SimulationStatus) ApplicationComponents(cbit.vcell.client.desktop.biomodel.ApplicationComponents) DataEvent(cbit.vcell.simdata.DataEvent) SimulationContext(cbit.vcell.mapping.SimulationContext) VCSimulationDataIdentifier(cbit.vcell.solver.VCSimulationDataIdentifier)

Aggregations

ApplicationComponents (cbit.vcell.client.desktop.biomodel.ApplicationComponents)6 SimulationContext (cbit.vcell.mapping.SimulationContext)3 ChildWindow (cbit.vcell.client.ChildWindowManager.ChildWindow)1 SimulationWindow (cbit.vcell.client.desktop.simulation.SimulationWindow)1 SimulationStatus (cbit.vcell.server.SimulationStatus)1 DataEvent (cbit.vcell.simdata.DataEvent)1 Simulation (cbit.vcell.solver.Simulation)1 VCSimulationDataIdentifier (cbit.vcell.solver.VCSimulationDataIdentifier)1 KeyValue (org.vcell.util.document.KeyValue)1