void SingleCellSimulationViewInformationSolversWidget::initialize(const QString &pFileName,
                                                                  CellMLSupport::CellmlFileRuntime *pRuntime,
                                                                  SingleCellSimulationViewSimulationData *pSimulationData)
{
    // Make sure that we have a CellML file runtime

    if (!pRuntime)
        return;

    // Retrieve and initialise our GUI state

    setGuiState(mGuiStates.contains(pFileName)?
                    mGuiStates.value(pFileName):
                    mDefaultGuiState);

    // Make sure that the CellML file runtime is valid

    if (pRuntime->isValid()) {
        // Show/hide the ODE/DAE solver information

        if (mOdeSolverData)
            setPropertyVisible(mOdeSolverData->solversProperty(), pRuntime->needOdeSolver());

        if (mDaeSolverData)
            setPropertyVisible(mDaeSolverData->solversProperty(), pRuntime->needDaeSolver());

        // Show/hide the NLA solver information

        if (mNlaSolverData)
            setPropertyVisible(mNlaSolverData->solversProperty(), pRuntime->needNlaSolver());

        // Retranslate ourselves so that the property names get properly set

        retranslateUi();
    }

    // Set the unit of our different properties, if needed

    QString voiUnit = pRuntime->variableOfIntegration()->unit();

    setPropertiesUnit(mOdeSolverData, voiUnit);
    setPropertiesUnit(mDaeSolverData, voiUnit);
    setPropertiesUnit(mNlaSolverData, voiUnit);

    // Initialise our simulation's NLA solver's properties, so that we can then
    // properly reset our simulation the first time round

    if (mNlaSolverData) {
        pSimulationData->setNlaSolverName(mNlaSolverData->solversListProperty()->value()->text(), false);

        foreach (Core::Property *property, mNlaSolverData->solversProperties().value(pSimulationData->nlaSolverName()))
            pSimulationData->addNlaSolverProperty(property->name()->text(),
                                                  (property->value()->type() == Core::PropertyItem::Integer)?
                                                      Core::PropertyEditorWidget::integerPropertyItem(property->value()):
                                                      Core::PropertyEditorWidget::doublePropertyItem(property->value()),
                                                  false);
    }
}
void SimulationExperimentViewInformationSolversWidget::initialize(SimulationSupport::Simulation *pSimulation)
{
    // Make sure that the CellML file runtime is valid

    if (pSimulation->runtime()->isValid()) {
        // Show/hide the ODE/NLA solver information

        mOdeSolverData->solversProperty()->setVisible(true);

        if (mNlaSolverData != nullptr) {
            mNlaSolverData->solversProperty()->setVisible(pSimulation->runtime()->needNlaSolver());
        }
    }

    // Set the unit of our different properties, if needed

    QString voiUnit = pSimulation->runtime()->voi()->unit();

    setPropertiesUnit(mOdeSolverData, voiUnit);
    setPropertiesUnit(mNlaSolverData, voiUnit);

    // Initialise our simulation's NLA solver's properties, so that we can
    // properly reset our simulation the first time round

    if (mNlaSolverData != nullptr) {
        pSimulation->data()->setNlaSolverName(mNlaSolverData->solversListProperty()->value(), false);

        for (auto property : mNlaSolverData->solversProperties().value(pSimulation->data()->nlaSolverName())) {
            // Note: we pass false to variantValue() because we want to retrieve
            //       the value of list properties as a string rather than an
            //       index...

            pSimulation->data()->addNlaSolverProperty(property->id(),
                                                      property->variantValue(false),
                                                      false);
        }
    }
}