Search in sources :

Example 1 with DataEvent

use of cbit.vcell.simdata.DataEvent in project vcell by virtualcell.

the class MathModelWindowManager method simStatusChanged.

/**
 * Insert the method's description here.
 * Creation date: (5/14/2004 11:08:35 AM)
 * @param newMathModel cbit.vcell.mathmodel.MathModel
 */
// private void setMathModel(MathModel newMathModel) {
// resetGeometryListeners((getMathModel() != null?(getMathModel().getMathDescription() != null?getMathModel().getMathDescription().getGeometry():null):null),
// (newMathModel != null?(newMathModel.getMathDescription() != null?newMathModel.getMathDescription().getGeometry():null):null));
// 
// resetMathDescriptionListeners(
// (getMathModel() != null?getMathModel().getMathDescription():null),
// (newMathModel != null?newMathModel.getMathDescription():null));
// if (getMathModel() != null) {
// getMathModel().removePropertyChangeListener(this);
// }
// mathModel = newMathModel;
// if (getMathModel() != null) {
// getMathModel().addPropertyChangeListener(this);
// }
// }
// private void resetMathDescriptionListeners(MathDescription oldMathDescription,MathDescription newMathDescription){
// if(oldMathDescription != null){
// oldMathDescription.removePropertyChangeListener(this);
// }
// if(newMathDescription != null){
// newMathDescription.addPropertyChangeListener(this);
// }
// }
// /**
// * Insert the method's description here.
// * Creation date: (6/14/2004 10:55:40 PM)
// * @param newDocument cbit.vcell.document.VCDocument
// */
// private void showDataViewerPlotsFrame(final javax.swing.JInternalFrame plotFrame) {
// dataViewerPlotsFramesVector.add(plotFrame);
// showFrame(plotFrame);
// plotFrame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter() {
// public void internalFrameClosing(javax.swing.event.InternalFrameEvent e) {
// dataViewerPlotsFramesVector.remove(plotFrame);
// }
// });
// }
// /**
// * Insert the method's description here.
// * Creation date: (6/14/2004 10:55:40 PM)
// * @param newDocument cbit.vcell.document.VCDocument
// */
// public void showDataViewerPlotsFrames(javax.swing.JInternalFrame[] plotFrames) {
// for (int i = 0; i < plotFrames.length; i++){
// showDataViewerPlotsFrame(plotFrames[i]);
// }
// }
/**
 * 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 = getMathModel().getSimulations();
    if (sims == null) {
        // we don't have it
        return;
    }
    Simulation simulation = null;
    for (int i = 0; i < sims.length; i++) {
        if (simKey.equals(sims[i].getKey()) || ((sims[i].getSimulationVersion() != null) && simKey.equals(sims[i].getSimulationVersion().getParentSimulationReference()))) {
            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());
    }
    // update status display
    ClientSimManager simManager = simulationWorkspace.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) DataEvent(cbit.vcell.simdata.DataEvent) VCSimulationDataIdentifier(cbit.vcell.solver.VCSimulationDataIdentifier)

Example 2 with DataEvent

use of cbit.vcell.simdata.DataEvent 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

SimulationStatus (cbit.vcell.server.SimulationStatus)2 DataEvent (cbit.vcell.simdata.DataEvent)2 Simulation (cbit.vcell.solver.Simulation)2 VCSimulationDataIdentifier (cbit.vcell.solver.VCSimulationDataIdentifier)2 KeyValue (org.vcell.util.document.KeyValue)2 ApplicationComponents (cbit.vcell.client.desktop.biomodel.ApplicationComponents)1 SimulationContext (cbit.vcell.mapping.SimulationContext)1