use of cbit.vcell.solver.ode.gui.SolverTaskDescriptionAdvancedPanel in project vcell by virtualcell.
the class SimulationEditor method prepareToEdit.
/**
* Comment
* @param simulation not null
* @param parent
* @throws ChomboInvalidGeometryException
* @throws NullPointerException
*/
public void prepareToEdit(Simulation simulation, Component parent) throws ChomboInvalidGeometryException {
Objects.requireNonNull(simulation);
try {
Simulation clonedSimulation = (Simulation) BeanUtils.cloneSerializable(simulation);
clonedSimulation.refreshDependencies();
getMathOverridesPanel1().setMathOverrides(clonedSimulation == null ? null : clonedSimulation.getMathOverrides());
getMeshTabPanel().setSimulation(parent, clonedSimulation);
SolverTaskDescriptionAdvancedPanel stdap = getSolverTaskDescriptionAdvancedPanel1();
{
SimulationOwner so = simulation.getSimulationOwner();
UnitInfo unitInfo = so.getUnitInfo();
stdap.setUnitInfo(unitInfo);
}
stdap.setSolverTaskDescription(clonedSimulation == null ? null : clonedSimulation.getSolverTaskDescription());
boolean shouldMeshBeEnabled = false;
MeshSpecification meshSpec = clonedSimulation.getMeshSpecification();
if (meshSpec != null && meshSpec.getGeometry() != null && meshSpec.getGeometry().getDimension() > 0) {
shouldMeshBeEnabled = true;
}
if (!shouldMeshBeEnabled) {
getJTabbedPane1().remove(getMeshTabPanel());
}
setClonedSimulation(clonedSimulation);
} catch (ChomboInvalidGeometryException exc) {
// if this happens, sim is not allowed to edit
exc.printStackTrace(System.out);
throw exc;
} catch (Throwable exc) {
exc.printStackTrace(System.out);
JOptionPane.showMessageDialog(this, "Could not initialize simulation editor\n" + exc.getMessage(), "Error:", JOptionPane.ERROR_MESSAGE);
}
}
Aggregations