use of cbit.vcell.client.ChildWindowManager.ChildWindow in project vcell by virtualcell.
the class PDEDataViewer method showSpatialPlot.
/**
* Comment
*/
private void showSpatialPlot() {
// check selections
final SpatialSelection[] sl = getPDEDataContextPanel1().fetchSpatialSelections(false, true);
if (sl == null) {
PopupGenerator.showErrorDialog(this, "Nothing selected!");
return;
}
for (int i = 0; i < sl.length; i++) {
if (sl[i].isPoint()) {
PopupGenerator.showErrorDialog(this, "One or more selections are single points - no spatial plot will be produced for those selections");
break;
}
}
final String varName = getPdeDataContext().getVariableName();
final double timePoint = getPdeDataContext().getTimePoint();
final SymbolTableEntry[] symbolTableEntries = new SymbolTableEntry[1];
if (getSimulation() != null && getSimulation().getMathDescription() != null) {
symbolTableEntries[0] = getSimulation().getMathDescription().getEntry(varName);
}
if (symbolTableEntries[0] == null) {
// TODO domain
Domain domain = null;
symbolTableEntries[0] = new VolVariable(varName, domain);
}
AsynchClientTask task1 = new AsynchClientTask("Retrieving spatial series for variable '" + varName, AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
// get plots, ignoring points
PlotData[] plotDatas = new PlotData[sl.length];
for (int i = 0; i < sl.length; i++) {
PlotData plotData = null;
if (getPdeDataContext() instanceof PDEDataViewerPostProcess.PostProcessDataPDEDataContext) {
SpatialSelectionVolume ssVolume = (SpatialSelectionVolume) sl[i];
SpatialSelection.SSHelper ssvHelper = ssVolume.getIndexSamples(0.0, 1.0);
ssvHelper.initializeValues_VOLUME(getPdeDataContext().getDataValues());
double[] values = ssvHelper.getSampledValues();
plotData = new PlotData(ssvHelper.getWorldCoordinateLengths(), values);
} else {
plotData = getPdeDataContext().getLineScan(varName, timePoint, sl[i]);
}
plotDatas[i] = plotData;
}
hashTable.put("plotDatas", plotDatas);
}
};
AsynchClientTask task2 = new AsynchClientTask("Showing spatial plot for variable" + varName, AsynchClientTask.TASKTYPE_SWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
PlotData[] plotDatas = (PlotData[]) hashTable.get("plotDatas");
for (PlotData plotData : plotDatas) {
if (plotData != null) {
PlotPane plotPane = new PlotPane();
Plot2D plot2D = new Plot2D(symbolTableEntries, getSimulationModelInfo().getDataSymbolMetadataResolver(), new String[] { varName }, new PlotData[] { plotData }, new String[] { "Values along curve", "Distance (\u00b5m)", "[" + varName + "]" });
plotPane.setPlot2D(plot2D);
String title = createContextTitle(PDEDataViewer.this.isPostProcess(), "Spatial Plot:'" + varName + "' ", getPdeDataContext(), getSimulationModelInfo(), getSimulation());
ChildWindowManager childWindowManager = ChildWindowManager.findChildWindowManager(PDEDataViewer.this);
ChildWindow childWindow = childWindowManager.addChildWindow(plotPane, plotPane, title);
childWindow.setIsCenteredOnParent();
childWindow.pack();
childWindow.show();
// System.out.println("Spatial plot requesting focus. Result is: "+childWindow.requestFocusInWindow());
}
}
}
};
ClientTaskDispatcher.dispatch(this, new Hashtable<String, Object>(), new AsynchClientTask[] { task1, task2 }, false);
}
use of cbit.vcell.client.ChildWindowManager.ChildWindow in project vcell by virtualcell.
the class PDEDataViewerPostProcess method activatePanel.
public void activatePanel(boolean bActivate) {
ChildWindowManager childWindowManager = ChildWindowManager.findChildWindowManager(postProcessPDEDataViewer);
ChildWindow[] childwindows = childWindowManager.getAllChildWindows();
for (int i = 0; i < childwindows.length; i++) {
if (childwindows[i].getTitle().startsWith(PDEDataViewer.POST_PROCESS_PREFIX)) {
// System.out.println("showing "+childwindows[i].getTitle()+" "+childwindows[i].getContentPane().getClass().getName());
if (bActivate) {
childwindows[i].show();
} else {
childwindows[i].hide();
}
}
}
if (bActivate) {
update();
}
}
use of cbit.vcell.client.ChildWindowManager.ChildWindow in project vcell by virtualcell.
the class ReturnBNGOutput method validateConstraints.
private void validateConstraints(BNGOutputSpec outputSpec) {
ValidateConstraintsPanel panel = new ValidateConstraintsPanel(owner);
ChildWindowManager childWindowManager = ChildWindowManager.findChildWindowManager(owner);
ChildWindow childWindow = childWindowManager.addChildWindow(panel, panel, "Apply the new constraints?");
// 320, 160 without the warning line
Dimension dim = new Dimension(376, 163);
childWindow.pack();
panel.setChildWindow(childWindow);
childWindow.setPreferredSize(dim);
childWindow.showModal();
if (panel.getButtonPushed() == ValidateConstraintsPanel.ActionButtons.Apply) {
System.out.println("pressed APPLY from task");
TaskCallbackMessage tcm = new TaskCallbackMessage(TaskCallbackStatus.TaskEndAdjustSimulationContextFlagsOnly, "");
owner.setNewCallbackMessage(tcm);
String string = "Updating the network constraints with the test values.";
System.out.println(string);
owner.updateOutputSpecToSimulationContext(outputSpec);
sc.getNetworkConstraints().updateConstraintsFromTest();
tcm = new TaskCallbackMessage(TaskCallbackStatus.Notification, string);
sc.firePropertyChange("appendToConsole", "", tcm);
return;
} else {
System.out.println("pressed CANCEL from task");
owner.updateOutputSpecToSimulationContext(null);
TaskCallbackMessage tcm = new TaskCallbackMessage(TaskCallbackStatus.Clean, "");
sc.appendToConsole(tcm);
String string = "The Network constraints were not updated with the test values.";
tcm = new TaskCallbackMessage(TaskCallbackStatus.Notification, string);
sc.firePropertyChange("appendToConsole", "", tcm);
// owner.refreshInterface();
return;
}
}
use of cbit.vcell.client.ChildWindowManager.ChildWindow in project vcell by virtualcell.
the class BioModelWindowManager method closeMIRIAMWindow.
private void closeMIRIAMWindow() {
ChildWindowManager childWindowManager = ChildWindowManager.findChildWindowManager(getJPanel());
ChildWindow childWindow = childWindowManager.getChildWindowFromContext(MIRIAM_WINDOW);
if (childWindow != null) {
childWindow.close();
}
}
use of cbit.vcell.client.ChildWindowManager.ChildWindow in project vcell by virtualcell.
the class BioModelWindowManager method updateSimulationDataViewers.
/**
* Insert the method's description here.
* Creation date: (7/20/2004 1:13:06 PM)
*/
private void updateSimulationDataViewers(ApplicationComponents appComponents, SimulationContext found) {
SimulationWindow[] simWindows = appComponents.getSimulationWindows();
Simulation[] sims = found.getSimulations();
Hashtable<VCSimulationIdentifier, Simulation> hash = new Hashtable<VCSimulationIdentifier, Simulation>();
for (int i = 0; i < sims.length; i++) {
SimulationInfo simInfo = sims[i].getSimulationInfo();
if (simInfo != null) {
VCSimulationIdentifier vcSimulationIdentifier = simInfo.getAuthoritativeVCSimulationIdentifier();
hash.put(vcSimulationIdentifier, sims[i]);
}
}
for (int i = 0; i < simWindows.length; i++) {
SimulationWindow sw = simWindows[i];
if (hash.containsKey(simWindows[i].getVcSimulationIdentifier())) {
sw.resetSimulation((Simulation) hash.get(sw.getVcSimulationIdentifier()));
} else if (sw.isShowingLocalSimulation()) {
sw.setLocalState(LocalState.LOCAL_SIMMODFIED);
} else {
ChildWindowManager childWindowManager = ChildWindowManager.findChildWindowManager(getJPanel());
ChildWindow childWindow = childWindowManager.getChildWindowFromContext(sw);
if (childWindow != null) {
childWindowManager.closeChildWindow(childWindow);
}
}
}
}
Aggregations