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);
}
}
}
}
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);
}
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();
}
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();
}
}
}
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())));
}
}
Aggregations