From 444e7ddf20bf0ec59bce5a110d92c087a3e641ad Mon Sep 17 00:00:00 2001 From: SET Date: Sat, 4 Jan 2020 16:39:15 +0100 Subject: [PATCH] Clear buffer in Json and Xml grid editors when resultset data has changed. Else, the last buffer will populate the popup grid. Added LResultSetEvent::DataChanged, LResultSet::InformDataChanged, JsonGridEditorRsEVH::DataChanged and XmlGridEditorRsEVH::DataChanged. --- L7/LPQResultSet.cpp | 1 + L7/LResultSet.cpp | 14 ++++++++++++++ L7/LResultSet.h | 2 ++ L7/LSQResultSet.cpp | 1 + L7/nbproject/private/private.xml | 7 ++----- L7/special/LGridJsonCellEditor.cpp | 6 ++++++ L7/special/LGridJsonCellEditor.h | 1 + L7/special/LGridXmlCellEditor.cpp | 6 ++++++ L7/special/LGridXmlCellEditor.h | 1 + L7Test/nbproject/private/private.xml | 5 +---- 10 files changed, 35 insertions(+), 9 deletions(-) diff --git a/L7/LPQResultSet.cpp b/L7/LPQResultSet.cpp index 6329558..667c2f0 100644 --- a/L7/LPQResultSet.cpp +++ b/L7/LPQResultSet.cpp @@ -63,6 +63,7 @@ bool LPQResultSet::RunSQL() m_initialised = true; InformInitialised(); } + InformDataChanged(); return true; } else diff --git a/L7/LResultSet.cpp b/L7/LResultSet.cpp index 89ae547..231d10d 100644 --- a/L7/LResultSet.cpp +++ b/L7/LResultSet.cpp @@ -203,6 +203,16 @@ void LResultSet::InformInitialised() } } +void LResultSet::InformDataChanged() +{ + for (int i = 0; i < m_evtHandlers.GetCount(); i++) + { + void * p = m_evtHandlers.Item(i); + LResultSetEvent * evh = static_cast (p); + if (evh != NULL) evh->DataChanged(this); + } +} + void LResultSet::InformBeforeSave() { for (int i = 0; i < m_evtHandlers.GetCount(); i++) @@ -390,6 +400,10 @@ void LResultSetEvent::Initialised(LResultSet* caller) { } +void LResultSetEvent::DataChanged(LResultSet* caller) +{ +} + void LResultSetEvent::BeforeSave(LResultSet * caller) { } diff --git a/L7/LResultSet.h b/L7/LResultSet.h index 6833980..51434b3 100644 --- a/L7/LResultSet.h +++ b/L7/LResultSet.h @@ -217,6 +217,7 @@ protected: wxArrayPtrVoid m_evtHandlers; void InformInitialised(); + void InformDataChanged(); void InformBeforeSave(); void InformBeforeInsert(); void InformBeforeUpdate(); @@ -253,6 +254,7 @@ public: ACTION_ADDNEW = 0, ACTION_SAVE, ACTION_CANCEL, ACTION_REFRESH, ACTION_DELETE }; virtual void Initialised(LResultSet * caller); + virtual void DataChanged(LResultSet * caller); virtual void BeforeSave(LResultSet * caller); virtual void BeforeInsert(LResultSet * caller); virtual void BeforeUpdate(LResultSet * caller); diff --git a/L7/LSQResultSet.cpp b/L7/LSQResultSet.cpp index 4cae37d..a0b2058 100644 --- a/L7/LSQResultSet.cpp +++ b/L7/LSQResultSet.cpp @@ -67,6 +67,7 @@ bool LSQResultSet::RunSQL() m_initialised = true; InformInitialised(); } + InformDataChanged(); return true; } else diff --git a/L7/nbproject/private/private.xml b/L7/nbproject/private/private.xml index 8bf9153..87429ea 100644 --- a/L7/nbproject/private/private.xml +++ b/L7/nbproject/private/private.xml @@ -7,11 +7,8 @@ - file:/home/user/Documents/published/L7/L7/special/XmlHelper.cpp - file:/home/user/Documents/published/L7/L7/special/XmlGridPickerCtrl.cpp - file:/home/user/Documents/published/L7/L7/special/LGridXmlCellRenderer.cpp - file:/home/user/Documents/published/L7/L7/special/LGridJsonCellRenderer.h - file:/home/user/Documents/published/L7/L7/special/LGridJsonCellRenderer.cpp + file:/home/user/Documents/published/L7/L7/LBoundGrid.cpp + file:/home/user/Documents/published/L7/L7/LBoundGrid.h diff --git a/L7/special/LGridJsonCellEditor.cpp b/L7/special/LGridJsonCellEditor.cpp index 94e4afd..87edafc 100644 --- a/L7/special/LGridJsonCellEditor.cpp +++ b/L7/special/LGridJsonCellEditor.cpp @@ -142,3 +142,9 @@ void JsonGridEditorRsEVH::AfterAction(LResultSet * caller, ACTIONS action) m_owner->m_jsonBuffer.MakeNull(); } } + +void JsonGridEditorRsEVH::DataChanged(LResultSet* caller) +{ + m_rs = caller; + m_owner->m_jsonBuffer.MakeNull(); +} diff --git a/L7/special/LGridJsonCellEditor.h b/L7/special/LGridJsonCellEditor.h index 4090d65..a9b1ea7 100644 --- a/L7/special/LGridJsonCellEditor.h +++ b/L7/special/LGridJsonCellEditor.h @@ -110,6 +110,7 @@ private: JsonGridEditorRsEVH(LGridJsonCellEditor * owner); virtual ~JsonGridEditorRsEVH(); virtual void AfterAction(LResultSet * caller, ACTIONS action); + virtual void DataChanged(LResultSet* caller); void SetResultSet(LResultSet * caller) { diff --git a/L7/special/LGridXmlCellEditor.cpp b/L7/special/LGridXmlCellEditor.cpp index 937741c..e515964 100644 --- a/L7/special/LGridXmlCellEditor.cpp +++ b/L7/special/LGridXmlCellEditor.cpp @@ -141,3 +141,9 @@ void XmlGridEditorRsEVH::AfterAction(LResultSet * caller, ACTIONS action) m_owner->m_xmlBuffer.MakeNull(); } } + +void XmlGridEditorRsEVH::DataChanged(LResultSet* caller) +{ + m_rs = caller; + m_owner->m_xmlBuffer.MakeNull(); +} diff --git a/L7/special/LGridXmlCellEditor.h b/L7/special/LGridXmlCellEditor.h index 3822ef0..79d5182 100644 --- a/L7/special/LGridXmlCellEditor.h +++ b/L7/special/LGridXmlCellEditor.h @@ -109,6 +109,7 @@ private: XmlGridEditorRsEVH(LGridXmlCellEditor * owner); virtual ~XmlGridEditorRsEVH(); virtual void AfterAction(LResultSet * caller, ACTIONS action); + virtual void DataChanged(LResultSet* caller); void SetResultSet(LResultSet * caller) { diff --git a/L7Test/nbproject/private/private.xml b/L7Test/nbproject/private/private.xml index 0bee7a9..3f8d5ff 100644 --- a/L7Test/nbproject/private/private.xml +++ b/L7Test/nbproject/private/private.xml @@ -9,9 +9,6 @@ - - file:/home/user/Documents/published/L7/L7Test/L7Test.h - file:/home/user/Documents/published/L7/L7Test/L7Test.cpp - +