Use same pdm objects for field selection and well selection

p4#: 22346
This commit is contained in:
Magne Sjaastad
2013-09-07 20:43:29 +02:00
parent 76e2afb846
commit e6386255e6
7 changed files with 74 additions and 38 deletions
@@ -40,8 +40,11 @@ RimOilFieldEntry::RimOilFieldEntry()
CAF_PDM_InitFieldNoDefault(&name, "OilFieldName", "OilFieldName", "", "", "");
CAF_PDM_InitFieldNoDefault(&edmId, "EdmId", "EdmId", "", "", "");
CAF_PDM_InitField(&selected, "Selected", true, "Selected", "", "", "");
CAF_PDM_InitFieldNoDefault(&wellsFilePath, "wellsFilePath", "wellsFilePath", "", "", "");
CAF_PDM_InitFieldNoDefault(&wells, "Wells", "", "", "", "");
}
//--------------------------------------------------------------------------------------------------
@@ -110,3 +113,39 @@ void RimOilFieldEntry::parseWellsResponse(const QString& absolutePath, const QSt
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimOilFieldEntry::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
if (changedField == &selected)
{
updateEnabledState();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimOilFieldEntry::initAfterRead()
{
updateEnabledState();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimOilFieldEntry::updateEnabledState()
{
bool wellsReadOnly = !selected;
if (this->isUiReadOnly())
{
wellsReadOnly = true;
}
for (size_t i = 0; i < wells.size(); i++)
{
wells[i]->setUiReadOnly(wellsReadOnly);
}
}