Skip to content

Commit

Permalink
#805 Use defineUiTreeOrdering instead of setUiHidden
Browse files Browse the repository at this point in the history
  • Loading branch information
magnesj committed Aug 5, 2016
1 parent 23bd3c9 commit 3abd849
Showing 1 changed file with 13 additions and 20 deletions.
33 changes: 13 additions & 20 deletions ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "RimViewLinker.h"

#include "RiuMainWindow.h"

#include "cafPdmUiTreeOrdering.h"

CAF_PDM_SOURCE_INIT(RimEclipseCellColors, "ResultSlot");
Expand All @@ -40,22 +41,14 @@ RimEclipseCellColors::RimEclipseCellColors()
CAF_PDM_InitObject("Cell Result", ":/CellResult.png", "", "");

CAF_PDM_InitFieldNoDefault(&obsoleteField_legendConfig, "LegendDefinition", "Legend Definition", "", "", "");
this->obsoleteField_legendConfig.uiCapability()->setUiHidden(true);
this->obsoleteField_legendConfig.uiCapability()->setUiChildrenHidden(true);
this->obsoleteField_legendConfig.xmlCapability()->setIOWritable(false);

CAF_PDM_InitFieldNoDefault(&m_legendConfigData, "ResultVarLegendDefinitionList", "", "", "", "");
m_legendConfigData.uiCapability()->setUiHidden(true);
m_legendConfigData.uiCapability()->setUiChildrenHidden(true);

CAF_PDM_InitFieldNoDefault(&ternaryLegendConfig, "TernaryLegendDefinition", "Ternary Legend Definition", "", "", "");
this->ternaryLegendConfig = new RimTernaryLegendConfig();
this->ternaryLegendConfig.uiCapability()->setUiHidden(true);
this->ternaryLegendConfig.uiCapability()->setUiChildrenHidden(true);

CAF_PDM_InitFieldNoDefault(&m_legendConfigPtrField, "LegendDefinitionPtrField", "Legend Definition PtrField", "", "", "");
this->m_legendConfigPtrField.uiCapability()->setUiHidden(true);
this->m_legendConfigPtrField.uiCapability()->setUiChildrenHidden(true);

// Make sure we have a created legend for the default/undefined result variable
changeLegendConfig(this->resultVariable());
Expand Down Expand Up @@ -108,15 +101,8 @@ void RimEclipseCellColors::fieldChangedByUi(const caf::PdmFieldHandle* changedFi
//--------------------------------------------------------------------------------------------------
void RimEclipseCellColors::changeLegendConfig(QString resultVarNameOfNewLegend)
{
if (resultVarNameOfNewLegend == RimDefines::ternarySaturationResultName())
{
this->ternaryLegendConfig.uiCapability()->setUiChildrenHidden(false);
this->m_legendConfigPtrField.uiCapability()->setUiChildrenHidden(true);
}
else
if (resultVarNameOfNewLegend != RimDefines::ternarySaturationResultName())
{
this->ternaryLegendConfig.uiCapability()->setUiChildrenHidden(true);

bool found = false;

QString legendResultVariable;
Expand Down Expand Up @@ -149,8 +135,6 @@ void RimEclipseCellColors::changeLegendConfig(QString resultVarNameOfNewLegend)
this->m_legendConfigPtrField = newLegend;
}
}

this->m_legendConfigPtrField.uiCapability()->setUiChildrenHidden(false);
}
}

Expand Down Expand Up @@ -188,7 +172,16 @@ void RimEclipseCellColors::initAfterRead()
//--------------------------------------------------------------------------------------------------
void RimEclipseCellColors::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
{
uiTreeOrdering.add(m_legendConfigPtrField());
if (this->resultVariable() == RimDefines::ternarySaturationResultName())
{
uiTreeOrdering.add(ternaryLegendConfig());
}
else
{
uiTreeOrdering.add(m_legendConfigPtrField());
}

uiTreeOrdering.setForgetRemainingFields(true);
}

//--------------------------------------------------------------------------------------------------
Expand All @@ -207,6 +200,7 @@ void RimEclipseCellColors::setReservoirView(RimEclipseView* ownerReservoirView)

this->ternaryLegendConfig()->setReservoirView(ownerReservoirView);
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand All @@ -215,7 +209,6 @@ RimEclipseView* RimEclipseCellColors::reservoirView()
return m_reservoirView;
}


//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand Down

0 comments on commit 3abd849

Please sign in to comment.