use of cbit.vcell.simdata.ClientPDEDataContext in project vcell by virtualcell.
the class FRAPStudyPanel method showMovie.
private void showMovie() {
AsynchClientTask createMovieTask = new AsynchClientTask("Buffering movie data...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
FRAPStudy fStudy = getFrapWorkspace().getWorkingFrapStudy();
if (fStudy == null) {
return;
}
if (fStudy.getMovieURLString() != null && fStudy.getMovieFileString() != null) {
hashTable.put("FrapStudy", fStudy);
return;
}
// create export specs
Simulation sim = null;
if (fStudy.getBioModel() == null || fStudy.getBioModel().getSimulations() == null || fStudy.getBioModel().getSimulations().length < 1) {
return;
} else {
sim = fStudy.getBioModel().getSimulations()[0];
}
FieldFunctionArguments[] fieldFunctionArgs = FieldUtilities.getFieldFunctionArguments(sim.getMathDescription());
FieldDataIdentifierSpec[] fieldDataIdentifierSpecs = new FieldDataIdentifierSpec[fieldFunctionArgs.length];
for (int i = 0; i < fieldDataIdentifierSpecs.length; i++) {
fieldDataIdentifierSpecs[i] = new FieldDataIdentifierSpec(fieldFunctionArgs[i], fStudy.getFrapDataExternalDataInfo().getExternalDataIdentifier());
}
ExternalDataIdentifier timeSeriesExtDataID = fStudy.getFrapDataExternalDataInfo().getExternalDataIdentifier();
ExternalDataIdentifier maskExtDataID = fStudy.getRoiExternalDataInfo().getExternalDataIdentifier();
// add sim
int jobIndex = 0;
SimulationJob simJob = new SimulationJob(sim, jobIndex, fieldDataIdentifierSpecs);
VCDataIdentifier[] dataIDs = new VCDataIdentifier[] { timeSeriesExtDataID, maskExtDataID, simJob.getVCDataIdentifier() };
VCDataIdentifier vcDataId = new MergedDataInfo(LocalWorkspace.getDefaultOwner(), dataIDs, FRAPStudy.VFRAP_DS_PREFIX);
PDEDataManager dataManager = new PDEDataManager(null, getLocalWorkspace().getVCDataManager(), vcDataId);
PDEDataContext pdeDataContext = new ClientPDEDataContext(dataManager);
ExportFormat format = ExportFormat.QUICKTIME;
String[] variableNames = new String[] { NORM_FLUOR_VAR, NORM_SIM_VAR };
VariableSpecs variableSpecs = new VariableSpecs(variableNames, ExportConstants.VARIABLE_MULTI);
// int endTimeIndex = (int)Math.round(sim.getSolverTaskDescription().getTimeBounds().getEndingTime()/((UniformOutputTimeSpec)sim.getSolverTaskDescription().getOutputTimeSpec()).getOutputTimeStep());
int endTimeIndex = getFRAPSimDataViewerPanel().getOriginalDataViewer().getPdeDataContext().getTimePoints().length - 1;
TimeSpecs timeSpecs = new TimeSpecs(0, endTimeIndex, pdeDataContext.getTimePoints(), ExportConstants.TIME_RANGE);
int geoMode = ExportConstants.GEOMETRY_SLICE;
GeometrySpecs geometrySpecs = new GeometrySpecs(null, Coordinate.Z_AXIS, 0, geoMode);
// 10s
double duration = 10000;
DisplayPreferences pref1 = new DisplayPreferences("BlueRed", new Range(0.01, 1.1), DisplayAdapterService.createBlueRedSpecialColors());
DisplayPreferences pref2 = new DisplayPreferences("BlueRed", new Range(0.01, 1.1), DisplayAdapterService.createBlueRedSpecialColors());
DisplayPreferences[] displayPref = new DisplayPreferences[] { pref1, pref2 };
int imageScale = 1;
int membraneScale = 1;
int scaleMode = ImagePaneModel.MESH_MODE;
// the default setting in MediaSettingsPanel.
int volVarMemOutlineThickness = 1;
MovieSpecs mSpec = new MovieSpecs(duration, true, displayPref, ExportFormat.QUICKTIME, ExportConstants.NO_MIRRORING, volVarMemOutlineThickness, imageScale, membraneScale, scaleMode, FormatSpecificSpecs.CODEC_JPEG, 1.0f, /*lossless*/
false, FormatSpecificSpecs.PARTICLE_NONE);
// mSpec.setViewZoom(1);
ExportSpecs exSpecs = new ExportSpecs(vcDataId, format, variableSpecs, timeSpecs, geometrySpecs, mSpec, fStudy.getName(), null);
// pass the request
ExportEvent exportEvt = ((VirtualFrapWindowManager) getFlourDataViewer().getDataViewerManager()).startExportMovie(exSpecs, outputContext, this.getClientTaskStatusSupport());
hashTable.put("ExportEvt", exportEvt);
hashTable.put("FrapStudy", fStudy);
}
};
AsynchClientTask showMovieTask = new AsynchClientTask("Showing movie ...", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
ExportEvent exportEvt = (ExportEvent) hashTable.get("ExportEvt");
FRAPStudy fStudy = (FRAPStudy) hashTable.get("FrapStudy");
// show movie if successfully exported
if (exportEvt != null) {
final String fileURLString = System.getProperty(PropertyLoader.exportBaseURLProperty) + exportEvt.getJobID() + ".mov";
final String fileString = System.getProperty(PropertyLoader.exportBaseDirInternalProperty) + exportEvt.getJobID() + ".mov";
fStudy.setMovieURLString(fileURLString);
fStudy.setMovieFileString(fileString);
}
showMovieInDialog(fStudy.getMovieURLString(), fStudy.getMovieFileString());
}
};
ClientTaskDispatcher.dispatch(this, new Hashtable<String, Object>(), new AsynchClientTask[] { createMovieTask, showMovieTask }, true, true, null, true);
}
use of cbit.vcell.simdata.ClientPDEDataContext in project vcell by virtualcell.
the class FieldDataWindowManager method viewData.
public void viewData(final ExternalDataIdentifier eDI) {
ChildWindowManager childWindowManager = ChildWindowManager.findChildWindowManager(getComponent());
if (eDI != null && eDI.equals(currentlyViewedEDI) && childWindowManager != null && childWindowManager.getChildWindowFromContext(eDI) != null) {
childWindowManager.getChildWindowFromContext(eDI).show();
} else {
if (currentlyViewedOutputFunctionViewer != null) {
if (getLocalRequestManager() != null && getLocalRequestManager().getAsynchMessageManager() != null) {
getLocalRequestManager().getAsynchMessageManager().removeDataJobListener(currentlyViewedOutputFunctionViewer.getPDEDataViewer());
}
if (currentlyViewedOutputFunctionViewer != null) {
currentlyViewedOutputFunctionViewer.getPDEDataViewer().getPdeDataContext().removePropertyChangeListener(this);
}
}
if (currentlyViewedOutputFunctionViewer != null) {
ChildWindow childWindow = childWindowManager.getChildWindowFromContext(eDI);
if (childWindow != null) {
childWindow.close();
}
}
currentlyViewedEDI = null;
currentlyViewedOutputFunctionViewer = null;
if (eDI == null) {
return;
}
AsynchClientTask task1 = new AsynchClientTask("retrieve data", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
ClientPDEDataContext newPDEDataContext = getPDEDataContext(eDI, new OutputContext(new AnnotatedFunction[0]));
hashTable.put("newPDEDataContext", newPDEDataContext);
}
};
AsynchClientTask task2 = new AsynchClientTask("show data", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
try {
PDEDataViewer currentlyViewedPDEDV = new PDEDataViewer();
ClientPDEDataContext newPDEDataContext = (ClientPDEDataContext) hashTable.get("newPDEDataContext");
currentlyViewedPDEDV.setPdeDataContext(newPDEDataContext);
newPDEDataContext.addPropertyChangeListener(FieldDataWindowManager.this);
getLocalRequestManager().getAsynchMessageManager().addDataJobListener(currentlyViewedPDEDV);
currentlyViewedOutputFunctionViewer = new OutputFunctionViewer(currentlyViewedPDEDV, FieldDataWindowManager.this, eDI);
DataViewerManager dvm = new DataViewerManager() {
public void dataJobMessage(DataJobEvent event) {
}
public void exportMessage(ExportEvent event) {
}
public void addDataListener(DataListener newListener) {
}
public UserPreferences getUserPreferences() {
return getRequestManager().getUserPreferences();
}
public void removeDataListener(DataListener newListener) {
}
public void startExport(Component requester, OutputContext outputContext, ExportSpecs exportSpecs) {
getLocalRequestManager().startExport(outputContext, requester, exportSpecs);
}
public void simStatusChanged(SimStatusEvent simStatusEvent) {
}
public User getUser() {
return getRequestManager().getDocumentManager().getUser();
}
public RequestManager getRequestManager() {
return FieldDataWindowManager.this.getRequestManager();
}
};
try {
currentlyViewedPDEDV.setDataViewerManager(dvm);
} catch (PropertyVetoException e) {
e.printStackTrace();
}
ChildWindowManager childWindowManager = ChildWindowManager.findChildWindowManager(getComponent());
currentlyViewedEDI = eDI;
ChildWindow childWindow = childWindowManager.addChildWindow(currentlyViewedOutputFunctionViewer, currentlyViewedEDI, "Field Data Viewer (" + eDI.getName() + ")");
childWindow.setSize(600, 500);
childWindow.setIsCenteredOnParent();
childWindow.show();
} catch (Exception e) {
if (currentlyViewedOutputFunctionViewer != null) {
if (getLocalRequestManager() != null && getLocalRequestManager().getAsynchMessageManager() != null) {
getLocalRequestManager().getAsynchMessageManager().removeDataJobListener(currentlyViewedOutputFunctionViewer.getPDEDataViewer());
}
if (currentlyViewedOutputFunctionViewer != null) {
currentlyViewedOutputFunctionViewer.getPDEDataViewer().getPdeDataContext().removePropertyChangeListener(FieldDataWindowManager.this);
}
}
throw e;
}
}
};
ClientTaskDispatcher.dispatch(this.getComponent(), new Hashtable<String, Object>(), new AsynchClientTask[] { task1, task2 }, false);
}
}
use of cbit.vcell.simdata.ClientPDEDataContext in project vcell by virtualcell.
the class PDEDataViewer method setPdeDataContext.
public void setPdeDataContext(ClientPDEDataContext pdeDataContext) {
if (pdeDataContext != null && pdeDataContext.getVCDataIdentifier() instanceof ExternalDataIdentifier) {
// getJTabbedPane1().removeTabAt(getJTabbedPane1().indexOfTab(POST_PROCESS_IMAGE_TABNAME));
// getJTabbedPane1().removeTabAt(getJTabbedPane1().indexOfTab(POST_PROCESS_STATS_TABNAME));
getJTabbedPane1().setEnabledAt(getJTabbedPane1().indexOfTab(POST_PROCESS_IMAGE_TABNAME), false);
getJTabbedPane1().setEnabledAt(getJTabbedPane1().indexOfTab(POST_PROCESS_STATS_TABNAME), false);
}
getPDEDataContextPanel1().getdisplayAdapterServicePanel1().enableAutoAllTimes(true && !(pdeDataContext instanceof PostProcessDataPDEDataContext));
PDEDataContext oldValue = fieldPdeDataContext;
String setVarName = null;
Integer setTimePoint = null;
if (oldValue != null) {
setVarName = oldValue.getVariableName();
setTimePoint = getPDEPlotControlPanel1().getTimeSliderValue();
try {
if (pdeDataContext != null) {
pdeDataContext.setVariableNameAndTime(setVarName, pdeDataContext.getTimePoints()[setTimePoint]);
}
} catch (Exception e) {
e.printStackTrace();
setVarName = null;
setTimePoint = null;
}
oldValue.removePropertyChangeListener(ivjEventHandler);
}
fieldPdeDataContext = pdeDataContext;
if (getPdeDataContext() != null && (setVarName == null || setTimePoint == null)) {
setVarName = getPdeDataContext().getVariableNames()[0];
setTimePoint = 0;
try {
pdeDataContext.setVariableNameAndTime(setVarName, pdeDataContext.getTimePoints()[setTimePoint]);
} catch (Exception e2) {
e2.printStackTrace();
DialogUtils.showErrorDialog(this, "Couldn't set time and variable on pdeDataContext");
return;
}
}
if (getPdeDataContext() != null) {
getPdeDataContext().removePropertyChangeListener(ivjEventHandler);
getPdeDataContext().addPropertyChangeListener(ivjEventHandler);
try {
getPDEPlotControlPanel1().removePropertyChangeListener(ivjEventHandler);
try {
getPDEPlotControlPanel1().setup(((ClientPDEDataContext) getPdeDataContext()).getDataManager().getOutputContext().getOutputFunctions(), getPdeDataContext().getDataIdentifiers(), getPdeDataContext().getTimePoints(), setVarName, setTimePoint);
} catch (Exception e) {
e.printStackTrace();
DialogUtils.showErrorDialog(this, "Couldn't setup PDEPlotControlPanel, " + e.getMessage());
return;
}
} finally {
getPDEPlotControlPanel1().addPropertyChangeListener(ivjEventHandler);
}
}
bSkipSurfaceCalc = true;
firePropertyChange(PDEDataContext.PROP_PDE_DATA_CONTEXT, null, pdeDataContext);
bSkipSurfaceCalc = false;
if (ivjJTabbedPane1.getTitleAt(ivjJTabbedPane1.getSelectedIndex()).equals(POST_PROCESS_STATS_TABNAME)) {
dataProcessingResultsPanel.update(getPdeDataContext());
}
postProcessPdeDataViewerPanel.setParentPDEDataContext((ClientPDEDataContext) getPdeDataContext());
if (ivjJTabbedPane1.getTitleAt(ivjJTabbedPane1.getSelectedIndex()).equals(POST_PROCESS_IMAGE_TABNAME)) {
postProcessPdeDataViewerPanel.update();
}
}
use of cbit.vcell.simdata.ClientPDEDataContext in project vcell by virtualcell.
the class PDEDataViewer method createMultiTimePlotHelper.
// private static class MultiTimePointPropChangeListener implements PropertyChangeListener {
// @Override
// public void propertyChange(PropertyChangeEvent evt) {
// }
// }
private MultiTimePlotHelper createMultiTimePlotHelper(final ClientPDEDataContext copyThisPDEDatacontext, final User user, DataSymbolMetadataResolver argDataSymbolMetadataResolver) throws Exception {
final ClientPDEDataContext[] copyHolder = new ClientPDEDataContext[1];
if (PDEDataViewer.this.isPostProcess()) {
copyHolder[0] = PDEDataViewerPostProcess.createPostProcessPDEDataContext(copyThisPDEDatacontext);
} else {
copyHolder[0] = (ClientPDEDataContext) ((PDEDataManager) copyThisPDEDatacontext.getDataManager()).createNewPDEDataManager(copyThisPDEDatacontext.getVCDataIdentifier(), null).getPDEDataContext();
}
copyHolder[0].setVariableAndTime(copyThisPDEDatacontext.getDataIdentifier(), copyThisPDEDatacontext.getTimePoint());
return new PdeTimePlotMultipleVariablesPanel.MultiTimePlotHelper() {
private DataSymbolMetadataResolver dataSymbolMetadataResolver = argDataSymbolMetadataResolver;
private ArrayList<PropertyChangeListener> myPropertyChangeHolder = new ArrayList<>();
private ClientPDEDataContext myPdeDataContext = copyHolder[0];
private VariableType myVariableType = copyThisPDEDatacontext.getDataIdentifier().getVariableType();
// catch events from 'this' PDEDataViewer and pass with new source
private PropertyChangeListener myPropertyChangeListener;
private User myUser = user;
// List<AnnotatedFunction> myAnnots;
// access to anonymous outer class
private PdeTimePlotMultipleVariablesPanel.MultiTimePlotHelper multiTimePlotHelperThis = this;
private PDEPlotControlPanel.IdentifierListCellRenderer myListCellRenderer;
private AnnotatedFunction[] lastAnnotatedFunctions;
private PDEPlotControlPanel.FunctionListProvider functionListProvider = new PDEPlotControlPanel.FunctionListProvider() {
@Override
public List<AnnotatedFunction> getAnnotatedFunctions() {
if (myPdeDataContext.getDataManager().getOutputContext() != null && myPdeDataContext.getDataManager().getOutputContext().getOutputFunctions() != null && myPdeDataContext.getDataManager().getOutputContext().getOutputFunctions().length > 0) {
return new ArrayList<>(Arrays.asList(myPdeDataContext.getDataManager().getOutputContext().getOutputFunctions()));
}
return new ArrayList<>();
}
};
private Comparator<AnnotatedFunction> nameComparator = new Comparator<AnnotatedFunction>() {
@Override
public int compare(AnnotatedFunction o1, AnnotatedFunction o2) {
return o2.getName().compareToIgnoreCase(o1.getName());
}
};
@Override
public void removeDataJobListener(DataJobListener dataJobListener) {
PDEDataViewer.this.removeDataJobListener(dataJobListener);
}
@Override
public void addDataJobListener(DataJobListener dataJobListener) {
PDEDataViewer.this.addDataJobListener(dataJobListener);
}
@Override
public User getUser() {
return myUser;
}
@Override
public PDEDataContext getPdeDatacontext() {
return myPdeDataContext;
}
@Override
public DataIdentifier[] getCopyOfDisplayedDataIdentifiers() {
DataIdentifier[] newData = PDEDataViewer.this.getPDEPlotControlPanel1().getDataIdentifierFilter().accept(DefaultDataIdentifierFilter.ALL, functionListProvider.getAnnotatedFunctions(), myPdeDataContext.getDataIdentifiers()).toArray(new DataIdentifier[0]);
return DataIdentifier.collectSortedSimilarDataTypes(this.getVariableType(), newData);
}
@Override
public PDEPlotControlPanel.IdentifierListCellRenderer getListCellRenderer() {
if (myListCellRenderer == null) {
myListCellRenderer = new PDEPlotControlPanel.IdentifierListCellRenderer(functionListProvider);
}
return myListCellRenderer;
}
@Override
public Simulation getsimulation() {
return PDEDataViewer.this.getSimulation();
}
private List<AnnotatedFunction> efficiencyFilter(List<AnnotatedFunction> funcs) {
ArrayList<AnnotatedFunction> outputfunctions = new ArrayList<>();
Iterator<AnnotatedFunction> iter = funcs.iterator();
while (iter.hasNext()) {
AnnotatedFunction theFunc = iter.next();
if ((isPostProcess() && theFunc.getFunctionType().equals(VariableType.POSTPROCESSING)) || (!isPostProcess() && !theFunc.getFunctionType().equals(VariableType.POSTPROCESSING))) {
outputfunctions.add(theFunc);
}
}
return outputfunctions;
}
@Override
public void addPropertyChangeListener(PropertyChangeListener propertyChangeListener) {
myPropertyChangeHolder.add(propertyChangeListener);
if (myPropertyChangeListener == null) {
myPropertyChangeListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getSource() == PDEDataViewer.this && evt.getPropertyName().equals(PDEDataContext.PROP_PDE_DATA_CONTEXT)) {
// List<AnnotatedFunction> currentOutputFunctions = functionListProvider.getAnnotatedFunctions();
// currentOutputFunctions = efficiencyFilter(currentOutputFunctions);
// currentOutputFunctions.sort(nameComparator);
List<AnnotatedFunction> newOutputFunctions0 = Arrays.asList(((ClientPDEDataContext) PDEDataViewer.this.getPdeDataContext()).getDataManager().getOutputContext().getOutputFunctions());
List<AnnotatedFunction> newOutputFunctions = efficiencyFilter(newOutputFunctions0);
newOutputFunctions.sort(nameComparator);
if (lastAnnotatedFunctions != null && Compare.isEqualOrNullStrict(lastAnnotatedFunctions, newOutputFunctions.toArray(new AnnotatedFunction[0]))) {
return;
}
lastAnnotatedFunctions = new AnnotatedFunction[newOutputFunctions.size()];
for (int i = 0; i < newOutputFunctions.size(); i++) {
lastAnnotatedFunctions[i] = new AnnotatedFunction(newOutputFunctions.get(i));
}
// lastAnnotatedFunctions = newOutputFunctions0.toArray(new AnnotatedFunction[0]);
myPdeDataContext.getDataManager().setOutputContext(new OutputContext(newOutputFunctions0.toArray(new AnnotatedFunction[0])));
myPdeDataContext.refreshIdentifiers();
for (int i = 0; i < myPropertyChangeHolder.size(); i++) {
myPropertyChangeHolder.get(i).propertyChange(new PropertyChangeEvent(multiTimePlotHelperThis, SimDataConstants.PROPERTY_NAME_DATAIDENTIFIERS, null, null));
}
}
}
};
PDEDataViewer.this.addPropertyChangeListener(myPropertyChangeListener);
}
}
@Override
public void removeallPropertyChangeListeners() {
myPropertyChangeHolder.clear();
if (myPropertyChangeListener != null) {
PDEDataViewer.this.removePropertyChangeListener(myPropertyChangeListener);
}
}
@Override
public VariableType getVariableType() {
return myVariableType;
}
// @Override
// public void addExtraTasks(AsynchClientTask[] moreTasks) {
// PDEDataViewer.this.addExtraTasks(moreTasks);
// }
@Override
public DataSymbolMetadataResolver getDataSymbolMetadataResolver() {
return dataSymbolMetadataResolver;
}
};
}
use of cbit.vcell.simdata.ClientPDEDataContext in project vcell by virtualcell.
the class SimResultsViewer method updateScanParamChoices.
private void updateScanParamChoices(final String message, ListReset listReset) {
if ((paramScanChoiceTimer = ClientTaskDispatcher.getBlockingTimer(this, null, null, paramScanChoiceTimer, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e2) {
updateScanParamChoices(message, listReset);
}
}, message)) != null) {
return;
}
int selectedJobIndex = getSelectedParamScanJobIndex();
// update viewer
if (selectedJobIndex == -1) {
if (isODEData) {
if (listReset != null && odeDataViewer != null && odeDataViewer.getVcDataIdentifier() != null) {
listReset.reset(odeDataViewer.getVcDataIdentifier());
} else {
odeDataViewer.setOdeSolverResultSet(null);
}
} else {
if (listReset != null && pdeDataViewer != null && pdeDataViewer.getPdeDataContext() != null && pdeDataViewer.getPdeDataContext().getVCDataIdentifier() != null) {
listReset.reset(pdeDataViewer.getPdeDataContext().getVCDataIdentifier());
} else {
pdeDataViewer.setPdeDataContext(null);
}
}
return;
}
final VCSimulationDataIdentifier vcdid = new VCSimulationDataIdentifier(getSimulation().getSimulationInfo().getAuthoritativeVCSimulationIdentifier(), selectedJobIndex);
if (isODEData) {
AsynchClientTask task1 = new AsynchClientTask("get ode results", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
ODEDataManager odeDatamanager = ((ODEDataManager) dataManager).createNewODEDataManager(vcdid);
hashTable.put("odeDatamanager", odeDatamanager);
}
};
AsynchClientTask task2 = new AsynchClientTask("show results", AsynchClientTask.TASKTYPE_SWING_BLOCKING, false, false) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
if (hashTable.get(ClientTaskDispatcher.TASK_ABORTED_BY_ERROR) == null) {
ODEDataManager odeDatamanager = (ODEDataManager) hashTable.get("odeDatamanager");
odeDataViewer.setOdeSolverResultSet(odeDatamanager.getODESolverResultSet());
odeDataViewer.setVcDataIdentifier(vcdid);
} else {
odeDataViewer.setOdeSolverResultSet(null);
}
}
};
ClientTaskDispatcher.dispatch(this, new Hashtable<String, Object>(), new AsynchClientTask[] { task1, task2 });
} else {
AsynchClientTask task1 = new AsynchClientTask("get pde results", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
PDEDataManager pdeDatamanager = ((PDEDataManager) dataManager).createNewPDEDataManager(vcdid, null);
PDEDataContext newPDEDC = pdeDatamanager.getPDEDataContext();
PDEDataContext oldPDEDC = pdeDataViewer.getPdeDataContext();
hashTable.put("newPDEDC", newPDEDC);
if (oldPDEDC != null && oldPDEDC.getTimePoints().length <= newPDEDC.getTimePoints().length) {
DataIdentifier setDid = (newPDEDC.getDataIdentifier() == null ? newPDEDC.getDataIdentifiers()[0] : newPDEDC.getDataIdentifier());
if (Arrays.asList(newPDEDC.getDataIdentifiers()).contains(oldPDEDC.getDataIdentifier())) {
setDid = oldPDEDC.getDataIdentifier();
newPDEDC.setVariableAndTime(setDid, newPDEDC.getTimePoints()[BeanUtils.firstIndexOf(oldPDEDC.getTimePoints(), oldPDEDC.getTimePoint())]);
}
}
}
};
AsynchClientTask task2 = new AsynchClientTask("show results", AsynchClientTask.TASKTYPE_SWING_BLOCKING, false, false) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
if (hashTable.get(ClientTaskDispatcher.TASK_ABORTED_BY_ERROR) == null) {
ClientPDEDataContext newPDEDC = (ClientPDEDataContext) hashTable.get("newPDEDC");
pdeDataViewer.setPdeDataContext(newPDEDC);
pdeDataViewer.setSimNameSimDataID(new ExportSpecs.SimNameSimDataID(getSimulation().getName(), getSimulation().getSimulationInfo().getAuthoritativeVCSimulationIdentifier(), SimResultsViewer.getParamScanInfo(getSimulation(), vcdid.getJobIndex())));
} else {
if (listReset != null && pdeDataViewer != null && pdeDataViewer.getPdeDataContext() != null && pdeDataViewer.getPdeDataContext().getVCDataIdentifier() != null) {
listReset.reset(pdeDataViewer.getPdeDataContext().getVCDataIdentifier());
} else {
pdeDataViewer.setPdeDataContext(null);
pdeDataViewer.setSimNameSimDataID(null);
}
}
}
};
// AsynchClientTask refreshTask = new AsynchClientTask("",AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
// @Override
// public void run(Hashtable<String, Object> hashTable) throws Exception {
// ((ArrayList<AsynchClientTask>)hashTable.get(ClientTaskDispatcher.INTERMEDIATE_TASKS)).addAll(Arrays.asList(pdeDataViewer.getRefreshTasks()));
// }
// };
ClientTaskDispatcher.dispatch(this, new Hashtable<String, Object>(), new AsynchClientTask[] { task1, task2 /*,refreshTask*/
});
}
}
Aggregations