From df3ef7106d6bbfa4ad5e3e239d26f0686a14f39c Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 21 Mar 2017 13:47:53 +0100 Subject: [PATCH] #1340 AppFwk : Improve how defineUiOrdering handles remaining fields --- ApplicationCode/Application/RiaPreferences.cpp | 2 +- .../ProjectDataModel/Rim3dOverlayInfoConfig.cpp | 2 +- .../ProjectDataModel/RimCellEdgeColors.cpp | 2 +- .../ProjectDataModel/RimEclipsePropertyFilter.cpp | 2 +- .../ProjectDataModel/RimEclipseResultDefinition.cpp | 2 +- ApplicationCode/ProjectDataModel/RimEclipseWell.cpp | 2 +- .../ProjectDataModel/RimGeoMechPropertyFilter.cpp | 2 +- .../ProjectDataModel/RimGeoMechResultDefinition.cpp | 2 +- .../ProjectDataModel/RimIntersection.cpp | 2 +- .../ProjectDataModel/RimTernaryLegendConfig.cpp | 2 +- .../ProjectDataModel/RimWellLogExtractionCurve.cpp | 2 +- ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp | 2 +- .../ProjectDataModel/Summary/RimSummaryCurve.cpp | 2 +- .../Summary/RimSummaryCurveFilter.cpp | 2 +- .../Summary/RimSummaryTimeAxisProperties.cpp | 2 +- .../cafPdmUiCore/cafPdmUiObjectHandle.cpp | 13 ++++++++++--- .../cafPdmUiCore/cafPdmUiOrdering.h | 8 ++++---- 17 files changed, 29 insertions(+), 22 deletions(-) diff --git a/ApplicationCode/Application/RiaPreferences.cpp b/ApplicationCode/Application/RiaPreferences.cpp index 15eea4ff20..6f21662d21 100644 --- a/ApplicationCode/Application/RiaPreferences.cpp +++ b/ApplicationCode/Application/RiaPreferences.cpp @@ -191,7 +191,7 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering.add(&defaultCurveFilter); } - uiOrdering.setForgetRemainingFields(true); + uiOrdering.skipRemainingFields(true); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp index 21fe61a73d..26bc72a026 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp +++ b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp @@ -207,7 +207,7 @@ void Rim3dOverlayInfoConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiOr } statGroup->add(&m_statisticsCellRange); - uiOrdering.setForgetRemainingFields(true); + uiOrdering.skipRemainingFields(true); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimCellEdgeColors.cpp b/ApplicationCode/ProjectDataModel/RimCellEdgeColors.cpp index 3c9a6abaea..5330acb7f5 100644 --- a/ApplicationCode/ProjectDataModel/RimCellEdgeColors.cpp +++ b/ApplicationCode/ProjectDataModel/RimCellEdgeColors.cpp @@ -273,7 +273,7 @@ void RimCellEdgeColors::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin uiOrdering.add(&useZVariable); } - uiOrdering.setForgetRemainingFields(true); + uiOrdering.skipRemainingFields(true); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimEclipsePropertyFilter.cpp b/ApplicationCode/ProjectDataModel/RimEclipsePropertyFilter.cpp index 831d70193a..bd2550be04 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipsePropertyFilter.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipsePropertyFilter.cpp @@ -206,7 +206,7 @@ void RimEclipsePropertyFilter::defineUiOrdering(QString uiConfigName, caf::PdmUi uiOrdering.add(&m_upperBound); } - uiOrdering.setForgetRemainingFields(true); + uiOrdering.skipRemainingFields(true); updateReadOnlyStateOfAllFields(); updateRangeLabel(); diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp index 2949ccd5d1..f0d7e7f7e0 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp @@ -945,7 +945,7 @@ void RimEclipseResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm } uiOrdering.add(&m_resultVariableUiField); - uiOrdering.setForgetRemainingFields(true); + uiOrdering.skipRemainingFields(true); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp b/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp index cb9d3ae4fb..93c46b5b68 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp @@ -353,7 +353,7 @@ void RimEclipseWell::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& showWellCellFence.uiCapability()->setUiReadOnly(!showWellCells()); - uiOrdering.setForgetRemainingFields(true); + uiOrdering.skipRemainingFields(true); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechPropertyFilter.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechPropertyFilter.cpp index 48a5d720a8..6caf2c2c2c 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechPropertyFilter.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechPropertyFilter.cpp @@ -150,7 +150,7 @@ void RimGeoMechPropertyFilter::defineUiOrdering(QString uiConfigName, caf::PdmUi updateReadOnlyStateOfAllFields(); - uiOrdering.setForgetRemainingFields(true); + uiOrdering.skipRemainingFields(true); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.cpp index 9e456960a8..6fe9f60be4 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.cpp @@ -119,7 +119,7 @@ void RimGeoMechResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm if (m_isTimeLapseResultUiField()) timeLapseGr->add(&m_timeLapseBaseTimestepUiField); - uiOrdering.setForgetRemainingFields(true); + uiOrdering.skipRemainingFields(true); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimIntersection.cpp b/ApplicationCode/ProjectDataModel/RimIntersection.cpp index 7d4d249de2..0afe1b16e7 100644 --- a/ApplicationCode/ProjectDataModel/RimIntersection.cpp +++ b/ApplicationCode/ProjectDataModel/RimIntersection.cpp @@ -228,7 +228,7 @@ void RimIntersection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& updateWellExtentDefaultValue(); - uiOrdering.setForgetRemainingFields(true); + uiOrdering.skipRemainingFields(true); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp b/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp index 5f62c66811..c7e70a331e 100644 --- a/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp +++ b/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp @@ -321,7 +321,7 @@ void RimTernaryLegendConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiOr group->add(&ternaryRangeSummary); } - uiOrdering.setForgetRemainingFields(true); + uiOrdering.skipRemainingFields(true); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp index 4d49163de6..99ff4e2c50 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp @@ -420,7 +420,7 @@ void RimWellLogExtractionCurve::defineUiOrdering(QString uiConfigName, caf::PdmU } - uiOrdering.setForgetRemainingFields(true); + uiOrdering.skipRemainingFields(true); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp index 29d2829e7d..252ac23d81 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp @@ -483,7 +483,7 @@ void RimWellLogPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering.add(&m_showTrackLegends); - uiOrdering.setForgetRemainingFields(true); + uiOrdering.skipRemainingFields(true); } diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index 454ac3899d..6e251cf9e5 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -462,7 +462,7 @@ void RimSummaryCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering.add(&m_plotAxis); - uiOrdering.setForgetRemainingFields(true); // For now. + uiOrdering.skipRemainingFields(true); // For now. } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveFilter.cpp b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveFilter.cpp index 480a302a51..f26e6d4c40 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveFilter.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveFilter.cpp @@ -225,7 +225,7 @@ void RimSummaryCurveFilter::defineUiOrdering(QString uiConfigName, caf::PdmUiOrd uiOrdering.add(&m_autoApplyChangesToPlot); uiOrdering.add(&m_applyButtonField); - uiOrdering.setForgetRemainingFields(true); + uiOrdering.skipRemainingFields(true); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp b/ApplicationCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp index 93ed3b381c..3152c15c2d 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp @@ -301,7 +301,7 @@ void RimSummaryTimeAxisProperties::defineUiOrdering(QString uiConfigName, caf::P timeGroup->add(&m_visibleTimeRangeMin); } - uiOrdering.setForgetRemainingFields(true); + uiOrdering.skipRemainingFields(true); } //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiObjectHandle.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiObjectHandle.cpp index 94d4e0ab3b..3550e957ce 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiObjectHandle.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiObjectHandle.cpp @@ -37,9 +37,12 @@ PdmUiObjectHandle* uiObj(PdmObjectHandle* obj) //-------------------------------------------------------------------------------------------------- void PdmUiObjectHandle::uiOrdering(QString uiConfigName, PdmUiOrdering& uiOrdering) { -#if 1 + // Restore state for includeRemainingFields, as this flag + // can be changed in defineUiOrdering() + bool includeRemaining_originalState = uiOrdering.includeRemainingFields(); + this->defineUiOrdering(uiConfigName, uiOrdering); - if (!uiOrdering.forgetRemainingFields()) + if (uiOrdering.includeRemainingFields()) { // Add the remaining Fields To UiConfig std::vector fields; @@ -53,7 +56,11 @@ void PdmUiObjectHandle::uiOrdering(QString uiConfigName, PdmUiOrdering& uiOrderi } } } -#endif + + // Restore incoming value + uiOrdering.skipRemainingFields(!includeRemaining_originalState); + + CAF_ASSERT(includeRemaining_originalState == uiOrdering.includeRemainingFields()); } //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiOrdering.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiOrdering.h index 0d395d0313..15e3167ce5 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiOrdering.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiOrdering.h @@ -55,7 +55,7 @@ class PdmObjectHandle; class PdmUiOrdering { public: - PdmUiOrdering(): m_forgetRemainingFields(false) { }; + PdmUiOrdering(): m_skipRemainingFields(false) { }; virtual ~PdmUiOrdering(); PdmUiOrdering(const PdmUiOrdering&) = delete; @@ -68,8 +68,8 @@ public: void add(const PdmFieldHandle* field); void add(const PdmObjectHandle* obj); - bool forgetRemainingFields() const { return m_forgetRemainingFields; } - void setForgetRemainingFields(bool val) { m_forgetRemainingFields = val; } + bool includeRemainingFields() const { return !m_skipRemainingFields; } + void skipRemainingFields(bool val) { m_skipRemainingFields = val; } const std::vector& uiItems() const { return m_ordering; } bool contains(const PdmUiItem* item) const; @@ -77,7 +77,7 @@ public: private: std::vector m_ordering; ///< The order of groups and fields std::vector m_createdGroups; ///< Owned PdmUiGroups, for mem management - bool m_forgetRemainingFields; + bool m_skipRemainingFields; }; //==================================================================================================