use of cbit.vcell.client.server.UserPreferences in project vcell by virtualcell.
the class SimulationListPanel method createBatchSimulations.
/**
* Comment
*/
private void createBatchSimulations() {
int[] selections = getScrollPaneTable().getSelectedRows();
if (selections == null || selections.length != 1) {
throw new RuntimeException("Exactly one template Simulation is required for Batch Creation");
}
Vector<Simulation> v = new Vector<Simulation>();
v.add((Simulation) (ivjSimulationListTableModel1.getValueAt(selections[0])));
Simulation[] toCopy = (Simulation[]) BeanUtils.getArray(v, Simulation.class);
if (toCopy == null || toCopy.length != 1) {
throw new RuntimeException("Exactly one template Simulation is required for Batch Creation");
}
int index = -1;
UserPreferences up = getSimulationWorkspace().getClientSimManager().getUserPreferences();
Map<Integer, Map<String, String>> batchInputDataMap = new LinkedHashMap<>();
File batchInputFile = parseBatchInputFile(up, batchInputDataMap);
if (batchInputFile == null || batchInputDataMap.isEmpty()) {
System.out.println("Failed to read batch input data file or user canceled");
return;
}
try {
index = getSimulationWorkspace().createBatchSimulations(toCopy, batchInputDataMap, this);
} catch (Throwable exc) {
exc.printStackTrace(System.out);
PopupGenerator.showErrorDialog(this, exc.getMessage(), exc);
}
// set selection back to the template simulation
getScrollPaneTable().getSelectionModel().setSelectionInterval(index, index);
getScrollPaneTable().scrollRectToVisible(getScrollPaneTable().getCellRect(index, 0, true));
}
Aggregations