From 7e81cb96eaefe307ef49e8c48b12234e5b5695aa Mon Sep 17 00:00:00 2001 From: John Lunalo Date: Tue, 25 Apr 2017 15:23:36 +0300 Subject: [PATCH 01/52] Updating Link dialog --- instat/dlgAddLink.vb | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/instat/dlgAddLink.vb b/instat/dlgAddLink.vb index 8a6d7055455..e62f5a793e8 100644 --- a/instat/dlgAddLink.vb +++ b/instat/dlgAddLink.vb @@ -15,10 +15,11 @@ ' along with this program. If not, see . Imports instat.Translations +Imports RDotNet Public Class dlgAddLink Public bFirstLoad As Boolean = True Private bReset As Boolean = True - + Private clsGetKeyNames As RFunction Private Sub dlgAddLink_Load(sender As Object, e As EventArgs) Handles MyBase.Load autoTranslate(Me) If bFirstLoad Then @@ -35,13 +36,24 @@ Public Class dlgAddLink Private Sub InitialiseDialog() ucrBase.iHelpTopicID = 506 + ucrDataSelectorTo.SetParameter(New RParameter("data_name", 0)) + ucrBase.clsRsyntax.iCallType = 2 + End Sub Private Sub SetDefaults() - Dim clsDefaultFunction As New RFunction + Dim lstOutput As String + clsGetKeyNames = New RFunction + ucrDataSelectorFrom.Reset() + ucrDataSelectorTo.Reset() + clsGetKeyNames.AddParameter("data_name", Chr(34) & ucrDataSelectorTo.cboAvailableDataFrames.SelectedItem & Chr(34)) + clsGetKeyNames.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_keys") + lstOutput = frmMain.clsRLink.RunInternalScriptGetValue(clsGetKeyNames.ToScript).AsCharacter(0) + lvwLinkViewBox.Items.Add(lstOutput) + lvwLinkViewBox.Columns.Add("Key", 50, HorizontalAlignment.Left) + lvwLinkViewBox.Columns.Add("Column Name", 100, HorizontalAlignment.Left) + ucrBase.clsRsyntax.SetBaseRFunction(clsGetKeyNames) - 'clsDefaultFunction.SetRCommand() - 'ucrBase.clsRsyntax.SetBaseRFunction(clsDefaultFunction) End Sub Private Sub SetRCodeForControls(bReset As Boolean) From 4a9643440c0e6026fb1556e1aeeacabca4f3c1d8 Mon Sep 17 00:00:00 2001 From: John Lunalo Date: Sun, 30 Apr 2017 01:10:30 +0300 Subject: [PATCH 02/52] more changes --- instat/dlgAddLink.Designer.vb | 91 ++++++++++++++++++----------------- instat/dlgAddLink.vb | 60 ++++++++++++++++++----- 2 files changed, 96 insertions(+), 55 deletions(-) diff --git a/instat/dlgAddLink.Designer.vb b/instat/dlgAddLink.Designer.vb index 647f2a724b2..f70c0ec47bb 100644 --- a/instat/dlgAddLink.Designer.vb +++ b/instat/dlgAddLink.Designer.vb @@ -22,65 +22,31 @@ Partial Class dlgAddLink 'Do not modify it using the code editor. _ Private Sub InitializeComponent() - Me.ucrBase = New instat.ucrButtons() - Me.ucrDataSelectorFrom = New instat.ucrDataFrame() - Me.ucrDataSelectorTo = New instat.ucrDataFrame() Me.cmdSpecifyLink = New System.Windows.Forms.Button() - Me.ucrInputLinkName = New instat.ucrInputTextBox() Me.lblLinkName = New System.Windows.Forms.Label() Me.lblFrom = New System.Windows.Forms.Label() Me.lblTo = New System.Windows.Forms.Label() Me.lblKeys = New System.Windows.Forms.Label() Me.lvwLinkViewBox = New System.Windows.Forms.ListView() + Me.ucrInputLinkName = New instat.ucrInputTextBox() + Me.ucrDataSelectorTo = New instat.ucrDataFrame() + Me.ucrDataSelectorFrom = New instat.ucrDataFrame() + Me.ucrBase = New instat.ucrButtons() Me.SuspendLayout() ' - 'ucrBase - ' - Me.ucrBase.Location = New System.Drawing.Point(10, 191) - Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(410, 52) - Me.ucrBase.TabIndex = 1 - ' - 'ucrDataSelectorFrom - ' - Me.ucrDataSelectorFrom.bUseCurrentFilter = True - Me.ucrDataSelectorFrom.Location = New System.Drawing.Point(10, 23) - Me.ucrDataSelectorFrom.Margin = New System.Windows.Forms.Padding(0) - Me.ucrDataSelectorFrom.Name = "ucrDataSelectorFrom" - Me.ucrDataSelectorFrom.Size = New System.Drawing.Size(120, 50) - Me.ucrDataSelectorFrom.TabIndex = 2 - ' - 'ucrDataSelectorTo - ' - Me.ucrDataSelectorTo.bUseCurrentFilter = True - Me.ucrDataSelectorTo.Location = New System.Drawing.Point(10, 84) - Me.ucrDataSelectorTo.Margin = New System.Windows.Forms.Padding(0) - Me.ucrDataSelectorTo.Name = "ucrDataSelectorTo" - Me.ucrDataSelectorTo.Size = New System.Drawing.Size(120, 50) - Me.ucrDataSelectorTo.TabIndex = 3 - ' 'cmdSpecifyLink ' - Me.cmdSpecifyLink.Location = New System.Drawing.Point(257, 154) + Me.cmdSpecifyLink.Location = New System.Drawing.Point(160, 171) Me.cmdSpecifyLink.Name = "cmdSpecifyLink" Me.cmdSpecifyLink.Size = New System.Drawing.Size(121, 23) Me.cmdSpecifyLink.TabIndex = 4 Me.cmdSpecifyLink.Text = "Specify Link" Me.cmdSpecifyLink.UseVisualStyleBackColor = True ' - 'ucrInputLinkName - ' - Me.ucrInputLinkName.IsMultiline = False - Me.ucrInputLinkName.IsReadOnly = False - Me.ucrInputLinkName.Location = New System.Drawing.Point(10, 154) - Me.ucrInputLinkName.Name = "ucrInputLinkName" - Me.ucrInputLinkName.Size = New System.Drawing.Size(174, 21) - Me.ucrInputLinkName.TabIndex = 6 - ' 'lblLinkName ' Me.lblLinkName.AutoSize = True - Me.lblLinkName.Location = New System.Drawing.Point(12, 139) + Me.lblLinkName.Location = New System.Drawing.Point(12, 209) Me.lblLinkName.Name = "lblLinkName" Me.lblLinkName.Size = New System.Drawing.Size(61, 13) Me.lblLinkName.TabIndex = 7 @@ -107,7 +73,7 @@ Partial Class dlgAddLink 'lblKeys ' Me.lblKeys.AutoSize = True - Me.lblKeys.Location = New System.Drawing.Point(260, 27) + Me.lblKeys.Location = New System.Drawing.Point(161, 26) Me.lblKeys.Name = "lblKeys" Me.lblKeys.Size = New System.Drawing.Size(33, 13) Me.lblKeys.TabIndex = 11 @@ -115,17 +81,54 @@ Partial Class dlgAddLink ' 'lvwLinkViewBox ' - Me.lvwLinkViewBox.Location = New System.Drawing.Point(257, 42) + Me.lvwLinkViewBox.FullRowSelect = True + Me.lvwLinkViewBox.Location = New System.Drawing.Point(160, 42) Me.lvwLinkViewBox.Name = "lvwLinkViewBox" - Me.lvwLinkViewBox.Size = New System.Drawing.Size(121, 97) + Me.lvwLinkViewBox.Size = New System.Drawing.Size(240, 123) Me.lvwLinkViewBox.TabIndex = 8 Me.lvwLinkViewBox.UseCompatibleStateImageBehavior = False + Me.lvwLinkViewBox.View = System.Windows.Forms.View.Details + ' + 'ucrInputLinkName + ' + Me.ucrInputLinkName.AddQuotesIfUnrecognised = True + Me.ucrInputLinkName.IsMultiline = False + Me.ucrInputLinkName.IsReadOnly = False + Me.ucrInputLinkName.Location = New System.Drawing.Point(79, 206) + Me.ucrInputLinkName.Name = "ucrInputLinkName" + Me.ucrInputLinkName.Size = New System.Drawing.Size(321, 21) + Me.ucrInputLinkName.TabIndex = 6 + ' + 'ucrDataSelectorTo + ' + Me.ucrDataSelectorTo.bUseCurrentFilter = True + Me.ucrDataSelectorTo.Location = New System.Drawing.Point(10, 84) + Me.ucrDataSelectorTo.Margin = New System.Windows.Forms.Padding(0) + Me.ucrDataSelectorTo.Name = "ucrDataSelectorTo" + Me.ucrDataSelectorTo.Size = New System.Drawing.Size(120, 50) + Me.ucrDataSelectorTo.TabIndex = 3 + ' + 'ucrDataSelectorFrom + ' + Me.ucrDataSelectorFrom.bUseCurrentFilter = True + Me.ucrDataSelectorFrom.Location = New System.Drawing.Point(10, 23) + Me.ucrDataSelectorFrom.Margin = New System.Windows.Forms.Padding(0) + Me.ucrDataSelectorFrom.Name = "ucrDataSelectorFrom" + Me.ucrDataSelectorFrom.Size = New System.Drawing.Size(120, 50) + Me.ucrDataSelectorFrom.TabIndex = 2 + ' + 'ucrBase + ' + Me.ucrBase.Location = New System.Drawing.Point(4, 240) + Me.ucrBase.Name = "ucrBase" + Me.ucrBase.Size = New System.Drawing.Size(410, 52) + Me.ucrBase.TabIndex = 1 ' 'dlgAddLink ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(412, 249) + Me.ClientSize = New System.Drawing.Size(412, 297) Me.Controls.Add(Me.lblKeys) Me.Controls.Add(Me.lblTo) Me.Controls.Add(Me.lblFrom) diff --git a/instat/dlgAddLink.vb b/instat/dlgAddLink.vb index e62f5a793e8..991f3541100 100644 --- a/instat/dlgAddLink.vb +++ b/instat/dlgAddLink.vb @@ -14,12 +14,14 @@ ' You should have received a copy of the GNU General Public License k ' along with this program. If not, see . +Imports instat Imports instat.Translations Imports RDotNet Public Class dlgAddLink Public bFirstLoad As Boolean = True Private bReset As Boolean = True - Private clsGetKeyNames As RFunction + Private clsAddLink As RFunction + Private Sub dlgAddLink_Load(sender As Object, e As EventArgs) Handles MyBase.Load autoTranslate(Me) If bFirstLoad Then @@ -39,21 +41,15 @@ Public Class dlgAddLink ucrDataSelectorTo.SetParameter(New RParameter("data_name", 0)) ucrBase.clsRsyntax.iCallType = 2 + lvwLinkViewBox.Columns.Add("Name", 80, HorizontalAlignment.Left) + lvwLinkViewBox.Columns.Add("Columns", 160, HorizontalAlignment.Left) + End Sub Private Sub SetDefaults() - Dim lstOutput As String - clsGetKeyNames = New RFunction ucrDataSelectorFrom.Reset() ucrDataSelectorTo.Reset() - clsGetKeyNames.AddParameter("data_name", Chr(34) & ucrDataSelectorTo.cboAvailableDataFrames.SelectedItem & Chr(34)) - clsGetKeyNames.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_keys") - lstOutput = frmMain.clsRLink.RunInternalScriptGetValue(clsGetKeyNames.ToScript).AsCharacter(0) - lvwLinkViewBox.Items.Add(lstOutput) - lvwLinkViewBox.Columns.Add("Key", 50, HorizontalAlignment.Left) - lvwLinkViewBox.Columns.Add("Column Name", 100, HorizontalAlignment.Left) - ucrBase.clsRsyntax.SetBaseRFunction(clsGetKeyNames) - + UpdateKeys() End Sub Private Sub SetRCodeForControls(bReset As Boolean) @@ -71,4 +67,46 @@ Public Class dlgAddLink SetRCodeForControls(True) TestOKEnabled() End Sub + + Private Sub ucrDataSelectorTo_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrDataSelectorTo.ControlValueChanged + UpdateKeys() + End Sub + + Public Sub UpdateKeys() + Dim clsGetKeys As New RFunction + Dim clsColumnNames As New RFunction + Dim lstKeys As GenericVector + Dim chrKeyColumns As CharacterVector + Dim lviTemp As ListViewItem + Dim strKeyColumns As String + Dim bCanAutoLink As Boolean + Dim strColumnNames As String() + + lvwLinkViewBox.Items.Clear() + + lblKeys.Text = ucrDataSelectorTo.cboAvailableDataFrames.SelectedItem & " keys:" + clsGetKeys.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_keys") + clsGetKeys.AddParameter("data_name", Chr(34) & ucrDataSelectorTo.cboAvailableDataFrames.SelectedItem & Chr(34)) + lstKeys = frmMain.clsRLink.RunInternalScriptGetValue(clsGetKeys.ToScript).AsList + + clsColumnNames.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_column_names") + clsColumnNames.AddParameter("data_name", Chr(34) & ucrDataSelectorFrom.cboAvailableDataFrames.SelectedItem & Chr(34)) + strColumnNames = frmMain.clsRLink.RunInternalScriptGetValue(clsColumnNames.ToScript).AsCharacter().ToArray + + For i = 0 To lstKeys.Count - 1 + chrKeyColumns = lstKeys(i).AsCharacter + strKeyColumns = String.Join(", ", chrKeyColumns.ToArray) + If chrKeyColumns IsNot Nothing Then + lviTemp = New ListViewItem({lstKeys.Names(i), strKeyColumns}) + clsColumnNames.AddParameter("to_columns", "c(" & strKeyColumns & ")") + bCanAutoLink = strKeyColumns.All(Function(strCol) strColumnNames.Contains(strCol)) + If bCanAutoLink Then + lviTemp.ForeColor = Color.Green + Else + lviTemp.ForeColor = Color.Red + End If + lvwLinkViewBox.Items.Add(lviTemp) + End If + Next + End Sub End Class \ No newline at end of file From 91a1d604e734d4ff1428d278d82de46288e2b1f7 Mon Sep 17 00:00:00 2001 From: John Lunalo Date: Mon, 1 May 2017 17:23:13 +0300 Subject: [PATCH 03/52] more changes --- instat/dlgAddLink.Designer.vb | 33 +++++++++++++++++++++++++---- instat/dlgAddLink.vb | 39 +++++++++++++++++++++++++++++------ 2 files changed, 62 insertions(+), 10 deletions(-) diff --git a/instat/dlgAddLink.Designer.vb b/instat/dlgAddLink.Designer.vb index f70c0ec47bb..e44d0b54be6 100644 --- a/instat/dlgAddLink.Designer.vb +++ b/instat/dlgAddLink.Designer.vb @@ -32,6 +32,8 @@ Partial Class dlgAddLink Me.ucrDataSelectorTo = New instat.ucrDataFrame() Me.ucrDataSelectorFrom = New instat.ucrDataFrame() Me.ucrBase = New instat.ucrButtons() + Me.lblSelectedKey = New System.Windows.Forms.Label() + Me.ucrInputSelectedKey = New instat.ucrInputTextBox() Me.SuspendLayout() ' 'cmdSpecifyLink @@ -46,7 +48,7 @@ Partial Class dlgAddLink 'lblLinkName ' Me.lblLinkName.AutoSize = True - Me.lblLinkName.Location = New System.Drawing.Point(12, 209) + Me.lblLinkName.Location = New System.Drawing.Point(12, 251) Me.lblLinkName.Name = "lblLinkName" Me.lblLinkName.Size = New System.Drawing.Size(61, 13) Me.lblLinkName.TabIndex = 7 @@ -94,7 +96,7 @@ Partial Class dlgAddLink Me.ucrInputLinkName.AddQuotesIfUnrecognised = True Me.ucrInputLinkName.IsMultiline = False Me.ucrInputLinkName.IsReadOnly = False - Me.ucrInputLinkName.Location = New System.Drawing.Point(79, 206) + Me.ucrInputLinkName.Location = New System.Drawing.Point(79, 248) Me.ucrInputLinkName.Name = "ucrInputLinkName" Me.ucrInputLinkName.Size = New System.Drawing.Size(321, 21) Me.ucrInputLinkName.TabIndex = 6 @@ -119,16 +121,37 @@ Partial Class dlgAddLink ' 'ucrBase ' - Me.ucrBase.Location = New System.Drawing.Point(4, 240) + Me.ucrBase.Location = New System.Drawing.Point(4, 282) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(410, 52) Me.ucrBase.TabIndex = 1 ' + 'lblSelectedKey + ' + Me.lblSelectedKey.AutoSize = True + Me.lblSelectedKey.Location = New System.Drawing.Point(12, 222) + Me.lblSelectedKey.Name = "lblSelectedKey" + Me.lblSelectedKey.Size = New System.Drawing.Size(73, 13) + Me.lblSelectedKey.TabIndex = 12 + Me.lblSelectedKey.Text = "Selected Key:" + ' + 'ucrInputSelectedKey + ' + Me.ucrInputSelectedKey.AddQuotesIfUnrecognised = True + Me.ucrInputSelectedKey.IsMultiline = False + Me.ucrInputSelectedKey.IsReadOnly = True + Me.ucrInputSelectedKey.Location = New System.Drawing.Point(90, 220) + Me.ucrInputSelectedKey.Name = "ucrInputSelectedKey" + Me.ucrInputSelectedKey.Size = New System.Drawing.Size(137, 21) + Me.ucrInputSelectedKey.TabIndex = 13 + ' 'dlgAddLink ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(412, 297) + Me.ClientSize = New System.Drawing.Size(412, 339) + Me.Controls.Add(Me.ucrInputSelectedKey) + Me.Controls.Add(Me.lblSelectedKey) Me.Controls.Add(Me.lblKeys) Me.Controls.Add(Me.lblTo) Me.Controls.Add(Me.lblFrom) @@ -160,4 +183,6 @@ Partial Class dlgAddLink Friend WithEvents lblTo As Label Friend WithEvents lblKeys As Label Friend WithEvents lvwLinkViewBox As ListView + Friend WithEvents lblSelectedKey As Label + Friend WithEvents ucrInputSelectedKey As ucrInputTextBox End Class diff --git a/instat/dlgAddLink.vb b/instat/dlgAddLink.vb index 991f3541100..8b256d559a0 100644 --- a/instat/dlgAddLink.vb +++ b/instat/dlgAddLink.vb @@ -14,11 +14,10 @@ ' You should have received a copy of the GNU General Public License k ' along with this program. If not, see . -Imports instat Imports instat.Translations Imports RDotNet Public Class dlgAddLink - Public bFirstLoad As Boolean = True + Private bFirstLoad As Boolean = True Private bReset As Boolean = True Private clsAddLink As RFunction @@ -38,8 +37,13 @@ Public Class dlgAddLink Private Sub InitialiseDialog() ucrBase.iHelpTopicID = 506 - ucrDataSelectorTo.SetParameter(New RParameter("data_name", 0)) - ucrBase.clsRsyntax.iCallType = 2 + ucrDataSelectorFrom.SetParameter(New RParameter("from_data_frame", 0)) + ucrDataSelectorFrom.SetParameterIsString() + ucrDataSelectorTo.SetParameter(New RParameter("to_data_frame", 0)) + ucrDataSelectorTo.SetParameterIsString() + ucrInputLinkName.SetParameter(New RParameter("link_name", 0)) + ucrInputSelectedKey.SetParameter(New RParameter("type", 3)) + ucrInputSelectedKey.AddQuotesIfUnrecognised = True lvwLinkViewBox.Columns.Add("Name", 80, HorizontalAlignment.Left) lvwLinkViewBox.Columns.Add("Columns", 160, HorizontalAlignment.Left) @@ -47,12 +51,16 @@ Public Class dlgAddLink End Sub Private Sub SetDefaults() + clsAddLink = New RFunction ucrDataSelectorFrom.Reset() ucrDataSelectorTo.Reset() UpdateKeys() + clsAddLink.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$add_link") + ucrBase.clsRsyntax.SetBaseRFunction(clsAddLink) End Sub Private Sub SetRCodeForControls(bReset As Boolean) + ' ucrDataSelectorTo.AddAdditionalCodeParameterPair(clsGetKeys, New RParameter("data_name", 0), iAdditionalPairNo:=1) SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, bReset) End Sub @@ -73,7 +81,6 @@ Public Class dlgAddLink End Sub Public Sub UpdateKeys() - Dim clsGetKeys As New RFunction Dim clsColumnNames As New RFunction Dim lstKeys As GenericVector Dim chrKeyColumns As CharacterVector @@ -81,6 +88,7 @@ Public Class dlgAddLink Dim strKeyColumns As String Dim bCanAutoLink As Boolean Dim strColumnNames As String() + Dim clsGetKeys As New RFunction lvwLinkViewBox.Items.Clear() @@ -99,7 +107,7 @@ Public Class dlgAddLink If chrKeyColumns IsNot Nothing Then lviTemp = New ListViewItem({lstKeys.Names(i), strKeyColumns}) clsColumnNames.AddParameter("to_columns", "c(" & strKeyColumns & ")") - bCanAutoLink = strKeyColumns.All(Function(strCol) strColumnNames.Contains(strCol)) + bCanAutoLink = chrKeyColumns.ToArray.All(Function(strCol) strColumnNames.Contains(strCol)) If bCanAutoLink Then lviTemp.ForeColor = Color.Green Else @@ -109,4 +117,23 @@ Public Class dlgAddLink End If Next End Sub + + Private Sub lvwLinkViewBox_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lvwLinkViewBox.SelectedIndexChanged + Dim strColNames As String() + Dim clsPairs As New RFunction + + clsPairs.SetRCommand("c") + + If lvwLinkViewBox.SelectedIndices.Count = 1 Then + strColNames = lvwLinkViewBox.SelectedItems(0).SubItems(1).Text.Split(",") + For Each strTemp As String In strColNames + clsPairs.AddParameter(strTemp.Trim(" "), Chr(34) & strTemp.Trim(" ") & Chr(34)) + Next + clsAddLink.AddParameter("link_pairs", clsRFunctionParameter:=clsPairs, iPosition:=2) + ucrInputSelectedKey.SetName(lvwLinkViewBox.SelectedItems(0).SubItems(0).Text) + Else + clsAddLink.RemoveParameterByName("link_pairs") + ucrInputSelectedKey.SetName("") + End If + End Sub End Class \ No newline at end of file From 4d48539a3f75c87cb60d199fc2743da51e1a7c64 Mon Sep 17 00:00:00 2001 From: John Lunalo Date: Mon, 1 May 2017 18:33:22 +0300 Subject: [PATCH 04/52] fixing type parameter --- instat/dlgAddLink.vb | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/instat/dlgAddLink.vb b/instat/dlgAddLink.vb index 8b256d559a0..f604e538460 100644 --- a/instat/dlgAddLink.vb +++ b/instat/dlgAddLink.vb @@ -42,9 +42,6 @@ Public Class dlgAddLink ucrDataSelectorTo.SetParameter(New RParameter("to_data_frame", 0)) ucrDataSelectorTo.SetParameterIsString() ucrInputLinkName.SetParameter(New RParameter("link_name", 0)) - ucrInputSelectedKey.SetParameter(New RParameter("type", 3)) - ucrInputSelectedKey.AddQuotesIfUnrecognised = True - lvwLinkViewBox.Columns.Add("Name", 80, HorizontalAlignment.Left) lvwLinkViewBox.Columns.Add("Columns", 160, HorizontalAlignment.Left) @@ -55,21 +52,18 @@ Public Class dlgAddLink ucrDataSelectorFrom.Reset() ucrDataSelectorTo.Reset() UpdateKeys() + clsAddLink.AddParameter("type", Chr(34) & "keyed_link" & Chr(34)) clsAddLink.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$add_link") ucrBase.clsRsyntax.SetBaseRFunction(clsAddLink) End Sub Private Sub SetRCodeForControls(bReset As Boolean) - ' ucrDataSelectorTo.AddAdditionalCodeParameterPair(clsGetKeys, New RParameter("data_name", 0), iAdditionalPairNo:=1) SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, bReset) End Sub Private Sub TestOKEnabled() End Sub - Private Sub ReopenDialog() - End Sub - Private Sub ucrBaseReplace_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset SetDefaults() SetRCodeForControls(True) From 81c8e46c18de0a5f584ce9ded4ba5f9a7c9af81f Mon Sep 17 00:00:00 2001 From: John Lunalo Date: Tue, 2 May 2017 09:36:15 +0300 Subject: [PATCH 05/52] tidying up --- instat/dlgAddLink.vb | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/instat/dlgAddLink.vb b/instat/dlgAddLink.vb index f604e538460..260bca91902 100644 --- a/instat/dlgAddLink.vb +++ b/instat/dlgAddLink.vb @@ -43,8 +43,8 @@ Public Class dlgAddLink ucrDataSelectorTo.SetParameterIsString() ucrInputLinkName.SetParameter(New RParameter("link_name", 0)) lvwLinkViewBox.Columns.Add("Name", 80, HorizontalAlignment.Left) - lvwLinkViewBox.Columns.Add("Columns", 160, HorizontalAlignment.Left) - + lvwLinkViewBox.Columns.Add("Columns", 150, HorizontalAlignment.Left) + ucrInputSelectedKey.IsReadOnly = True End Sub Private Sub SetDefaults() @@ -55,6 +55,7 @@ Public Class dlgAddLink clsAddLink.AddParameter("type", Chr(34) & "keyed_link" & Chr(34)) clsAddLink.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$add_link") ucrBase.clsRsyntax.SetBaseRFunction(clsAddLink) + cmdSpecifyLink.Enabled = False End Sub Private Sub SetRCodeForControls(bReset As Boolean) @@ -62,6 +63,11 @@ Public Class dlgAddLink End Sub Private Sub TestOKEnabled() + If ucrDataSelectorFrom.cboAvailableDataFrames.Text <> "" AndAlso ucrDataSelectorTo.cboAvailableDataFrames.Text <> "" AndAlso Not ucrInputLinkName.IsEmpty AndAlso Not ucrInputSelectedKey.IsEmpty Then + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) + End If End Sub Private Sub ucrBaseReplace_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset @@ -72,6 +78,7 @@ Public Class dlgAddLink Private Sub ucrDataSelectorTo_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrDataSelectorTo.ControlValueChanged UpdateKeys() + TestOKEnabled() End Sub Public Sub UpdateKeys() @@ -130,4 +137,8 @@ Public Class dlgAddLink ucrInputSelectedKey.SetName("") End If End Sub + + Private Sub ucrDataSelectorFrom_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrDataSelectorFrom.ControlContentsChanged, ucrInputLinkName.ControlContentsChanged, ucrInputSelectedKey.ControlContentsChanged + TestOKEnabled() + End Sub End Class \ No newline at end of file From 41c4e2160697fae0546f4e24bb504ada76cffc03 Mon Sep 17 00:00:00 2001 From: Lily Date: Tue, 2 May 2017 12:35:16 +0100 Subject: [PATCH 06/52] Code layout changes --- instat/dlgAddLink.Designer.vb | 50 +++++++++++++++++------------------ instat/dlgAddLink.vb | 17 +++++++----- 2 files changed, 36 insertions(+), 31 deletions(-) diff --git a/instat/dlgAddLink.Designer.vb b/instat/dlgAddLink.Designer.vb index e44d0b54be6..e671cd4fa73 100644 --- a/instat/dlgAddLink.Designer.vb +++ b/instat/dlgAddLink.Designer.vb @@ -38,56 +38,56 @@ Partial Class dlgAddLink ' 'cmdSpecifyLink ' - Me.cmdSpecifyLink.Location = New System.Drawing.Point(160, 171) + Me.cmdSpecifyLink.Location = New System.Drawing.Point(287, 171) Me.cmdSpecifyLink.Name = "cmdSpecifyLink" Me.cmdSpecifyLink.Size = New System.Drawing.Size(121, 23) - Me.cmdSpecifyLink.TabIndex = 4 + Me.cmdSpecifyLink.TabIndex = 6 Me.cmdSpecifyLink.Text = "Specify Link" Me.cmdSpecifyLink.UseVisualStyleBackColor = True ' 'lblLinkName ' Me.lblLinkName.AutoSize = True - Me.lblLinkName.Location = New System.Drawing.Point(12, 251) + Me.lblLinkName.Location = New System.Drawing.Point(10, 239) Me.lblLinkName.Name = "lblLinkName" Me.lblLinkName.Size = New System.Drawing.Size(61, 13) - Me.lblLinkName.TabIndex = 7 + Me.lblLinkName.TabIndex = 9 Me.lblLinkName.Text = "Link Name:" ' 'lblFrom ' Me.lblFrom.AutoSize = True - Me.lblFrom.Location = New System.Drawing.Point(7, 10) + Me.lblFrom.Location = New System.Drawing.Point(10, 10) Me.lblFrom.Name = "lblFrom" Me.lblFrom.Size = New System.Drawing.Size(33, 13) - Me.lblFrom.TabIndex = 9 + Me.lblFrom.TabIndex = 0 Me.lblFrom.Text = "From:" ' 'lblTo ' Me.lblTo.AutoSize = True - Me.lblTo.Location = New System.Drawing.Point(7, 71) + Me.lblTo.Location = New System.Drawing.Point(10, 76) Me.lblTo.Name = "lblTo" Me.lblTo.Size = New System.Drawing.Size(23, 13) - Me.lblTo.TabIndex = 10 + Me.lblTo.TabIndex = 2 Me.lblTo.Text = "To:" ' 'lblKeys ' Me.lblKeys.AutoSize = True - Me.lblKeys.Location = New System.Drawing.Point(161, 26) + Me.lblKeys.Location = New System.Drawing.Point(168, 27) Me.lblKeys.Name = "lblKeys" Me.lblKeys.Size = New System.Drawing.Size(33, 13) - Me.lblKeys.TabIndex = 11 + Me.lblKeys.TabIndex = 4 Me.lblKeys.Text = "Keys:" ' 'lvwLinkViewBox ' Me.lvwLinkViewBox.FullRowSelect = True - Me.lvwLinkViewBox.Location = New System.Drawing.Point(160, 42) + Me.lvwLinkViewBox.Location = New System.Drawing.Point(168, 42) Me.lvwLinkViewBox.Name = "lvwLinkViewBox" Me.lvwLinkViewBox.Size = New System.Drawing.Size(240, 123) - Me.lvwLinkViewBox.TabIndex = 8 + Me.lvwLinkViewBox.TabIndex = 5 Me.lvwLinkViewBox.UseCompatibleStateImageBehavior = False Me.lvwLinkViewBox.View = System.Windows.Forms.View.Details ' @@ -96,15 +96,15 @@ Partial Class dlgAddLink Me.ucrInputLinkName.AddQuotesIfUnrecognised = True Me.ucrInputLinkName.IsMultiline = False Me.ucrInputLinkName.IsReadOnly = False - Me.ucrInputLinkName.Location = New System.Drawing.Point(79, 248) + Me.ucrInputLinkName.Location = New System.Drawing.Point(92, 235) Me.ucrInputLinkName.Name = "ucrInputLinkName" - Me.ucrInputLinkName.Size = New System.Drawing.Size(321, 21) - Me.ucrInputLinkName.TabIndex = 6 + Me.ucrInputLinkName.Size = New System.Drawing.Size(316, 21) + Me.ucrInputLinkName.TabIndex = 10 ' 'ucrDataSelectorTo ' Me.ucrDataSelectorTo.bUseCurrentFilter = True - Me.ucrDataSelectorTo.Location = New System.Drawing.Point(10, 84) + Me.ucrDataSelectorTo.Location = New System.Drawing.Point(15, 92) Me.ucrDataSelectorTo.Margin = New System.Windows.Forms.Padding(0) Me.ucrDataSelectorTo.Name = "ucrDataSelectorTo" Me.ucrDataSelectorTo.Size = New System.Drawing.Size(120, 50) @@ -113,26 +113,26 @@ Partial Class dlgAddLink 'ucrDataSelectorFrom ' Me.ucrDataSelectorFrom.bUseCurrentFilter = True - Me.ucrDataSelectorFrom.Location = New System.Drawing.Point(10, 23) + Me.ucrDataSelectorFrom.Location = New System.Drawing.Point(15, 26) Me.ucrDataSelectorFrom.Margin = New System.Windows.Forms.Padding(0) Me.ucrDataSelectorFrom.Name = "ucrDataSelectorFrom" Me.ucrDataSelectorFrom.Size = New System.Drawing.Size(120, 50) - Me.ucrDataSelectorFrom.TabIndex = 2 + Me.ucrDataSelectorFrom.TabIndex = 1 ' 'ucrBase ' - Me.ucrBase.Location = New System.Drawing.Point(4, 282) + Me.ucrBase.Location = New System.Drawing.Point(10, 262) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(410, 52) - Me.ucrBase.TabIndex = 1 + Me.ucrBase.TabIndex = 11 ' 'lblSelectedKey ' Me.lblSelectedKey.AutoSize = True - Me.lblSelectedKey.Location = New System.Drawing.Point(12, 222) + Me.lblSelectedKey.Location = New System.Drawing.Point(10, 211) Me.lblSelectedKey.Name = "lblSelectedKey" Me.lblSelectedKey.Size = New System.Drawing.Size(73, 13) - Me.lblSelectedKey.TabIndex = 12 + Me.lblSelectedKey.TabIndex = 7 Me.lblSelectedKey.Text = "Selected Key:" ' 'ucrInputSelectedKey @@ -140,16 +140,16 @@ Partial Class dlgAddLink Me.ucrInputSelectedKey.AddQuotesIfUnrecognised = True Me.ucrInputSelectedKey.IsMultiline = False Me.ucrInputSelectedKey.IsReadOnly = True - Me.ucrInputSelectedKey.Location = New System.Drawing.Point(90, 220) + Me.ucrInputSelectedKey.Location = New System.Drawing.Point(92, 208) Me.ucrInputSelectedKey.Name = "ucrInputSelectedKey" Me.ucrInputSelectedKey.Size = New System.Drawing.Size(137, 21) - Me.ucrInputSelectedKey.TabIndex = 13 + Me.ucrInputSelectedKey.TabIndex = 8 ' 'dlgAddLink ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(412, 339) + Me.ClientSize = New System.Drawing.Size(416, 320) Me.Controls.Add(Me.ucrInputSelectedKey) Me.Controls.Add(Me.lblSelectedKey) Me.Controls.Add(Me.lblKeys) diff --git a/instat/dlgAddLink.vb b/instat/dlgAddLink.vb index 260bca91902..3a1934ea892 100644 --- a/instat/dlgAddLink.vb +++ b/instat/dlgAddLink.vb @@ -37,10 +37,14 @@ Public Class dlgAddLink Private Sub InitialiseDialog() ucrBase.iHelpTopicID = 506 + cmdSpecifyLink.Enabled = False ' temporarily disabled + ucrDataSelectorFrom.SetParameter(New RParameter("from_data_frame", 0)) ucrDataSelectorFrom.SetParameterIsString() + ucrDataSelectorTo.SetParameter(New RParameter("to_data_frame", 0)) ucrDataSelectorTo.SetParameterIsString() + ucrInputLinkName.SetParameter(New RParameter("link_name", 0)) lvwLinkViewBox.Columns.Add("Name", 80, HorizontalAlignment.Left) lvwLinkViewBox.Columns.Add("Columns", 150, HorizontalAlignment.Left) @@ -49,13 +53,14 @@ Public Class dlgAddLink Private Sub SetDefaults() clsAddLink = New RFunction + ucrDataSelectorFrom.Reset() ucrDataSelectorTo.Reset() UpdateKeys() + clsAddLink.AddParameter("type", Chr(34) & "keyed_link" & Chr(34)) clsAddLink.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$add_link") ucrBase.clsRsyntax.SetBaseRFunction(clsAddLink) - cmdSpecifyLink.Enabled = False End Sub Private Sub SetRCodeForControls(bReset As Boolean) @@ -76,11 +81,6 @@ Public Class dlgAddLink TestOKEnabled() End Sub - Private Sub ucrDataSelectorTo_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrDataSelectorTo.ControlValueChanged - UpdateKeys() - TestOKEnabled() - End Sub - Public Sub UpdateKeys() Dim clsColumnNames As New RFunction Dim lstKeys As GenericVector @@ -141,4 +141,9 @@ Public Class dlgAddLink Private Sub ucrDataSelectorFrom_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrDataSelectorFrom.ControlContentsChanged, ucrInputLinkName.ControlContentsChanged, ucrInputSelectedKey.ControlContentsChanged TestOKEnabled() End Sub + + Private Sub ucrDataSelectorTo_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrDataSelectorTo.ControlValueChanged + UpdateKeys() + TestOKEnabled() + End Sub End Class \ No newline at end of file From cb67f0673998c2538a34e48396396ef4c8a32438 Mon Sep 17 00:00:00 2001 From: Lily Date: Tue, 2 May 2017 12:39:34 +0100 Subject: [PATCH 07/52] Capital K --- instat/dlgAddLink.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/dlgAddLink.vb b/instat/dlgAddLink.vb index 3a1934ea892..f282ec02359 100644 --- a/instat/dlgAddLink.vb +++ b/instat/dlgAddLink.vb @@ -93,7 +93,7 @@ Public Class dlgAddLink lvwLinkViewBox.Items.Clear() - lblKeys.Text = ucrDataSelectorTo.cboAvailableDataFrames.SelectedItem & " keys:" + lblKeys.Text = ucrDataSelectorTo.cboAvailableDataFrames.SelectedItem & " Keys:" clsGetKeys.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_keys") clsGetKeys.AddParameter("data_name", Chr(34) & ucrDataSelectorTo.cboAvailableDataFrames.SelectedItem & Chr(34)) lstKeys = frmMain.clsRLink.RunInternalScriptGetValue(clsGetKeys.ToScript).AsList From 258da68edc604b0dc91a4d4135917fbda1f38406 Mon Sep 17 00:00:00 2001 From: John Lunalo Date: Wed, 3 May 2017 05:50:19 +0300 Subject: [PATCH 08/52] code for viewing and removing links --- instat/dlgViewAndRemoveLinks.Designer.vb | 140 ++--- instat/dlgViewAndRemoveLinks.vb | 50 +- .../InstatObject/R/Backend_Components/link.R | 580 +++++++++--------- .../static/InstatObject/R/instat_object_R6.R | 21 +- 4 files changed, 414 insertions(+), 377 deletions(-) diff --git a/instat/dlgViewAndRemoveLinks.Designer.vb b/instat/dlgViewAndRemoveLinks.Designer.vb index 1ea4ee17112..b6e6fdc6029 100644 --- a/instat/dlgViewAndRemoveLinks.Designer.vb +++ b/instat/dlgViewAndRemoveLinks.Designer.vb @@ -22,25 +22,16 @@ Partial Class dlgViewAndRemoveLinks 'Do not modify it using the code editor. _ Private Sub InitializeComponent() - Me.ucrBase = New instat.ucrButtons() Me.lblLinks = New System.Windows.Forms.Label() Me.lblLink = New System.Windows.Forms.Label() - Me.ucrReceiverLink = New instat.ucrReceiverSingle() - Me.lblFrom = New System.Windows.Forms.Label() - Me.lblTo = New System.Windows.Forms.Label() - Me.ucrInputFrom = New instat.ucrInputTextBox() - Me.ucrInputTo = New instat.ucrInputTextBox() - Me.chkDeleteLink = New System.Windows.Forms.CheckBox() + Me.rdoViewLink = New System.Windows.Forms.RadioButton() + Me.rdoDeleteLink = New System.Windows.Forms.RadioButton() + Me.ucrReceiverViewLinks = New instat.ucrReceiverSingle() + Me.ucrpnlDeleteView = New instat.UcrPanel() Me.ucrSlelectorLinks = New instat.ucrSelector() + Me.ucrBase = New instat.ucrButtons() Me.SuspendLayout() ' - 'ucrBase - ' - Me.ucrBase.Location = New System.Drawing.Point(12, 134) - Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(410, 52) - Me.ucrBase.TabIndex = 1 - ' 'lblLinks ' Me.lblLinks.AutoSize = True @@ -53,65 +44,51 @@ Partial Class dlgViewAndRemoveLinks 'lblLink ' Me.lblLink.AutoSize = True - Me.lblLink.Location = New System.Drawing.Point(160, 9) + Me.lblLink.Location = New System.Drawing.Point(153, 13) Me.lblLink.Name = "lblLink" Me.lblLink.Size = New System.Drawing.Size(30, 13) Me.lblLink.TabIndex = 4 Me.lblLink.Text = "Link:" ' - 'ucrReceiverLink - ' - Me.ucrReceiverLink.frmParent = Me - Me.ucrReceiverLink.Location = New System.Drawing.Point(163, 26) - Me.ucrReceiverLink.Margin = New System.Windows.Forms.Padding(0) - Me.ucrReceiverLink.Name = "ucrReceiverLink" - Me.ucrReceiverLink.Selector = Nothing - Me.ucrReceiverLink.Size = New System.Drawing.Size(130, 20) - Me.ucrReceiverLink.TabIndex = 5 - ' - 'lblFrom - ' - Me.lblFrom.AutoSize = True - Me.lblFrom.Location = New System.Drawing.Point(160, 57) - Me.lblFrom.Name = "lblFrom" - Me.lblFrom.Size = New System.Drawing.Size(33, 13) - Me.lblFrom.TabIndex = 7 - Me.lblFrom.Text = "From:" - ' - 'lblTo - ' - Me.lblTo.AutoSize = True - Me.lblTo.Location = New System.Drawing.Point(299, 56) - Me.lblTo.Name = "lblTo" - Me.lblTo.Size = New System.Drawing.Size(23, 13) - Me.lblTo.TabIndex = 8 - Me.lblTo.Text = "To:" - ' - 'ucrInputFrom - ' - Me.ucrInputFrom.IsReadOnly = False - Me.ucrInputFrom.Location = New System.Drawing.Point(199, 51) - Me.ucrInputFrom.Name = "ucrInputFrom" - Me.ucrInputFrom.Size = New System.Drawing.Size(94, 21) - Me.ucrInputFrom.TabIndex = 9 - ' - 'ucrInputTo - ' - Me.ucrInputTo.IsReadOnly = False - Me.ucrInputTo.Location = New System.Drawing.Point(328, 51) - Me.ucrInputTo.Name = "ucrInputTo" - Me.ucrInputTo.Size = New System.Drawing.Size(94, 21) - Me.ucrInputTo.TabIndex = 10 - ' - 'chkDeleteLink - ' - Me.chkDeleteLink.AutoSize = True - Me.chkDeleteLink.Location = New System.Drawing.Point(163, 89) - Me.chkDeleteLink.Name = "chkDeleteLink" - Me.chkDeleteLink.Size = New System.Drawing.Size(80, 17) - Me.chkDeleteLink.TabIndex = 11 - Me.chkDeleteLink.Text = "Delete Link" - Me.chkDeleteLink.UseVisualStyleBackColor = True + 'rdoViewLink + ' + Me.rdoViewLink.AutoSize = True + Me.rdoViewLink.Location = New System.Drawing.Point(163, 99) + Me.rdoViewLink.Name = "rdoViewLink" + Me.rdoViewLink.Size = New System.Drawing.Size(90, 17) + Me.rdoViewLink.TabIndex = 14 + Me.rdoViewLink.TabStop = True + Me.rdoViewLink.Text = "RadioButton1" + Me.rdoViewLink.UseVisualStyleBackColor = True + ' + 'rdoDeleteLink + ' + Me.rdoDeleteLink.AutoSize = True + Me.rdoDeleteLink.Location = New System.Drawing.Point(259, 99) + Me.rdoDeleteLink.Name = "rdoDeleteLink" + Me.rdoDeleteLink.Size = New System.Drawing.Size(90, 17) + Me.rdoDeleteLink.TabIndex = 15 + Me.rdoDeleteLink.TabStop = True + Me.rdoDeleteLink.Text = "RadioButton2" + Me.rdoDeleteLink.UseVisualStyleBackColor = True + ' + 'ucrReceiverViewLinks + ' + Me.ucrReceiverViewLinks.frmParent = Me + Me.ucrReceiverViewLinks.Location = New System.Drawing.Point(153, 30) + Me.ucrReceiverViewLinks.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverViewLinks.Name = "ucrReceiverViewLinks" + Me.ucrReceiverViewLinks.Selector = Nothing + Me.ucrReceiverViewLinks.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverViewLinks.TabIndex = 16 + Me.ucrReceiverViewLinks.ucrSelector = Nothing + ' + 'ucrpnlDeleteView + ' + Me.ucrpnlDeleteView.Location = New System.Drawing.Point(163, 84) + Me.ucrpnlDeleteView.Name = "ucrpnlDeleteView" + Me.ucrpnlDeleteView.Size = New System.Drawing.Size(187, 41) + Me.ucrpnlDeleteView.TabIndex = 13 ' 'ucrSlelectorLinks ' @@ -122,18 +99,23 @@ Partial Class dlgViewAndRemoveLinks Me.ucrSlelectorLinks.Size = New System.Drawing.Size(120, 98) Me.ucrSlelectorLinks.TabIndex = 12 ' + 'ucrBase + ' + Me.ucrBase.Location = New System.Drawing.Point(12, 134) + Me.ucrBase.Name = "ucrBase" + Me.ucrBase.Size = New System.Drawing.Size(410, 52) + Me.ucrBase.TabIndex = 1 + ' 'dlgViewAndRemoveLinks ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(428, 193) + Me.Controls.Add(Me.ucrReceiverViewLinks) + Me.Controls.Add(Me.rdoDeleteLink) + Me.Controls.Add(Me.rdoViewLink) + Me.Controls.Add(Me.ucrpnlDeleteView) Me.Controls.Add(Me.ucrSlelectorLinks) - Me.Controls.Add(Me.chkDeleteLink) - Me.Controls.Add(Me.ucrInputTo) - Me.Controls.Add(Me.ucrInputFrom) - Me.Controls.Add(Me.lblTo) - Me.Controls.Add(Me.lblFrom) - Me.Controls.Add(Me.ucrReceiverLink) Me.Controls.Add(Me.lblLink) Me.Controls.Add(Me.lblLinks) Me.Controls.Add(Me.ucrBase) @@ -151,11 +133,9 @@ Partial Class dlgViewAndRemoveLinks Friend WithEvents ucrBase As ucrButtons Friend WithEvents lblLinks As Label Friend WithEvents lblLink As Label - Friend WithEvents ucrReceiverLink As ucrReceiverSingle - Friend WithEvents lblFrom As Label - Friend WithEvents lblTo As Label - Friend WithEvents ucrInputFrom As ucrInputTextBox - Friend WithEvents ucrInputTo As ucrInputTextBox - Friend WithEvents chkDeleteLink As CheckBox Friend WithEvents ucrSlelectorLinks As ucrSelector + Friend WithEvents rdoDeleteLink As RadioButton + Friend WithEvents rdoViewLink As RadioButton + Friend WithEvents ucrpnlDeleteView As UcrPanel + Friend WithEvents ucrReceiverViewLinks As ucrReceiverSingle End Class diff --git a/instat/dlgViewAndRemoveLinks.vb b/instat/dlgViewAndRemoveLinks.vb index 4147ea28e06..2d234d6e5cb 100644 --- a/instat/dlgViewAndRemoveLinks.vb +++ b/instat/dlgViewAndRemoveLinks.vb @@ -16,26 +16,70 @@ Imports instat.Translations Public Class dlgViewAndRemoveLinks - Public bFirstLoad As Boolean = True + Private bFirstLoad As Boolean = True + Private bReset As Boolean = True + Private clsVewLinks As New RFunction + Private clsDeleteLinks As New RFunction + Private Sub dlgViewAndRemoveLinks_Load(sender As Object, e As EventArgs) Handles MyBase.Load autoTranslate(Me) If bFirstLoad Then InitialiseDialog() - SetDefaults() bFirstLoad = False End If + If bReset Then + SetDefaults() + End If + SetRCodeForControls(bReset) + bReset = False TestOKEnabled() End Sub + Private Sub SetRCodeForControls(bReset As Boolean) + ucrReceiverViewLinks.AddAdditionalCodeParameterPair(clsDeleteLinks, New RParameter("link_name", 0), iAdditionalPairNo:=1) + SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, bReset) + End Sub + Private Sub InitialiseDialog() ucrBase.iHelpTopicID = 507 + ucrReceiverViewLinks.Selector = ucrSlelectorLinks + ucrReceiverViewLinks.SetMeAsReceiver() + ucrReceiverViewLinks.SetParameter(New RParameter("link_name", 0)) + ucrReceiverViewLinks.SetParameterIsString() + ucrReceiverViewLinks.SetItemType("link") + ucrpnlDeleteView.AddRadioButton(rdoDeleteLink) + ucrpnlDeleteView.AddRadioButton(rdoViewLink) + ucrpnlDeleteView.AddFunctionNamesCondition(rdoDeleteLink, frmMain.clsRLink.strInstatDataObject & "c") + ucrpnlDeleteView.AddFunctionNamesCondition(rdoViewLink, frmMain.clsRLink.strInstatDataObject & "$view_link") + End Sub Private Sub TestOKEnabled() - + If Not ucrReceiverViewLinks.IsEmpty Then + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) + End If End Sub Private Sub SetDefaults() + clsDeleteLinks = New RFunction + clsVewLinks = New RFunction + clsDeleteLinks.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$remove_link") + clsVewLinks.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$view_link") + ucrBase.clsRsyntax.iCallType = 2 + ucrBase.clsRsyntax.SetBaseRFunction(clsVewLinks) + End Sub + Private Sub ucrpnlDeleteView_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrpnlDeleteView.ControlValueChanged + If rdoDeleteLink.Checked Then + ucrBase.clsRsyntax.SetBaseRFunction(clsDeleteLinks) + Else + ucrBase.clsRsyntax.SetBaseRFunction(clsVewLinks) + End If + End Sub + + Private Sub ucrReceiverViewLinks_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverViewLinks.ControlContentsChanged + TestOKEnabled() End Sub End Class \ No newline at end of file diff --git a/instat/static/InstatObject/R/Backend_Components/link.R b/instat/static/InstatObject/R/Backend_Components/link.R index c61125cf66f..aa879057c72 100644 --- a/instat/static/InstatObject/R/Backend_Components/link.R +++ b/instat/static/InstatObject/R/Backend_Components/link.R @@ -1,274 +1,306 @@ -# a link can contain multiple ways to link two data frames -link <- R6Class("link", - public = list( - initialize = function(from_data_frame = "", to_data_frame = "", type = "", link_columns = list()) { - self$from_data_frame <- from_data_frame - self$to_data_frame <- to_data_frame - self$type <- type - self$link_columns <- link_columns - }, - from_data_frame = "", - to_data_frame = "", - # TODO Is type needed anymore? - type = "", - # remove calculation - # replace with list of list of pairs of linking columns - # each list of pairs of columns corresponds to a key in the to_data_frame - link_columns = list() - ), - private = list(), - active = list() -) - -link$set("public", "data_clone", function() { - ret <- link$new(from_data_frame = self$from_data_frame, to_data_frame = self$to_data_frame, - type = self$type, link_columns = self$link_columns) - return(ret) -} -) - -instat_object$set("public", "add_link", function(from_data_frame, to_data_frame, link_pairs, type, link_name) { - if(length(names(link_pairs)) != length(link_pairs)) stop("link_pairs must be a named vector or list.") - if(!self$link_exists_between(from_data_frame, to_data_frame)) { - # This means when creating a link to single value data frame, there will be no key in to_data_frame - # Will this cause any issues? - if(length(link_pairs) > 0 && !self$is_key(to_data_frame, link_pairs)) { - message("link columns must be a key in the to_data_frame\nAttempting to create key...") - self$add_key(to_data_frame, as.character(link_pairs)) - message("New key created") - } - new_link <- link$new(from_data_frame = from_data_frame, to_data_frame = to_data_frame, link_columns = list(link_pairs), type = type) - if(missing(link_name)) link_name <- next_default_item("link", names(private$.links)) - if(link_name %in% names(private$.links)) warning("A link called ", link_name, " already exists. It wil be replaced.") - private$.links[[link_name]] <- new_link - } - else { - index <- integer(0) - for(i in 1:length(private$.links)) { - if(private$.links[[i]]$from_data_frame == from_data_frame && private$.links[[i]]$to_data_frame == to_data_frame) { - index <- i - from_on_left <- TRUE - break - } - else if(private$.links[[i]]$from_data_frame == to_data_frame && private$.links[[i]]$to_data_frame == from_data_frame) { - index <- i - from_on_left <- FALSE - break - } - } - # This should never happen because we are inside the Else of link_exists_between - if(length(index) == 0) stop("link not found") - - if(type != private$.links[[index]]$type) stop("Cannot add link of type ", type, ". These data frames are already linked by type: ", private$.links[[index]]$type) - curr_link_columns <- private$.links[[index]]$link_columns - curr_num_links <- length(curr_link_columns) - found <- FALSE - for(curr_link_pairs in curr_link_columns) { - # Are these the right checks on the link columns? - if(from_on_left && length(link_pairs) == length(curr_link_pairs) && (setequal(link_pairs, curr_link_pairs) || setequal(names(link_pairs), names(curr_link_pairs)))) { - message("A link with these columns already exists. A new link will not be added.") - found <- TRUE - break - } - else if(!from_on_left && length(link_pairs) == length(curr_link_pairs) && (setequal(link_pairs, names(curr_link_pairs)) || setequal(names(link_pairs), curr_link_pairs))) { - message("A link with these columns already exists. A new link will not be added.") - found <- TRUE - break - } - } - if(!found) { - if(!self$is_key(to_data_frame, link_pairs)) { - message("link columns must be a key in the to_data_frame\nAttempting to create key...") - self$add_key(to_data_frame, as.character(link_pairs)) - message("new key created") - } - if(from_on_left) private$.links[[index]]$link_columns[[curr_num_links + 1]] <- link_pairs - else { - new_link_pairs <- names(link_pairs) - names(new_link_pairs) <- link_pairs - private$.links[[index]]$link_columns[[curr_num_links + 1]] <- new_link_pairs - } - } - } -} -) - -instat_object$set("public", "link_exists_from", function(curr_data_frame, link_pairs) { - link_exists <- FALSE - for(curr_link in private$.links) { - if(curr_link$from_data_frame == curr_data_frame) { - for(curr_link_pairs in curr_link$link_columns) { - if(length(link_pairs) == length(curr_link_pairs) && setequal(link_pairs, names(curr_link_pairs))) { - return(TRUE) - break - } - } - } - } - return(FALSE) -} -) - -instat_object$set("public", "link_exists_from_by_to", function(first_data_frame, link_pairs, second_data_frame) { - link_exists <- FALSE - for(curr_link in private$.links) { - if(curr_link$from_data_frame == first_data_frame && curr_link$to_data_frame == second_data_frame) { - for(curr_link_pairs in curr_link$link_columns) { - if(length(link_pairs) == length(curr_link_pairs) && setequal(link_pairs, names(curr_link_pairs))) { - return(TRUE) - break - } - } - } - } - return(FALSE) -} -) - -instat_object$set("public", "get_linked_to_data_name", function(from_data_frame, link_pairs) { - for(curr_link in private$.links) { - if(curr_link$from_data_frame == from_data_frame) { - for(curr_link_pairs in curr_link$link_columns) { - if(length(link_pairs) == length(curr_link_pairs) && setequal(link_pairs, names(curr_link_pairs))) { - return(curr_link$to_data_frame) - } - } - } - } - return("") -} -) - -instat_object$set("public", "get_linked_to_definition", function(from_data_frame, link_pairs) { - to_data_name <- self$get_linked_to_data_name(from_data_frame, link_pairs) - if(to_data_name != "") { - curr_link <- self$get_link_between(from_data_frame, to_data_name) - for(curr_link in private$.links) { - for(curr_link_pairs in curr_link$link_columns) { - if(length(link_pairs) == length(curr_link_pairs) && setequal(link_pairs, names(curr_link_pairs))) { - return(list(to_data_name, as.vector(curr_link_pairs))) - } - } - } - } - return(list()) -} -) - -instat_object$set("public", "get_possible_linked_to_defintion", function(from_data_frame, link_pairs) { - def <- self$get_linked_to_definition(from_data_frame, link_pairs) - if(length(def) != 0) return(def) - else { - prev_data_links <- list(list(from_data_frame, link_pairs)) - continue <- TRUE - while(continue) { - curr_data_links <- prev_data_links - curr_data_names <- sapply(curr_data_links, function(x) x[[1]]) - for(to_data_name in self$get_data_names()) { - i = 1 - for(curr_from_data_frame in curr_data_names) { - curr_link_cols <- self$link_between_containing(curr_from_data_frame, curr_data_links[[i]][[2]], to_data_name) - # Is it enough to check unqiue data frames? - if(length(curr_link_cols) != 0 && !(to_data_name %in% sapply(curr_data_links, function(x) x[[1]]))) { - curr_data_links[[length(curr_data_links) + 1]] <- list(to_data_name, curr_link_cols) - } - i = i + 1 - } - } - if(length(prev_data_links) != length(curr_data_links)) { - curr_data_names <- sapply(curr_data_links, function(x) x[[1]]) - prev_data_names <- sapply(prev_data_links, function(x) x[[1]]) - for(i in seq_along(curr_data_names)) { - if(curr_data_names[i] %in% setdiff(curr_data_names, prev_data_names)) { - def <- self$get_linked_to_definition(curr_data_names[i], curr_data_links[[i]][[2]]) - if(length(def) > 0) return(def) - } - } - prev_data_links <- curr_data_links - } - else continue <- FALSE - } - return(c()) - } -} -) - -instat_object$set("public", "get_equivalent_columns", function(from_data_name, columns, to_data_name) { - if(from_data_name == to_data_name) equivalent_columns <- columns - else equivalent_columns <- self$link_between_containing(from_data_name, columns, to_data_name) - if(length(equivalent_columns) != 0) return(equivalent_columns) - else { - prev_data_links <- list(list(from_data_name, columns)) - continue <- TRUE - while(continue) { - curr_data_links <- prev_data_links - curr_data_names <- sapply(curr_data_links, function(x) x[[1]]) - for(temp_data_name in self$get_data_names()) { - i = 1 - for(curr_from_data_frame in curr_data_names) { - if(curr_from_data_frame == temp_data_name) curr_link_cols <- curr_data_links[[i]][[2]] - curr_link_cols <- self$link_between_containing(curr_from_data_frame, curr_data_links[[i]][[2]], temp_data_name) - if(length(curr_link_cols) != 0) { - if(temp_data_name == to_data_name) { - return(curr_link_cols) - } - else if(!(temp_data_name %in% sapply(curr_data_links, function(x) x[[1]]))) { - curr_data_links[[length(curr_data_links) + 1]] <- list(temp_data_name, curr_link_cols) - } - } - i = i + 1 - } - } - if(length(prev_data_links) == length(curr_data_links)) continue <- FALSE - else prev_data_links <- curr_data_links - } - return(c()) - } -} -) - -instat_object$set("public", "link_exists_between", function(from_data_frame, to_data_frame) { - return(any(sapply(private$.links, function(link) link$from_data_frame == from_data_frame && link$to_data_frame == to_data_frame)) - || any(sapply(private$.links, function(link) link$from_data_frame == to_data_frame && link$to_data_frame == from_data_frame))) -} -) - -instat_object$set("public", "link_between_containing", function(from_data_frame, containing_columns, to_data_frame) { - if(self$link_exists_between(from_data_frame, to_data_frame)) { - curr_link <- self$get_link_between(from_data_frame, to_data_frame) - for(curr_link_pairs in curr_link$link_columns) { - if(curr_link$from_data_frame == from_data_frame) { - if(all(containing_columns %in% names(curr_link_pairs))) { - out <- c() - for(col in containing_columns) { - ind <- which(names(curr_link_pairs) == col) - out <- c(out, curr_link_pairs[[ind]]) - } - return(out) - } - } - else { - if(all(containing_columns %in% curr_link_pairs)) { - out <- c() - for(col in containing_columns) { - ind <- which(curr_link_pairs == col) - out <- c(out, names(curr_link_pairs)[ind]) - } - return(out) - } - } - } - } - return(c()) -} -) - -instat_object$set("public", "get_link_between", function(from_data_frame, to_data_frame) { - for(curr_link in private$.links) { - if((curr_link$from_data_frame == from_data_frame && curr_link$to_data_frame == to_data_frame) || (curr_link$from_data_frame == to_data_frame && curr_link$to_data_frame == from_data_frame)) { - return(curr_link) - } - } - return(NULL) -} -) \ No newline at end of file +# a link can contain multiple ways to link two data frames +link <- R6Class("link", + public = list( + initialize = function(from_data_frame = "", to_data_frame = "", type = "", link_columns = list()) { + self$from_data_frame <- from_data_frame + self$to_data_frame <- to_data_frame + self$type <- type + self$link_columns <- link_columns + }, + from_data_frame = "", + to_data_frame = "", + # TODO Is type needed anymore? + type = "", + # remove calculation + # replace with list of list of pairs of linking columns + # each list of pairs of columns corresponds to a key in the to_data_frame + link_columns = list() + ), + private = list(), + active = list() +) + +link$set("public", "data_clone", function() { + ret <- link$new(from_data_frame = self$from_data_frame, to_data_frame = self$to_data_frame, + type = self$type, link_columns = self$link_columns) + return(ret) +} +) + +instat_object$set("public", "add_link", function(from_data_frame, to_data_frame, link_pairs, type, link_name) { + if(length(names(link_pairs)) != length(link_pairs)) stop("link_pairs must be a named vector or list.") + if(!self$link_exists_between(from_data_frame, to_data_frame)) { + # This means when creating a link to single value data frame, there will be no key in to_data_frame + # Will this cause any issues? + if(length(link_pairs) > 0 && !self$is_key(to_data_frame, link_pairs)) { + message("link columns must be a key in the to_data_frame\nAttempting to create key...") + self$add_key(to_data_frame, as.character(link_pairs)) + message("New key created") + } + new_link <- link$new(from_data_frame = from_data_frame, to_data_frame = to_data_frame, link_columns = list(link_pairs), type = type) + if(missing(link_name)) link_name <- next_default_item("link", names(private$.links)) + if(link_name %in% names(private$.links)) warning("A link called ", link_name, " already exists. It wil be replaced.") + private$.links[[link_name]] <- new_link + } + else { + index <- integer(0) + for(i in 1:length(private$.links)) { + if(private$.links[[i]]$from_data_frame == from_data_frame && private$.links[[i]]$to_data_frame == to_data_frame) { + index <- i + from_on_left <- TRUE + break + } + else if(private$.links[[i]]$from_data_frame == to_data_frame && private$.links[[i]]$to_data_frame == from_data_frame) { + index <- i + from_on_left <- FALSE + break + } + } + # This should never happen because we are inside the Else of link_exists_between + if(length(index) == 0) stop("link not found") + + if(type != private$.links[[index]]$type) stop("Cannot add link of type ", type, ". These data frames are already linked by type: ", private$.links[[index]]$type) + curr_link_columns <- private$.links[[index]]$link_columns + curr_num_links <- length(curr_link_columns) + found <- FALSE + for(curr_link_pairs in curr_link_columns) { + # Are these the right checks on the link columns? + if(from_on_left && length(link_pairs) == length(curr_link_pairs) && (setequal(link_pairs, curr_link_pairs) || setequal(names(link_pairs), names(curr_link_pairs)))) { + message("A link with these columns already exists. A new link will not be added.") + found <- TRUE + break + } + else if(!from_on_left && length(link_pairs) == length(curr_link_pairs) && (setequal(link_pairs, names(curr_link_pairs)) || setequal(names(link_pairs), curr_link_pairs))) { + message("A link with these columns already exists. A new link will not be added.") + found <- TRUE + break + } + } + if(!found) { + if(!self$is_key(to_data_frame, link_pairs)) { + message("link columns must be a key in the to_data_frame\nAttempting to create key...") + self$add_key(to_data_frame, as.character(link_pairs)) + message("new key created") + } + if(from_on_left) private$.links[[index]]$link_columns[[curr_num_links + 1]] <- link_pairs + else { + new_link_pairs <- names(link_pairs) + names(new_link_pairs) <- link_pairs + private$.links[[index]]$link_columns[[curr_num_links + 1]] <- new_link_pairs + } + } + } +} +) + +instat_object$set("public", "get_link_names", function(data_name, include_overall = TRUE, include, exclude, include_empty = FALSE, as_list = FALSE, excluded_items = c(), exclude_self_links = TRUE) { + if(exclude_self_links) { + out <- c() + i <- 1 + for(link in private$.links) { + if(link$from_data_frame != link$to_data_frame) out <- c(out, names(private$.links)[i]) + i <- i + 1 + } + } + else out <- names(private$.links) + if(as_list) { + lst <- list() + lst[[overall_label]] <- out + return(lst) + } + else return(out) +} +) + +instat_object$set("public", "link_exists_from", function(curr_data_frame, link_pairs) { + link_exists <- FALSE + for(curr_link in private$.links) { + if(curr_link$from_data_frame == curr_data_frame) { + for(curr_link_pairs in curr_link$link_columns) { + if(length(link_pairs) == length(curr_link_pairs) && setequal(link_pairs, names(curr_link_pairs))) { + return(TRUE) + break + } + } + } + } + return(FALSE) +} +) + +instat_object$set("public", "link_exists_from_by_to", function(first_data_frame, link_pairs, second_data_frame) { + link_exists <- FALSE + for(curr_link in private$.links) { + if(curr_link$from_data_frame == first_data_frame && curr_link$to_data_frame == second_data_frame) { + for(curr_link_pairs in curr_link$link_columns) { + if(length(link_pairs) == length(curr_link_pairs) && setequal(link_pairs, names(curr_link_pairs))) { + return(TRUE) + break + } + } + } + } + return(FALSE) +} +) + +instat_object$set("public", "get_linked_to_data_name", function(from_data_frame, link_pairs) { + for(curr_link in private$.links) { + if(curr_link$from_data_frame == from_data_frame) { + for(curr_link_pairs in curr_link$link_columns) { + if(length(link_pairs) == length(curr_link_pairs) && setequal(link_pairs, names(curr_link_pairs))) { + return(curr_link$to_data_frame) + } + } + } + } + return("") +} +) + +instat_object$set("public", "get_linked_to_definition", function(from_data_frame, link_pairs) { + to_data_name <- self$get_linked_to_data_name(from_data_frame, link_pairs) + if(to_data_name != "") { + curr_link <- self$get_link_between(from_data_frame, to_data_name) + for(curr_link in private$.links) { + for(curr_link_pairs in curr_link$link_columns) { + if(length(link_pairs) == length(curr_link_pairs) && setequal(link_pairs, names(curr_link_pairs))) { + return(list(to_data_name, as.vector(curr_link_pairs))) + } + } + } + } + return(list()) +} +) + +instat_object$set("public", "get_possible_linked_to_defintion", function(from_data_frame, link_pairs) { + def <- self$get_linked_to_definition(from_data_frame, link_pairs) + if(length(def) != 0) return(def) + else { + prev_data_links <- list(list(from_data_frame, link_pairs)) + continue <- TRUE + while(continue) { + curr_data_links <- prev_data_links + curr_data_names <- sapply(curr_data_links, function(x) x[[1]]) + for(to_data_name in self$get_data_names()) { + i = 1 + for(curr_from_data_frame in curr_data_names) { + curr_link_cols <- self$link_between_containing(curr_from_data_frame, curr_data_links[[i]][[2]], to_data_name) + # Is it enough to check unqiue data frames? + if(length(curr_link_cols) != 0 && !(to_data_name %in% sapply(curr_data_links, function(x) x[[1]]))) { + curr_data_links[[length(curr_data_links) + 1]] <- list(to_data_name, curr_link_cols) + } + i = i + 1 + } + } + if(length(prev_data_links) != length(curr_data_links)) { + curr_data_names <- sapply(curr_data_links, function(x) x[[1]]) + prev_data_names <- sapply(prev_data_links, function(x) x[[1]]) + for(i in seq_along(curr_data_names)) { + if(curr_data_names[i] %in% setdiff(curr_data_names, prev_data_names)) { + def <- self$get_linked_to_definition(curr_data_names[i], curr_data_links[[i]][[2]]) + if(length(def) > 0) return(def) + } + } + prev_data_links <- curr_data_links + } + else continue <- FALSE + } + return(c()) + } +} +) + +instat_object$set("public", "get_equivalent_columns", function(from_data_name, columns, to_data_name) { + if(from_data_name == to_data_name) equivalent_columns <- columns + else equivalent_columns <- self$link_between_containing(from_data_name, columns, to_data_name) + if(length(equivalent_columns) != 0) return(equivalent_columns) + else { + prev_data_links <- list(list(from_data_name, columns)) + continue <- TRUE + while(continue) { + curr_data_links <- prev_data_links + curr_data_names <- sapply(curr_data_links, function(x) x[[1]]) + for(temp_data_name in self$get_data_names()) { + i = 1 + for(curr_from_data_frame in curr_data_names) { + if(curr_from_data_frame == temp_data_name) curr_link_cols <- curr_data_links[[i]][[2]] + curr_link_cols <- self$link_between_containing(curr_from_data_frame, curr_data_links[[i]][[2]], temp_data_name) + if(length(curr_link_cols) != 0) { + if(temp_data_name == to_data_name) { + return(curr_link_cols) + } + else if(!(temp_data_name %in% sapply(curr_data_links, function(x) x[[1]]))) { + curr_data_links[[length(curr_data_links) + 1]] <- list(temp_data_name, curr_link_cols) + } + } + i = i + 1 + } + } + if(length(prev_data_links) == length(curr_data_links)) continue <- FALSE + else prev_data_links <- curr_data_links + } + return(c()) + } +} +) + +instat_object$set("public", "link_exists_between", function(from_data_frame, to_data_frame) { + return(any(sapply(private$.links, function(link) link$from_data_frame == from_data_frame && link$to_data_frame == to_data_frame)) + || any(sapply(private$.links, function(link) link$from_data_frame == to_data_frame && link$to_data_frame == from_data_frame))) +} +) + +instat_object$set("public", "link_between_containing", function(from_data_frame, containing_columns, to_data_frame) { + if(self$link_exists_between(from_data_frame, to_data_frame)) { + curr_link <- self$get_link_between(from_data_frame, to_data_frame) + for(curr_link_pairs in curr_link$link_columns) { + if(curr_link$from_data_frame == from_data_frame) { + if(all(containing_columns %in% names(curr_link_pairs))) { + out <- c() + for(col in containing_columns) { + ind <- which(names(curr_link_pairs) == col) + out <- c(out, curr_link_pairs[[ind]]) + } + return(out) + } + } + else { + if(all(containing_columns %in% curr_link_pairs)) { + out <- c() + for(col in containing_columns) { + ind <- which(curr_link_pairs == col) + out <- c(out, names(curr_link_pairs)[ind]) + } + return(out) + } + } + } + } + return(c()) +} +) + +instat_object$set("public", "get_link_between", function(from_data_frame, to_data_frame) { + for(curr_link in private$.links) { + if((curr_link$from_data_frame == from_data_frame && curr_link$to_data_frame == to_data_frame) || (curr_link$from_data_frame == to_data_frame && curr_link$to_data_frame == from_data_frame)) { + return(curr_link) + } + } + return(NULL) +} +) + +instat_object$set("public", "view_link", function(link_name) { + temp_link <- self$get_links(link_name) + out <- "" + if(length(temp_link) > 0) { + out <- cat(paste( + paste("Link name:", link_name), + paste("From data frame:", temp_link$from_data_frame), + paste("To data frame:", temp_link$to_data_frame), + paste("Link Columns:", paste(names(temp_link$link_columns), "=", temp_link$link_columns, collapse = ", ")), sep = "\n")) + } +} +) diff --git a/instat/static/InstatObject/R/instat_object_R6.R b/instat/static/InstatObject/R/instat_object_R6.R index 6b27bbfaa6b..9413b45aa1a 100644 --- a/instat/static/InstatObject/R/instat_object_R6.R +++ b/instat/static/InstatObject/R/instat_object_R6.R @@ -971,7 +971,7 @@ instat_object$set("public","get_keys", function(data_name, key_name) { instat_object$set("public","get_links", function(link_name) { if(!missing(link_name)) { - if(!link_name %in% names(private$keys)) stop(link_name, " not found.") + if(!link_name %in% names(private$.links)) stop(link_name, " not found.") return(private$.links[[link_name]]) } else return(private$.links) @@ -1117,25 +1117,6 @@ instat_object$set("public", "get_key_names", function(data_name, include_overall } ) -instat_object$set("public", "get_link_names", function(data_name, include_overall = TRUE, include, exclude, include_empty = FALSE, as_list = FALSE, excluded_items = c(), exclude_self_links = TRUE) { - if(exclude_self_links) { - out <- c() - i <- 1 - for(link in private$.links) { - if(link$from_data_frame != link$to_data_frame) out <- c(out, names(private$.links)[i]) - i <- i + 1 - } - } - else out <- names(private$.links) - if(as_list) { - lst <- list() - lst[[overall_label]] <- out - return(lst) - } - else return(out) -} -) - instat_object$set("public", "remove_key", function(data_name, key_name) { self$get_data_objects(data_name)$remove_key(key_name) } From 428826016ea03ceac432c2a017c4b670a1adb4b8 Mon Sep 17 00:00:00 2001 From: John Lunalo Date: Wed, 3 May 2017 05:52:38 +0300 Subject: [PATCH 09/52] more changes --- instat/dlgViewAndRemoveLinks.Designer.vb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/instat/dlgViewAndRemoveLinks.Designer.vb b/instat/dlgViewAndRemoveLinks.Designer.vb index b6e6fdc6029..6fc2ee35c69 100644 --- a/instat/dlgViewAndRemoveLinks.Designer.vb +++ b/instat/dlgViewAndRemoveLinks.Designer.vb @@ -55,10 +55,10 @@ Partial Class dlgViewAndRemoveLinks Me.rdoViewLink.AutoSize = True Me.rdoViewLink.Location = New System.Drawing.Point(163, 99) Me.rdoViewLink.Name = "rdoViewLink" - Me.rdoViewLink.Size = New System.Drawing.Size(90, 17) + Me.rdoViewLink.Size = New System.Drawing.Size(71, 17) Me.rdoViewLink.TabIndex = 14 Me.rdoViewLink.TabStop = True - Me.rdoViewLink.Text = "RadioButton1" + Me.rdoViewLink.Text = "View Link" Me.rdoViewLink.UseVisualStyleBackColor = True ' 'rdoDeleteLink @@ -66,10 +66,10 @@ Partial Class dlgViewAndRemoveLinks Me.rdoDeleteLink.AutoSize = True Me.rdoDeleteLink.Location = New System.Drawing.Point(259, 99) Me.rdoDeleteLink.Name = "rdoDeleteLink" - Me.rdoDeleteLink.Size = New System.Drawing.Size(90, 17) + Me.rdoDeleteLink.Size = New System.Drawing.Size(79, 17) Me.rdoDeleteLink.TabIndex = 15 Me.rdoDeleteLink.TabStop = True - Me.rdoDeleteLink.Text = "RadioButton2" + Me.rdoDeleteLink.Text = "Delete Link" Me.rdoDeleteLink.UseVisualStyleBackColor = True ' 'ucrReceiverViewLinks From 753d886b87d9bdfbbaa49d177d3d14f0ee1441c8 Mon Sep 17 00:00:00 2001 From: John Lunalo Date: Wed, 3 May 2017 11:03:44 +0300 Subject: [PATCH 10/52] more changes --- instat/dlgViewAndRemoveLinks.Designer.vb | 26 ++++++++++++------------ instat/dlgViewAndRemoveLinks.vb | 6 +++--- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/instat/dlgViewAndRemoveLinks.Designer.vb b/instat/dlgViewAndRemoveLinks.Designer.vb index 6fc2ee35c69..bd28ff7820d 100644 --- a/instat/dlgViewAndRemoveLinks.Designer.vb +++ b/instat/dlgViewAndRemoveLinks.Designer.vb @@ -1,9 +1,9 @@ - _ + Partial Class dlgViewAndRemoveLinks Inherits System.Windows.Forms.Form 'Form overrides dispose to clean up the component list. - _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try If disposing AndAlso components IsNot Nothing Then @@ -20,7 +20,7 @@ Partial Class dlgViewAndRemoveLinks 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. - _ + Private Sub InitializeComponent() Me.lblLinks = New System.Windows.Forms.Label() Me.lblLink = New System.Windows.Forms.Label() @@ -28,7 +28,7 @@ Partial Class dlgViewAndRemoveLinks Me.rdoDeleteLink = New System.Windows.Forms.RadioButton() Me.ucrReceiverViewLinks = New instat.ucrReceiverSingle() Me.ucrpnlDeleteView = New instat.UcrPanel() - Me.ucrSlelectorLinks = New instat.ucrSelector() + Me.ucrSelectorLinks = New instat.ucrSelector() Me.ucrBase = New instat.ucrButtons() Me.SuspendLayout() ' @@ -90,14 +90,14 @@ Partial Class dlgViewAndRemoveLinks Me.ucrpnlDeleteView.Size = New System.Drawing.Size(187, 41) Me.ucrpnlDeleteView.TabIndex = 13 ' - 'ucrSlelectorLinks + 'ucrSelectorLinks ' - Me.ucrSlelectorLinks.bShowHiddenColumns = False - Me.ucrSlelectorLinks.Location = New System.Drawing.Point(16, 30) - Me.ucrSlelectorLinks.Margin = New System.Windows.Forms.Padding(0) - Me.ucrSlelectorLinks.Name = "ucrSlelectorLinks" - Me.ucrSlelectorLinks.Size = New System.Drawing.Size(120, 98) - Me.ucrSlelectorLinks.TabIndex = 12 + Me.ucrSelectorLinks.bShowHiddenColumns = False + Me.ucrSelectorLinks.Location = New System.Drawing.Point(16, 30) + Me.ucrSelectorLinks.Margin = New System.Windows.Forms.Padding(0) + Me.ucrSelectorLinks.Name = "ucrSelectorLinks" + Me.ucrSelectorLinks.Size = New System.Drawing.Size(120, 98) + Me.ucrSelectorLinks.TabIndex = 12 ' 'ucrBase ' @@ -115,7 +115,7 @@ Partial Class dlgViewAndRemoveLinks Me.Controls.Add(Me.rdoDeleteLink) Me.Controls.Add(Me.rdoViewLink) Me.Controls.Add(Me.ucrpnlDeleteView) - Me.Controls.Add(Me.ucrSlelectorLinks) + Me.Controls.Add(Me.ucrSelectorLinks) Me.Controls.Add(Me.lblLink) Me.Controls.Add(Me.lblLinks) Me.Controls.Add(Me.ucrBase) @@ -133,7 +133,7 @@ Partial Class dlgViewAndRemoveLinks Friend WithEvents ucrBase As ucrButtons Friend WithEvents lblLinks As Label Friend WithEvents lblLink As Label - Friend WithEvents ucrSlelectorLinks As ucrSelector + Friend WithEvents ucrSelectorLinks As ucrSelector Friend WithEvents rdoDeleteLink As RadioButton Friend WithEvents rdoViewLink As RadioButton Friend WithEvents ucrpnlDeleteView As UcrPanel diff --git a/instat/dlgViewAndRemoveLinks.vb b/instat/dlgViewAndRemoveLinks.vb index 2d234d6e5cb..7f4e5851bbc 100644 --- a/instat/dlgViewAndRemoveLinks.vb +++ b/instat/dlgViewAndRemoveLinks.vb @@ -42,14 +42,14 @@ Public Class dlgViewAndRemoveLinks Private Sub InitialiseDialog() ucrBase.iHelpTopicID = 507 - ucrReceiverViewLinks.Selector = ucrSlelectorLinks + ucrReceiverViewLinks.Selector = ucrSelectorLinks ucrReceiverViewLinks.SetMeAsReceiver() ucrReceiverViewLinks.SetParameter(New RParameter("link_name", 0)) ucrReceiverViewLinks.SetParameterIsString() - ucrReceiverViewLinks.SetItemType("link") + ucrSelectorLinks.SetItemType("link") ucrpnlDeleteView.AddRadioButton(rdoDeleteLink) ucrpnlDeleteView.AddRadioButton(rdoViewLink) - ucrpnlDeleteView.AddFunctionNamesCondition(rdoDeleteLink, frmMain.clsRLink.strInstatDataObject & "c") + ucrpnlDeleteView.AddFunctionNamesCondition(rdoDeleteLink, frmMain.clsRLink.strInstatDataObject & "$remove_link") ucrpnlDeleteView.AddFunctionNamesCondition(rdoViewLink, frmMain.clsRLink.strInstatDataObject & "$view_link") End Sub From 285fb9f0ed121d0ec1ff3239dc27543a178d0af4 Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Wed, 3 May 2017 12:55:41 +0300 Subject: [PATCH 11/52] Adding controls --- instat/dlgTransformClimatic.Designer.vb | 488 +++++++++++++++++++++++- 1 file changed, 486 insertions(+), 2 deletions(-) diff --git a/instat/dlgTransformClimatic.Designer.vb b/instat/dlgTransformClimatic.Designer.vb index 38ab9c5f27e..71129594f90 100644 --- a/instat/dlgTransformClimatic.Designer.vb +++ b/instat/dlgTransformClimatic.Designer.vb @@ -22,21 +22,464 @@ Partial Class dlgTransformClimatic 'Do not modify it using the code editor. _ Private Sub InitializeComponent() + Me.lblYear = New System.Windows.Forms.Label() + Me.lblDate = New System.Windows.Forms.Label() + Me.lblDOY = New System.Windows.Forms.Label() + Me.lblStation = New System.Windows.Forms.Label() + Me.lblData = New System.Windows.Forms.Label() + Me.rdoSpell = New System.Windows.Forms.RadioButton() + Me.rdoSum = New System.Windows.Forms.RadioButton() + Me.rdoCount = New System.Windows.Forms.RadioButton() + Me.rdoWaterBalance = New System.Windows.Forms.RadioButton() + Me.lblThreshold = New System.Windows.Forms.Label() + Me.grpsum = New System.Windows.Forms.GroupBox() + Me.grpWaterBalance = New System.Windows.Forms.GroupBox() + Me.grpSpell = New System.Windows.Forms.GroupBox() + Me.grpCount = New System.Windows.Forms.GroupBox() + Me.lblSumOver = New System.Windows.Forms.Label() + Me.lblSumRows = New System.Windows.Forms.Label() + Me.lblCountRows = New System.Windows.Forms.Label() + Me.lblCountOver = New System.Windows.Forms.Label() + Me.ucrNudCountOver = New instat.ucrNud() + Me.ucrNudSumOver = New instat.ucrNud() + Me.ucrInputSum = New instat.ucrInputComboBox() + Me.ucrNudThreshold = New instat.ucrNud() + Me.ucrPnlTransform = New instat.UcrPanel() + Me.ucrReceiverStation = New instat.ucrReceiverSingle() + Me.ucrSelectorTransform = New instat.ucrSelectorByDataFrameAddRemove() + Me.ucrReceiverYear = New instat.ucrReceiverSingle() + Me.ucrReceiverDate = New instat.ucrReceiverSingle() + Me.ucrReceiverDOY = New instat.ucrReceiverSingle() + Me.ucrReceiverData = New instat.ucrReceiverSingle() Me.ucrBase = New instat.ucrButtons() + Me.ucrChkValuesUnderthreshold = New instat.ucrCheck() + Me.lblSpellAnd = New System.Windows.Forms.Label() + Me.ucrNudSpellLower = New instat.ucrNud() + Me.lblValuesBetween = New System.Windows.Forms.Label() + Me.ucrNudSpellUpper = New instat.ucrNud() + Me.grpsum.SuspendLayout() + Me.grpSpell.SuspendLayout() + Me.grpCount.SuspendLayout() Me.SuspendLayout() ' + 'lblYear + ' + Me.lblYear.AutoSize = True + Me.lblYear.Location = New System.Drawing.Point(315, 142) + Me.lblYear.Name = "lblYear" + Me.lblYear.Size = New System.Drawing.Size(32, 13) + Me.lblYear.TabIndex = 29 + Me.lblYear.Text = "Year:" + ' + 'lblDate + ' + Me.lblDate.AutoSize = True + Me.lblDate.Location = New System.Drawing.Point(314, 96) + Me.lblDate.Name = "lblDate" + Me.lblDate.Size = New System.Drawing.Size(33, 13) + Me.lblDate.TabIndex = 25 + Me.lblDate.Text = "Date:" + ' + 'lblDOY + ' + Me.lblDOY.AutoSize = True + Me.lblDOY.Location = New System.Drawing.Point(314, 184) + Me.lblDOY.Name = "lblDOY" + Me.lblDOY.Size = New System.Drawing.Size(66, 13) + Me.lblDOY.TabIndex = 31 + Me.lblDOY.Text = "Day of Year:" + ' + 'lblStation + ' + Me.lblStation.AutoSize = True + Me.lblStation.Location = New System.Drawing.Point(314, 51) + Me.lblStation.Name = "lblStation" + Me.lblStation.Size = New System.Drawing.Size(43, 13) + Me.lblStation.TabIndex = 35 + Me.lblStation.Text = "Station:" + ' + 'lblData + ' + Me.lblData.AutoSize = True + Me.lblData.Location = New System.Drawing.Point(313, 227) + Me.lblData.Name = "lblData" + Me.lblData.Size = New System.Drawing.Size(70, 13) + Me.lblData.TabIndex = 27 + Me.lblData.Text = "Rain Column:" + ' + 'rdoSpell + ' + Me.rdoSpell.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoSpell.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None + Me.rdoSpell.CheckAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoSpell.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoSpell.FlatAppearance.BorderSize = 2 + Me.rdoSpell.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoSpell.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoSpell.ForeColor = System.Drawing.SystemColors.ActiveCaptionText + Me.rdoSpell.Location = New System.Drawing.Point(247, 17) + Me.rdoSpell.Name = "rdoSpell" + Me.rdoSpell.Size = New System.Drawing.Size(100, 28) + Me.rdoSpell.TabIndex = 40 + Me.rdoSpell.Text = "Spell" + Me.rdoSpell.TextAlign = System.Drawing.ContentAlignment.TopCenter + Me.rdoSpell.UseVisualStyleBackColor = True + ' + 'rdoSum + ' + Me.rdoSum.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoSum.Checked = True + Me.rdoSum.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoSum.FlatAppearance.BorderSize = 2 + Me.rdoSum.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoSum.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoSum.ForeColor = System.Drawing.SystemColors.ControlText + Me.rdoSum.Location = New System.Drawing.Point(49, 17) + Me.rdoSum.Name = "rdoSum" + Me.rdoSum.Size = New System.Drawing.Size(100, 28) + Me.rdoSum.TabIndex = 38 + Me.rdoSum.TabStop = True + Me.rdoSum.Text = "Sum" + Me.rdoSum.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoSum.UseVisualStyleBackColor = True + ' + 'rdoCount + ' + Me.rdoCount.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoCount.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None + Me.rdoCount.CheckAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoCount.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoCount.FlatAppearance.BorderSize = 2 + Me.rdoCount.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoCount.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoCount.ForeColor = System.Drawing.SystemColors.ActiveCaptionText + Me.rdoCount.Location = New System.Drawing.Point(149, 17) + Me.rdoCount.Name = "rdoCount" + Me.rdoCount.Size = New System.Drawing.Size(100, 28) + Me.rdoCount.TabIndex = 39 + Me.rdoCount.Text = "Count" + Me.rdoCount.TextAlign = System.Drawing.ContentAlignment.TopCenter + Me.rdoCount.UseVisualStyleBackColor = True + ' + 'rdoWaterBalance + ' + Me.rdoWaterBalance.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoWaterBalance.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None + Me.rdoWaterBalance.CheckAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoWaterBalance.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoWaterBalance.FlatAppearance.BorderSize = 2 + Me.rdoWaterBalance.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoWaterBalance.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoWaterBalance.ForeColor = System.Drawing.SystemColors.ActiveCaptionText + Me.rdoWaterBalance.Location = New System.Drawing.Point(345, 17) + Me.rdoWaterBalance.Name = "rdoWaterBalance" + Me.rdoWaterBalance.Size = New System.Drawing.Size(100, 28) + Me.rdoWaterBalance.TabIndex = 41 + Me.rdoWaterBalance.Text = "Water Balance" + Me.rdoWaterBalance.TextAlign = System.Drawing.ContentAlignment.TopCenter + Me.rdoWaterBalance.UseVisualStyleBackColor = True + ' + 'lblThreshold + ' + Me.lblThreshold.AutoSize = True + Me.lblThreshold.Location = New System.Drawing.Point(69, 249) + Me.lblThreshold.Name = "lblThreshold" + Me.lblThreshold.Size = New System.Drawing.Size(69, 13) + Me.lblThreshold.TabIndex = 44 + Me.lblThreshold.Tag = "Threshold <=" + Me.lblThreshold.Text = "Threshold <=" + ' + 'grpsum + ' + Me.grpsum.Controls.Add(Me.lblSumRows) + Me.grpsum.Controls.Add(Me.ucrNudSumOver) + Me.grpsum.Controls.Add(Me.lblSumOver) + Me.grpsum.Controls.Add(Me.ucrInputSum) + Me.grpsum.Location = New System.Drawing.Point(27, 275) + Me.grpsum.Name = "grpsum" + Me.grpsum.Size = New System.Drawing.Size(268, 48) + Me.grpsum.TabIndex = 46 + Me.grpsum.TabStop = False + Me.grpsum.Text = "Sum" + ' + 'grpWaterBalance + ' + Me.grpWaterBalance.Location = New System.Drawing.Point(354, 343) + Me.grpWaterBalance.Name = "grpWaterBalance" + Me.grpWaterBalance.Size = New System.Drawing.Size(200, 34) + Me.grpWaterBalance.TabIndex = 47 + Me.grpWaterBalance.TabStop = False + Me.grpWaterBalance.Text = "Water Balance" + ' + 'grpSpell + ' + Me.grpSpell.Controls.Add(Me.ucrNudSpellUpper) + Me.grpSpell.Controls.Add(Me.lblSpellAnd) + Me.grpSpell.Controls.Add(Me.ucrNudSpellLower) + Me.grpSpell.Controls.Add(Me.lblValuesBetween) + Me.grpSpell.Location = New System.Drawing.Point(345, 293) + Me.grpSpell.Name = "grpSpell" + Me.grpSpell.Size = New System.Drawing.Size(255, 44) + Me.grpSpell.TabIndex = 47 + Me.grpSpell.TabStop = False + Me.grpSpell.Text = "Spell" + ' + 'grpCount + ' + Me.grpCount.Controls.Add(Me.ucrChkValuesUnderthreshold) + Me.grpCount.Controls.Add(Me.lblCountRows) + Me.grpCount.Controls.Add(Me.ucrNudCountOver) + Me.grpCount.Controls.Add(Me.lblCountOver) + Me.grpCount.Location = New System.Drawing.Point(43, 329) + Me.grpCount.Name = "grpCount" + Me.grpCount.Size = New System.Drawing.Size(264, 77) + Me.grpCount.TabIndex = 47 + Me.grpCount.TabStop = False + Me.grpCount.Text = "Count" + ' + 'lblSumOver + ' + Me.lblSumOver.AutoSize = True + Me.lblSumOver.Location = New System.Drawing.Point(137, 18) + Me.lblSumOver.Name = "lblSumOver" + Me.lblSumOver.Size = New System.Drawing.Size(30, 13) + Me.lblSumOver.TabIndex = 46 + Me.lblSumOver.Tag = "Over" + Me.lblSumOver.Text = "Over" + ' + 'lblSumRows + ' + Me.lblSumRows.AutoSize = True + Me.lblSumRows.Location = New System.Drawing.Point(229, 18) + Me.lblSumRows.Name = "lblSumRows" + Me.lblSumRows.Size = New System.Drawing.Size(29, 13) + Me.lblSumRows.TabIndex = 48 + Me.lblSumRows.Tag = "rows" + Me.lblSumRows.Text = "rows" + ' + 'lblCountRows + ' + Me.lblCountRows.AutoSize = True + Me.lblCountRows.Location = New System.Drawing.Point(136, 18) + Me.lblCountRows.Name = "lblCountRows" + Me.lblCountRows.Size = New System.Drawing.Size(29, 13) + Me.lblCountRows.TabIndex = 51 + Me.lblCountRows.Tag = "rows" + Me.lblCountRows.Text = "rows" + ' + 'lblCountOver + ' + Me.lblCountOver.AutoSize = True + Me.lblCountOver.Location = New System.Drawing.Point(9, 18) + Me.lblCountOver.Name = "lblCountOver" + Me.lblCountOver.Size = New System.Drawing.Size(61, 13) + Me.lblCountOver.TabIndex = 49 + Me.lblCountOver.Tag = "Count_Over" + Me.lblCountOver.Text = "Count Over" + ' + 'ucrNudCountOver + ' + Me.ucrNudCountOver.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudCountOver.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudCountOver.Location = New System.Drawing.Point(80, 18) + Me.ucrNudCountOver.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudCountOver.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudCountOver.Name = "ucrNudCountOver" + Me.ucrNudCountOver.Size = New System.Drawing.Size(50, 20) + Me.ucrNudCountOver.TabIndex = 50 + Me.ucrNudCountOver.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrNudSumOver + ' + Me.ucrNudSumOver.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudSumOver.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudSumOver.Location = New System.Drawing.Point(173, 18) + Me.ucrNudSumOver.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudSumOver.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudSumOver.Name = "ucrNudSumOver" + Me.ucrNudSumOver.Size = New System.Drawing.Size(50, 20) + Me.ucrNudSumOver.TabIndex = 47 + Me.ucrNudSumOver.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrInputSum + ' + Me.ucrInputSum.AddQuotesIfUnrecognised = True + Me.ucrInputSum.IsReadOnly = False + Me.ucrInputSum.Location = New System.Drawing.Point(16, 18) + Me.ucrInputSum.Name = "ucrInputSum" + Me.ucrInputSum.Size = New System.Drawing.Size(106, 21) + Me.ucrInputSum.TabIndex = 0 + ' + 'ucrNudThreshold + ' + Me.ucrNudThreshold.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudThreshold.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudThreshold.Location = New System.Drawing.Point(144, 249) + Me.ucrNudThreshold.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudThreshold.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudThreshold.Name = "ucrNudThreshold" + Me.ucrNudThreshold.Size = New System.Drawing.Size(50, 20) + Me.ucrNudThreshold.TabIndex = 45 + Me.ucrNudThreshold.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrPnlTransform + ' + Me.ucrPnlTransform.Location = New System.Drawing.Point(27, 16) + Me.ucrPnlTransform.Name = "ucrPnlTransform" + Me.ucrPnlTransform.Size = New System.Drawing.Size(446, 29) + Me.ucrPnlTransform.TabIndex = 37 + ' + 'ucrReceiverStation + ' + Me.ucrReceiverStation.frmParent = Me + Me.ucrReceiverStation.Location = New System.Drawing.Point(313, 66) + Me.ucrReceiverStation.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverStation.Name = "ucrReceiverStation" + Me.ucrReceiverStation.Selector = Nothing + Me.ucrReceiverStation.Size = New System.Drawing.Size(143, 20) + Me.ucrReceiverStation.TabIndex = 36 + Me.ucrReceiverStation.ucrSelector = Nothing + ' + 'ucrSelectorTransform + ' + Me.ucrSelectorTransform.bShowHiddenColumns = False + Me.ucrSelectorTransform.bUseCurrentFilter = True + Me.ucrSelectorTransform.Location = New System.Drawing.Point(9, 60) + Me.ucrSelectorTransform.Margin = New System.Windows.Forms.Padding(0) + Me.ucrSelectorTransform.Name = "ucrSelectorTransform" + Me.ucrSelectorTransform.Size = New System.Drawing.Size(210, 180) + Me.ucrSelectorTransform.TabIndex = 34 + ' + 'ucrReceiverYear + ' + Me.ucrReceiverYear.frmParent = Me + Me.ucrReceiverYear.Location = New System.Drawing.Point(313, 157) + Me.ucrReceiverYear.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverYear.Name = "ucrReceiverYear" + Me.ucrReceiverYear.Selector = Nothing + Me.ucrReceiverYear.Size = New System.Drawing.Size(143, 20) + Me.ucrReceiverYear.TabIndex = 30 + Me.ucrReceiverYear.ucrSelector = Nothing + ' + 'ucrReceiverDate + ' + Me.ucrReceiverDate.frmParent = Me + Me.ucrReceiverDate.Location = New System.Drawing.Point(313, 111) + Me.ucrReceiverDate.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverDate.Name = "ucrReceiverDate" + Me.ucrReceiverDate.Selector = Nothing + Me.ucrReceiverDate.Size = New System.Drawing.Size(143, 20) + Me.ucrReceiverDate.TabIndex = 26 + Me.ucrReceiverDate.ucrSelector = Nothing + ' + 'ucrReceiverDOY + ' + Me.ucrReceiverDOY.frmParent = Me + Me.ucrReceiverDOY.Location = New System.Drawing.Point(313, 199) + Me.ucrReceiverDOY.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverDOY.Name = "ucrReceiverDOY" + Me.ucrReceiverDOY.Selector = Nothing + Me.ucrReceiverDOY.Size = New System.Drawing.Size(143, 20) + Me.ucrReceiverDOY.TabIndex = 32 + Me.ucrReceiverDOY.ucrSelector = Nothing + ' + 'ucrReceiverData + ' + Me.ucrReceiverData.frmParent = Me + Me.ucrReceiverData.Location = New System.Drawing.Point(313, 242) + Me.ucrReceiverData.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverData.Name = "ucrReceiverData" + Me.ucrReceiverData.Selector = Nothing + Me.ucrReceiverData.Size = New System.Drawing.Size(143, 20) + Me.ucrReceiverData.TabIndex = 28 + Me.ucrReceiverData.ucrSelector = Nothing + ' 'ucrBase ' - Me.ucrBase.Location = New System.Drawing.Point(10, 269) + Me.ucrBase.Location = New System.Drawing.Point(43, 412) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(402, 52) Me.ucrBase.TabIndex = 0 ' + 'ucrChkValuesUnderthreshold + ' + Me.ucrChkValuesUnderthreshold.Checked = False + Me.ucrChkValuesUnderthreshold.Location = New System.Drawing.Point(12, 44) + Me.ucrChkValuesUnderthreshold.Name = "ucrChkValuesUnderthreshold" + Me.ucrChkValuesUnderthreshold.Size = New System.Drawing.Size(100, 20) + Me.ucrChkValuesUnderthreshold.TabIndex = 52 + ' + 'lblSpellAnd + ' + Me.lblSpellAnd.AutoSize = True + Me.lblSpellAnd.Location = New System.Drawing.Point(149, 12) + Me.lblSpellAnd.Name = "lblSpellAnd" + Me.lblSpellAnd.Size = New System.Drawing.Size(29, 13) + Me.lblSpellAnd.TabIndex = 54 + Me.lblSpellAnd.Tag = "rows" + Me.lblSpellAnd.Text = "rows" + ' + 'ucrNudSpellLower + ' + Me.ucrNudSpellLower.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudSpellLower.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudSpellLower.Location = New System.Drawing.Point(94, 12) + Me.ucrNudSpellLower.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudSpellLower.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudSpellLower.Name = "ucrNudSpellLower" + Me.ucrNudSpellLower.Size = New System.Drawing.Size(50, 20) + Me.ucrNudSpellLower.TabIndex = 53 + Me.ucrNudSpellLower.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'lblValuesBetween + ' + Me.lblValuesBetween.AutoSize = True + Me.lblValuesBetween.Location = New System.Drawing.Point(6, 12) + Me.lblValuesBetween.Name = "lblValuesBetween" + Me.lblValuesBetween.Size = New System.Drawing.Size(84, 13) + Me.lblValuesBetween.TabIndex = 52 + Me.lblValuesBetween.Tag = "Values_Between" + Me.lblValuesBetween.Text = "Values Between" + ' + 'ucrNudSpellUpper + ' + Me.ucrNudSpellUpper.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudSpellUpper.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudSpellUpper.Location = New System.Drawing.Point(194, 10) + Me.ucrNudSpellUpper.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudSpellUpper.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudSpellUpper.Name = "ucrNudSpellUpper" + Me.ucrNudSpellUpper.Size = New System.Drawing.Size(50, 20) + Me.ucrNudSpellUpper.TabIndex = 55 + Me.ucrNudSpellUpper.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' 'dlgTransformClimatic ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(417, 327) + Me.ClientSize = New System.Drawing.Size(750, 476) + Me.Controls.Add(Me.grpWaterBalance) + Me.Controls.Add(Me.grpSpell) + Me.Controls.Add(Me.grpCount) + Me.Controls.Add(Me.grpsum) + Me.Controls.Add(Me.ucrNudThreshold) + Me.Controls.Add(Me.lblThreshold) + Me.Controls.Add(Me.rdoWaterBalance) + Me.Controls.Add(Me.rdoSpell) + Me.Controls.Add(Me.rdoSum) + Me.Controls.Add(Me.rdoCount) + Me.Controls.Add(Me.ucrPnlTransform) + Me.Controls.Add(Me.lblStation) + Me.Controls.Add(Me.ucrReceiverStation) + Me.Controls.Add(Me.ucrSelectorTransform) + Me.Controls.Add(Me.ucrReceiverYear) + Me.Controls.Add(Me.lblYear) + Me.Controls.Add(Me.lblDate) + Me.Controls.Add(Me.ucrReceiverDate) + Me.Controls.Add(Me.ucrReceiverDOY) + Me.Controls.Add(Me.lblDOY) + Me.Controls.Add(Me.lblData) + Me.Controls.Add(Me.ucrReceiverData) Me.Controls.Add(Me.ucrBase) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False @@ -44,9 +487,50 @@ Partial Class dlgTransformClimatic Me.Name = "dlgTransformClimatic" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Text = "Transform" + Me.grpsum.ResumeLayout(False) + Me.grpsum.PerformLayout() + Me.grpSpell.ResumeLayout(False) + Me.grpSpell.PerformLayout() + Me.grpCount.ResumeLayout(False) + Me.grpCount.PerformLayout() Me.ResumeLayout(False) + Me.PerformLayout() End Sub Friend WithEvents ucrBase As ucrButtons + Friend WithEvents ucrReceiverYear As ucrReceiverSingle + Friend WithEvents lblYear As Label + Friend WithEvents lblDate As Label + Friend WithEvents ucrReceiverDate As ucrReceiverSingle + Friend WithEvents ucrReceiverDOY As ucrReceiverSingle + Friend WithEvents lblDOY As Label + Friend WithEvents lblStation As Label + Friend WithEvents ucrReceiverStation As ucrReceiverSingle + Friend WithEvents ucrSelectorTransform As ucrSelectorByDataFrameAddRemove + Friend WithEvents lblData As Label + Friend WithEvents ucrReceiverData As ucrReceiverSingle + Friend WithEvents rdoWaterBalance As RadioButton + Friend WithEvents rdoSpell As RadioButton + Friend WithEvents rdoSum As RadioButton + Friend WithEvents rdoCount As RadioButton + Friend WithEvents ucrPnlTransform As UcrPanel + Friend WithEvents grpWaterBalance As GroupBox + Friend WithEvents grpSpell As GroupBox + Friend WithEvents grpCount As GroupBox + Friend WithEvents lblCountRows As Label + Friend WithEvents ucrNudCountOver As ucrNud + Friend WithEvents lblCountOver As Label + Friend WithEvents grpsum As GroupBox + Friend WithEvents lblSumRows As Label + Friend WithEvents ucrNudSumOver As ucrNud + Friend WithEvents lblSumOver As Label + Friend WithEvents ucrInputSum As ucrInputComboBox + Friend WithEvents ucrNudThreshold As ucrNud + Friend WithEvents lblThreshold As Label + Friend WithEvents ucrNudSpellUpper As ucrNud + Friend WithEvents lblSpellAnd As Label + Friend WithEvents ucrNudSpellLower As ucrNud + Friend WithEvents lblValuesBetween As Label + Friend WithEvents ucrChkValuesUnderthreshold As ucrCheck End Class From 1ae166307e67b4254568aa8cd495449815fe3474 Mon Sep 17 00:00:00 2001 From: John Lunalo Date: Wed, 3 May 2017 14:45:17 +0300 Subject: [PATCH 12/52] Minor change --- instat/dlgAddKey.vb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/instat/dlgAddKey.vb b/instat/dlgAddKey.vb index 89f955ac170..aed311a584b 100644 --- a/instat/dlgAddKey.vb +++ b/instat/dlgAddKey.vb @@ -66,10 +66,10 @@ Public Class dlgAddKey Private Sub SetDefaults() ucrSelectorKeyColumns.Reset() + ucrInputKeyName.SetName("") ucrInputKeyName.Reset() ucrInputCheckInput.Reset() - bUniqueChecked = False - + bUniqueChecked = False clsDefaultRFunction = New RFunction clsDefaultRFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$add_key") ucrBase.clsRsyntax.SetBaseRFunction(clsDefaultRFunction) From 221c46f38b554e8beaa17630be2dfddaed064d7e Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Fri, 5 May 2017 10:04:33 +0300 Subject: [PATCH 13/52] adding more controls to the designer --- instat/dlgTransformClimatic.Designer.vb | 287 ++++++++++++++---------- instat/dlgTransformClimatic.vb | 1 + 2 files changed, 171 insertions(+), 117 deletions(-) diff --git a/instat/dlgTransformClimatic.Designer.vb b/instat/dlgTransformClimatic.Designer.vb index 71129594f90..3e11b932183 100644 --- a/instat/dlgTransformClimatic.Designer.vb +++ b/instat/dlgTransformClimatic.Designer.vb @@ -33,16 +33,21 @@ Partial Class dlgTransformClimatic Me.rdoWaterBalance = New System.Windows.Forms.RadioButton() Me.lblThreshold = New System.Windows.Forms.Label() Me.grpsum = New System.Windows.Forms.GroupBox() + Me.lblSumRows = New System.Windows.Forms.Label() + Me.ucrNudSumOver = New instat.ucrNud() + Me.lblSumOver = New System.Windows.Forms.Label() + Me.ucrInputSum = New instat.ucrInputComboBox() Me.grpWaterBalance = New System.Windows.Forms.GroupBox() + Me.ucrNudWBCapacity = New instat.ucrNud() + Me.lblWBCapacity = New System.Windows.Forms.Label() Me.grpSpell = New System.Windows.Forms.GroupBox() + Me.lblSpellAnd = New System.Windows.Forms.Label() + Me.lblValuesBetween = New System.Windows.Forms.Label() Me.grpCount = New System.Windows.Forms.GroupBox() - Me.lblSumOver = New System.Windows.Forms.Label() - Me.lblSumRows = New System.Windows.Forms.Label() + Me.ucrChkValuesUnderthreshold = New instat.ucrCheck() Me.lblCountRows = New System.Windows.Forms.Label() - Me.lblCountOver = New System.Windows.Forms.Label() Me.ucrNudCountOver = New instat.ucrNud() - Me.ucrNudSumOver = New instat.ucrNud() - Me.ucrInputSum = New instat.ucrInputComboBox() + Me.lblCountOver = New System.Windows.Forms.Label() Me.ucrNudThreshold = New instat.ucrNud() Me.ucrPnlTransform = New instat.UcrPanel() Me.ucrReceiverStation = New instat.ucrReceiverSingle() @@ -52,12 +57,12 @@ Partial Class dlgTransformClimatic Me.ucrReceiverDOY = New instat.ucrReceiverSingle() Me.ucrReceiverData = New instat.ucrReceiverSingle() Me.ucrBase = New instat.ucrButtons() - Me.ucrChkValuesUnderthreshold = New instat.ucrCheck() - Me.lblSpellAnd = New System.Windows.Forms.Label() - Me.ucrNudSpellLower = New instat.ucrNud() - Me.lblValuesBetween = New System.Windows.Forms.Label() - Me.ucrNudSpellUpper = New instat.ucrNud() + Me.lblWBEvaporation = New System.Windows.Forms.Label() + Me.ucrInputEvaporation = New instat.ucrInputTextBox() + Me.ucrInputSpellLower = New instat.ucrInputTextBox() + Me.ucrInputSpellUpper = New instat.ucrInputTextBox() Me.grpsum.SuspendLayout() + Me.grpWaterBalance.SuspendLayout() Me.grpSpell.SuspendLayout() Me.grpCount.SuspendLayout() Me.SuspendLayout() @@ -197,33 +202,120 @@ Partial Class dlgTransformClimatic Me.grpsum.Controls.Add(Me.ucrInputSum) Me.grpsum.Location = New System.Drawing.Point(27, 275) Me.grpsum.Name = "grpsum" - Me.grpsum.Size = New System.Drawing.Size(268, 48) + Me.grpsum.Size = New System.Drawing.Size(289, 48) Me.grpsum.TabIndex = 46 Me.grpsum.TabStop = False Me.grpsum.Text = "Sum" ' + 'lblSumRows + ' + Me.lblSumRows.AutoSize = True + Me.lblSumRows.Location = New System.Drawing.Point(229, 18) + Me.lblSumRows.Name = "lblSumRows" + Me.lblSumRows.Size = New System.Drawing.Size(29, 13) + Me.lblSumRows.TabIndex = 48 + Me.lblSumRows.Tag = "rows" + Me.lblSumRows.Text = "rows" + ' + 'ucrNudSumOver + ' + Me.ucrNudSumOver.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudSumOver.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudSumOver.Location = New System.Drawing.Point(173, 18) + Me.ucrNudSumOver.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudSumOver.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudSumOver.Name = "ucrNudSumOver" + Me.ucrNudSumOver.Size = New System.Drawing.Size(50, 20) + Me.ucrNudSumOver.TabIndex = 47 + Me.ucrNudSumOver.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'lblSumOver + ' + Me.lblSumOver.AutoSize = True + Me.lblSumOver.Location = New System.Drawing.Point(137, 18) + Me.lblSumOver.Name = "lblSumOver" + Me.lblSumOver.Size = New System.Drawing.Size(30, 13) + Me.lblSumOver.TabIndex = 46 + Me.lblSumOver.Tag = "Over" + Me.lblSumOver.Text = "Over" + ' + 'ucrInputSum + ' + Me.ucrInputSum.AddQuotesIfUnrecognised = True + Me.ucrInputSum.IsReadOnly = False + Me.ucrInputSum.Location = New System.Drawing.Point(16, 18) + Me.ucrInputSum.Name = "ucrInputSum" + Me.ucrInputSum.Size = New System.Drawing.Size(106, 21) + Me.ucrInputSum.TabIndex = 0 + ' 'grpWaterBalance ' + Me.grpWaterBalance.Controls.Add(Me.ucrInputEvaporation) + Me.grpWaterBalance.Controls.Add(Me.lblWBEvaporation) + Me.grpWaterBalance.Controls.Add(Me.ucrNudWBCapacity) + Me.grpWaterBalance.Controls.Add(Me.lblWBCapacity) Me.grpWaterBalance.Location = New System.Drawing.Point(354, 343) Me.grpWaterBalance.Name = "grpWaterBalance" - Me.grpWaterBalance.Size = New System.Drawing.Size(200, 34) + Me.grpWaterBalance.Size = New System.Drawing.Size(284, 50) Me.grpWaterBalance.TabIndex = 47 Me.grpWaterBalance.TabStop = False Me.grpWaterBalance.Text = "Water Balance" ' + 'ucrNudWBCapacity + ' + Me.ucrNudWBCapacity.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudWBCapacity.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudWBCapacity.Location = New System.Drawing.Point(92, 19) + Me.ucrNudWBCapacity.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudWBCapacity.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudWBCapacity.Name = "ucrNudWBCapacity" + Me.ucrNudWBCapacity.Size = New System.Drawing.Size(50, 20) + Me.ucrNudWBCapacity.TabIndex = 47 + Me.ucrNudWBCapacity.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'lblWBCapacity + ' + Me.lblWBCapacity.AutoSize = True + Me.lblWBCapacity.Location = New System.Drawing.Point(38, 20) + Me.lblWBCapacity.Name = "lblWBCapacity" + Me.lblWBCapacity.Size = New System.Drawing.Size(48, 13) + Me.lblWBCapacity.TabIndex = 46 + Me.lblWBCapacity.Tag = "Capacity" + Me.lblWBCapacity.Text = "Capacity" + ' 'grpSpell ' - Me.grpSpell.Controls.Add(Me.ucrNudSpellUpper) + Me.grpSpell.Controls.Add(Me.ucrInputSpellUpper) + Me.grpSpell.Controls.Add(Me.ucrInputSpellLower) Me.grpSpell.Controls.Add(Me.lblSpellAnd) - Me.grpSpell.Controls.Add(Me.ucrNudSpellLower) Me.grpSpell.Controls.Add(Me.lblValuesBetween) - Me.grpSpell.Location = New System.Drawing.Point(345, 293) + Me.grpSpell.Location = New System.Drawing.Point(345, 265) Me.grpSpell.Name = "grpSpell" - Me.grpSpell.Size = New System.Drawing.Size(255, 44) + Me.grpSpell.Size = New System.Drawing.Size(255, 41) Me.grpSpell.TabIndex = 47 Me.grpSpell.TabStop = False Me.grpSpell.Text = "Spell" ' + 'lblSpellAnd + ' + Me.lblSpellAnd.AutoSize = True + Me.lblSpellAnd.Location = New System.Drawing.Point(149, 12) + Me.lblSpellAnd.Name = "lblSpellAnd" + Me.lblSpellAnd.Size = New System.Drawing.Size(25, 13) + Me.lblSpellAnd.TabIndex = 54 + Me.lblSpellAnd.Tag = "and" + Me.lblSpellAnd.Text = "and" + ' + 'lblValuesBetween + ' + Me.lblValuesBetween.AutoSize = True + Me.lblValuesBetween.Location = New System.Drawing.Point(6, 12) + Me.lblValuesBetween.Name = "lblValuesBetween" + Me.lblValuesBetween.Size = New System.Drawing.Size(84, 13) + Me.lblValuesBetween.TabIndex = 52 + Me.lblValuesBetween.Tag = "Values_Between" + Me.lblValuesBetween.Text = "Values Between" + ' 'grpCount ' Me.grpCount.Controls.Add(Me.ucrChkValuesUnderthreshold) @@ -237,25 +329,13 @@ Partial Class dlgTransformClimatic Me.grpCount.TabStop = False Me.grpCount.Text = "Count" ' - 'lblSumOver - ' - Me.lblSumOver.AutoSize = True - Me.lblSumOver.Location = New System.Drawing.Point(137, 18) - Me.lblSumOver.Name = "lblSumOver" - Me.lblSumOver.Size = New System.Drawing.Size(30, 13) - Me.lblSumOver.TabIndex = 46 - Me.lblSumOver.Tag = "Over" - Me.lblSumOver.Text = "Over" - ' - 'lblSumRows + 'ucrChkValuesUnderthreshold ' - Me.lblSumRows.AutoSize = True - Me.lblSumRows.Location = New System.Drawing.Point(229, 18) - Me.lblSumRows.Name = "lblSumRows" - Me.lblSumRows.Size = New System.Drawing.Size(29, 13) - Me.lblSumRows.TabIndex = 48 - Me.lblSumRows.Tag = "rows" - Me.lblSumRows.Text = "rows" + Me.ucrChkValuesUnderthreshold.Checked = False + Me.ucrChkValuesUnderthreshold.Location = New System.Drawing.Point(12, 44) + Me.ucrChkValuesUnderthreshold.Name = "ucrChkValuesUnderthreshold" + Me.ucrChkValuesUnderthreshold.Size = New System.Drawing.Size(100, 20) + Me.ucrChkValuesUnderthreshold.TabIndex = 52 ' 'lblCountRows ' @@ -267,16 +347,6 @@ Partial Class dlgTransformClimatic Me.lblCountRows.Tag = "rows" Me.lblCountRows.Text = "rows" ' - 'lblCountOver - ' - Me.lblCountOver.AutoSize = True - Me.lblCountOver.Location = New System.Drawing.Point(9, 18) - Me.lblCountOver.Name = "lblCountOver" - Me.lblCountOver.Size = New System.Drawing.Size(61, 13) - Me.lblCountOver.TabIndex = 49 - Me.lblCountOver.Tag = "Count_Over" - Me.lblCountOver.Text = "Count Over" - ' 'ucrNudCountOver ' Me.ucrNudCountOver.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) @@ -289,26 +359,15 @@ Partial Class dlgTransformClimatic Me.ucrNudCountOver.TabIndex = 50 Me.ucrNudCountOver.Value = New Decimal(New Integer() {0, 0, 0, 0}) ' - 'ucrNudSumOver - ' - Me.ucrNudSumOver.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudSumOver.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudSumOver.Location = New System.Drawing.Point(173, 18) - Me.ucrNudSumOver.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudSumOver.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudSumOver.Name = "ucrNudSumOver" - Me.ucrNudSumOver.Size = New System.Drawing.Size(50, 20) - Me.ucrNudSumOver.TabIndex = 47 - Me.ucrNudSumOver.Value = New Decimal(New Integer() {0, 0, 0, 0}) - ' - 'ucrInputSum + 'lblCountOver ' - Me.ucrInputSum.AddQuotesIfUnrecognised = True - Me.ucrInputSum.IsReadOnly = False - Me.ucrInputSum.Location = New System.Drawing.Point(16, 18) - Me.ucrInputSum.Name = "ucrInputSum" - Me.ucrInputSum.Size = New System.Drawing.Size(106, 21) - Me.ucrInputSum.TabIndex = 0 + Me.lblCountOver.AutoSize = True + Me.lblCountOver.Location = New System.Drawing.Point(9, 18) + Me.lblCountOver.Name = "lblCountOver" + Me.lblCountOver.Size = New System.Drawing.Size(61, 13) + Me.lblCountOver.TabIndex = 49 + Me.lblCountOver.Tag = "Count_Over" + Me.lblCountOver.Text = "Count Over" ' 'ucrNudThreshold ' @@ -401,63 +460,51 @@ Partial Class dlgTransformClimatic Me.ucrBase.Size = New System.Drawing.Size(402, 52) Me.ucrBase.TabIndex = 0 ' - 'ucrChkValuesUnderthreshold - ' - Me.ucrChkValuesUnderthreshold.Checked = False - Me.ucrChkValuesUnderthreshold.Location = New System.Drawing.Point(12, 44) - Me.ucrChkValuesUnderthreshold.Name = "ucrChkValuesUnderthreshold" - Me.ucrChkValuesUnderthreshold.Size = New System.Drawing.Size(100, 20) - Me.ucrChkValuesUnderthreshold.TabIndex = 52 - ' - 'lblSpellAnd - ' - Me.lblSpellAnd.AutoSize = True - Me.lblSpellAnd.Location = New System.Drawing.Point(149, 12) - Me.lblSpellAnd.Name = "lblSpellAnd" - Me.lblSpellAnd.Size = New System.Drawing.Size(29, 13) - Me.lblSpellAnd.TabIndex = 54 - Me.lblSpellAnd.Tag = "rows" - Me.lblSpellAnd.Text = "rows" - ' - 'ucrNudSpellLower - ' - Me.ucrNudSpellLower.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudSpellLower.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudSpellLower.Location = New System.Drawing.Point(94, 12) - Me.ucrNudSpellLower.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudSpellLower.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudSpellLower.Name = "ucrNudSpellLower" - Me.ucrNudSpellLower.Size = New System.Drawing.Size(50, 20) - Me.ucrNudSpellLower.TabIndex = 53 - Me.ucrNudSpellLower.Value = New Decimal(New Integer() {0, 0, 0, 0}) - ' - 'lblValuesBetween - ' - Me.lblValuesBetween.AutoSize = True - Me.lblValuesBetween.Location = New System.Drawing.Point(6, 12) - Me.lblValuesBetween.Name = "lblValuesBetween" - Me.lblValuesBetween.Size = New System.Drawing.Size(84, 13) - Me.lblValuesBetween.TabIndex = 52 - Me.lblValuesBetween.Tag = "Values_Between" - Me.lblValuesBetween.Text = "Values Between" - ' - 'ucrNudSpellUpper - ' - Me.ucrNudSpellUpper.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudSpellUpper.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudSpellUpper.Location = New System.Drawing.Point(194, 10) - Me.ucrNudSpellUpper.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudSpellUpper.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudSpellUpper.Name = "ucrNudSpellUpper" - Me.ucrNudSpellUpper.Size = New System.Drawing.Size(50, 20) - Me.ucrNudSpellUpper.TabIndex = 55 - Me.ucrNudSpellUpper.Value = New Decimal(New Integer() {0, 0, 0, 0}) + 'lblWBEvaporation + ' + Me.lblWBEvaporation.AutoSize = True + Me.lblWBEvaporation.Location = New System.Drawing.Point(140, 20) + Me.lblWBEvaporation.Name = "lblWBEvaporation" + Me.lblWBEvaporation.Size = New System.Drawing.Size(64, 13) + Me.lblWBEvaporation.TabIndex = 48 + Me.lblWBEvaporation.Tag = "Evaporation" + Me.lblWBEvaporation.Text = "Evaporation" + ' + 'ucrInputEvaporation + ' + Me.ucrInputEvaporation.AddQuotesIfUnrecognised = True + Me.ucrInputEvaporation.IsMultiline = False + Me.ucrInputEvaporation.IsReadOnly = False + Me.ucrInputEvaporation.Location = New System.Drawing.Point(210, 19) + Me.ucrInputEvaporation.Name = "ucrInputEvaporation" + Me.ucrInputEvaporation.Size = New System.Drawing.Size(63, 21) + Me.ucrInputEvaporation.TabIndex = 49 + ' + 'ucrInputSpellLower + ' + Me.ucrInputSpellLower.AddQuotesIfUnrecognised = True + Me.ucrInputSpellLower.IsMultiline = False + Me.ucrInputSpellLower.IsReadOnly = False + Me.ucrInputSpellLower.Location = New System.Drawing.Point(88, 10) + Me.ucrInputSpellLower.Name = "ucrInputSpellLower" + Me.ucrInputSpellLower.Size = New System.Drawing.Size(63, 21) + Me.ucrInputSpellLower.TabIndex = 56 + ' + 'ucrInputSpellUpper + ' + Me.ucrInputSpellUpper.AddQuotesIfUnrecognised = True + Me.ucrInputSpellUpper.IsMultiline = False + Me.ucrInputSpellUpper.IsReadOnly = False + Me.ucrInputSpellUpper.Location = New System.Drawing.Point(186, 12) + Me.ucrInputSpellUpper.Name = "ucrInputSpellUpper" + Me.ucrInputSpellUpper.Size = New System.Drawing.Size(63, 21) + Me.ucrInputSpellUpper.TabIndex = 57 ' 'dlgTransformClimatic ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(750, 476) + Me.ClientSize = New System.Drawing.Size(650, 476) Me.Controls.Add(Me.grpWaterBalance) Me.Controls.Add(Me.grpSpell) Me.Controls.Add(Me.grpCount) @@ -489,6 +536,8 @@ Partial Class dlgTransformClimatic Me.Text = "Transform" Me.grpsum.ResumeLayout(False) Me.grpsum.PerformLayout() + Me.grpWaterBalance.ResumeLayout(False) + Me.grpWaterBalance.PerformLayout() Me.grpSpell.ResumeLayout(False) Me.grpSpell.PerformLayout() Me.grpCount.ResumeLayout(False) @@ -528,9 +577,13 @@ Partial Class dlgTransformClimatic Friend WithEvents ucrInputSum As ucrInputComboBox Friend WithEvents ucrNudThreshold As ucrNud Friend WithEvents lblThreshold As Label - Friend WithEvents ucrNudSpellUpper As ucrNud Friend WithEvents lblSpellAnd As Label - Friend WithEvents ucrNudSpellLower As ucrNud Friend WithEvents lblValuesBetween As Label Friend WithEvents ucrChkValuesUnderthreshold As ucrCheck + Friend WithEvents ucrNudWBCapacity As ucrNud + Friend WithEvents lblWBCapacity As Label + Friend WithEvents ucrInputEvaporation As ucrInputTextBox + Friend WithEvents lblWBEvaporation As Label + Friend WithEvents ucrInputSpellUpper As ucrInputTextBox + Friend WithEvents ucrInputSpellLower As ucrInputTextBox End Class diff --git a/instat/dlgTransformClimatic.vb b/instat/dlgTransformClimatic.vb index e947518823e..b56c139577c 100644 --- a/instat/dlgTransformClimatic.vb +++ b/instat/dlgTransformClimatic.vb @@ -52,4 +52,5 @@ Public Class dlgTransformClimatic SetRCodeForControls(True) TestOkEnabled() End Sub + End Class \ No newline at end of file From 73898ece9998775f7d57377a4aa7f4ff6720a28b Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Fri, 5 May 2017 10:11:57 +0300 Subject: [PATCH 14/52] adding save control and radio buttons code --- instat/dlgTransformClimatic.Designer.vb | 15 +++++++++++++-- instat/dlgTransformClimatic.vb | 11 +++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/instat/dlgTransformClimatic.Designer.vb b/instat/dlgTransformClimatic.Designer.vb index 3e11b932183..a89eaac9b0c 100644 --- a/instat/dlgTransformClimatic.Designer.vb +++ b/instat/dlgTransformClimatic.Designer.vb @@ -61,6 +61,7 @@ Partial Class dlgTransformClimatic Me.ucrInputEvaporation = New instat.ucrInputTextBox() Me.ucrInputSpellLower = New instat.ucrInputTextBox() Me.ucrInputSpellUpper = New instat.ucrInputTextBox() + Me.ucrSaveTransform = New instat.ucrSave() Me.grpsum.SuspendLayout() Me.grpWaterBalance.SuspendLayout() Me.grpSpell.SuspendLayout() @@ -455,7 +456,7 @@ Partial Class dlgTransformClimatic ' 'ucrBase ' - Me.ucrBase.Location = New System.Drawing.Point(43, 412) + Me.ucrBase.Location = New System.Drawing.Point(38, 438) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(402, 52) Me.ucrBase.TabIndex = 0 @@ -500,11 +501,20 @@ Partial Class dlgTransformClimatic Me.ucrInputSpellUpper.Size = New System.Drawing.Size(63, 21) Me.ucrInputSpellUpper.TabIndex = 57 ' + 'ucrSaveTransform + ' + Me.ucrSaveTransform.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrSaveTransform.Location = New System.Drawing.Point(43, 413) + Me.ucrSaveTransform.Name = "ucrSaveTransform" + Me.ucrSaveTransform.Size = New System.Drawing.Size(423, 24) + Me.ucrSaveTransform.TabIndex = 48 + ' 'dlgTransformClimatic ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(650, 476) + Me.ClientSize = New System.Drawing.Size(650, 492) + Me.Controls.Add(Me.ucrSaveTransform) Me.Controls.Add(Me.grpWaterBalance) Me.Controls.Add(Me.grpSpell) Me.Controls.Add(Me.grpCount) @@ -586,4 +596,5 @@ Partial Class dlgTransformClimatic Friend WithEvents lblWBEvaporation As Label Friend WithEvents ucrInputSpellUpper As ucrInputTextBox Friend WithEvents ucrInputSpellLower As ucrInputTextBox + Friend WithEvents ucrSaveTransform As ucrSave End Class diff --git a/instat/dlgTransformClimatic.vb b/instat/dlgTransformClimatic.vb index b56c139577c..f7cf6a1e5dc 100644 --- a/instat/dlgTransformClimatic.vb +++ b/instat/dlgTransformClimatic.vb @@ -33,6 +33,17 @@ Public Class dlgTransformClimatic Private Sub InitialiseDialog() + 'ucrRdoOptions + ucrPnlTransform.AddRadioButton(rdoSum) + ucrPnlTransform.AddRadioButton(rdoCount) + ucrPnlTransform.AddRadioButton(rdoSpell) + ucrPnlTransform.AddRadioButton(rdoWaterBalance) + + ucrPnlTransform.AddFunctionNamesCondition(rdoSum, "str_count") + ucrPnlTransform.AddFunctionNamesCondition(rdoCount, "str_extract") + ucrPnlTransform.AddFunctionNamesCondition(rdoSpell, "str_detect") + ucrPnlTransform.AddFunctionNamesCondition(rdoWaterBalance, "str_locate") + End Sub Private Sub SetDefaults() From 5c4c04b0b827bcdeab50dbe9fb3dbe526fbad7fb Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Fri, 5 May 2017 10:13:09 +0300 Subject: [PATCH 15/52] edits --- instat/dlgTransformClimatic.vb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/instat/dlgTransformClimatic.vb b/instat/dlgTransformClimatic.vb index f7cf6a1e5dc..42adeaa217c 100644 --- a/instat/dlgTransformClimatic.vb +++ b/instat/dlgTransformClimatic.vb @@ -39,10 +39,10 @@ Public Class dlgTransformClimatic ucrPnlTransform.AddRadioButton(rdoSpell) ucrPnlTransform.AddRadioButton(rdoWaterBalance) - ucrPnlTransform.AddFunctionNamesCondition(rdoSum, "str_count") - ucrPnlTransform.AddFunctionNamesCondition(rdoCount, "str_extract") - ucrPnlTransform.AddFunctionNamesCondition(rdoSpell, "str_detect") - ucrPnlTransform.AddFunctionNamesCondition(rdoWaterBalance, "str_locate") + ucrPnlTransform.AddFunctionNamesCondition(rdoSum, "") + ucrPnlTransform.AddFunctionNamesCondition(rdoCount, "") + ucrPnlTransform.AddFunctionNamesCondition(rdoSpell, "") + ucrPnlTransform.AddFunctionNamesCondition(rdoWaterBalance, "") End Sub From 45b1acff7e536b6a68f6f96e6d8e7cb7d6d54005 Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Fri, 5 May 2017 10:22:19 +0300 Subject: [PATCH 16/52] adding code to receivers --- instat/dlgTransformClimatic.vb | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/instat/dlgTransformClimatic.vb b/instat/dlgTransformClimatic.vb index 42adeaa217c..07fb74e2a55 100644 --- a/instat/dlgTransformClimatic.vb +++ b/instat/dlgTransformClimatic.vb @@ -32,8 +32,24 @@ Public Class dlgTransformClimatic End Sub Private Sub InitialiseDialog() + ucrReceiverStation.Selector = ucrSelectorTransform + ucrReceiverYear.Selector = ucrSelectorTransform + ucrReceiverDate.Selector = ucrSelectorTransform + ucrReceiverDOY.Selector = ucrSelectorTransform + ucrReceiverData.Selector = ucrSelectorTransform + ucrReceiverDate.SetMeAsReceiver() + ucrReceiverStation.AddIncludedMetadataProperty("Climatic_Type", {Chr(34) & "station" & Chr(34)}) + ucrReceiverDate.AddIncludedMetadataProperty("Climatic_Type", {Chr(34) & "date" & Chr(34)}) + ucrReceiverDOY.AddIncludedMetadataProperty("Climatic_Type", {Chr(34) & "doy" & Chr(34)}) + 'this is not right + ucrReceiverData.AddIncludedMetadataProperty("Climatic_Type", {Chr(34) & "rain" & Chr(34)}) + ucrReceiverYear.AddIncludedMetadataProperty("Climatic_Type", {Chr(34) & "year" & Chr(34)}) + ucrReceiverStation.bAutoFill = True + ucrReceiverDate.bAutoFill = True + ucrReceiverDOY.bAutoFill = True + ucrReceiverData.bAutoFill = True + ucrReceiverYear.bAutoFill = True - 'ucrRdoOptions ucrPnlTransform.AddRadioButton(rdoSum) ucrPnlTransform.AddRadioButton(rdoCount) ucrPnlTransform.AddRadioButton(rdoSpell) From b72e44e546f92162ffd183dc1622f4cc69510163 Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Fri, 5 May 2017 10:48:42 +0300 Subject: [PATCH 17/52] adding r-functions --- instat/dlgTransformClimatic.vb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/instat/dlgTransformClimatic.vb b/instat/dlgTransformClimatic.vb index 07fb74e2a55..f274968048c 100644 --- a/instat/dlgTransformClimatic.vb +++ b/instat/dlgTransformClimatic.vb @@ -17,6 +17,7 @@ Imports instat.Translations Public Class dlgTransformClimatic Private bFirstload As Boolean = True Private bReset As Boolean = True + Private clsSumFunction, clsCountFunction, clsSpellFunction, clsWaterBalanceFunction As New RFunction Private Sub dlgTransformClimatic_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstload Then InitialiseDialog() @@ -60,9 +61,20 @@ Public Class dlgTransformClimatic ucrPnlTransform.AddFunctionNamesCondition(rdoSpell, "") ucrPnlTransform.AddFunctionNamesCondition(rdoWaterBalance, "") + ucrSaveTransform.SetDataFrameSelector(ucrSelectorTransform.ucrAvailableDataFrames) + ucrSaveTransform.SetLabelText("New Column Name:") + ucrSaveTransform.SetIsTextBox() + ucrSaveTransform.SetPrefix("Sum") + ucrSaveTransform.SetSaveTypeAsColumn() End Sub Private Sub SetDefaults() + clsSumFunction = New RFunction + clsCountFunction = New RFunction + clsSpellFunction = New RFunction + clsWaterBalanceFunction = New RFunction + ucrSaveTransform.Reset() + ucrSelectorTransform.Reset() End Sub From ff2159004b39a9aae9916c1cee3d999065ea1098 Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Fri, 5 May 2017 12:06:39 +0300 Subject: [PATCH 18/52] implementing different save options --- instat/dlgTransformClimatic.Designer.vb | 88 ++++++++++++------------- instat/dlgTransformClimatic.vb | 16 +++++ 2 files changed, 60 insertions(+), 44 deletions(-) diff --git a/instat/dlgTransformClimatic.Designer.vb b/instat/dlgTransformClimatic.Designer.vb index a89eaac9b0c..b5259f4cea3 100644 --- a/instat/dlgTransformClimatic.Designer.vb +++ b/instat/dlgTransformClimatic.Designer.vb @@ -38,9 +38,13 @@ Partial Class dlgTransformClimatic Me.lblSumOver = New System.Windows.Forms.Label() Me.ucrInputSum = New instat.ucrInputComboBox() Me.grpWaterBalance = New System.Windows.Forms.GroupBox() + Me.ucrInputEvaporation = New instat.ucrInputTextBox() + Me.lblWBEvaporation = New System.Windows.Forms.Label() Me.ucrNudWBCapacity = New instat.ucrNud() Me.lblWBCapacity = New System.Windows.Forms.Label() Me.grpSpell = New System.Windows.Forms.GroupBox() + Me.ucrInputSpellUpper = New instat.ucrInputTextBox() + Me.ucrInputSpellLower = New instat.ucrInputTextBox() Me.lblSpellAnd = New System.Windows.Forms.Label() Me.lblValuesBetween = New System.Windows.Forms.Label() Me.grpCount = New System.Windows.Forms.GroupBox() @@ -57,10 +61,6 @@ Partial Class dlgTransformClimatic Me.ucrReceiverDOY = New instat.ucrReceiverSingle() Me.ucrReceiverData = New instat.ucrReceiverSingle() Me.ucrBase = New instat.ucrButtons() - Me.lblWBEvaporation = New System.Windows.Forms.Label() - Me.ucrInputEvaporation = New instat.ucrInputTextBox() - Me.ucrInputSpellLower = New instat.ucrInputTextBox() - Me.ucrInputSpellUpper = New instat.ucrInputTextBox() Me.ucrSaveTransform = New instat.ucrSave() Me.grpsum.SuspendLayout() Me.grpWaterBalance.SuspendLayout() @@ -262,6 +262,26 @@ Partial Class dlgTransformClimatic Me.grpWaterBalance.TabStop = False Me.grpWaterBalance.Text = "Water Balance" ' + 'ucrInputEvaporation + ' + Me.ucrInputEvaporation.AddQuotesIfUnrecognised = True + Me.ucrInputEvaporation.IsMultiline = False + Me.ucrInputEvaporation.IsReadOnly = False + Me.ucrInputEvaporation.Location = New System.Drawing.Point(210, 19) + Me.ucrInputEvaporation.Name = "ucrInputEvaporation" + Me.ucrInputEvaporation.Size = New System.Drawing.Size(63, 21) + Me.ucrInputEvaporation.TabIndex = 49 + ' + 'lblWBEvaporation + ' + Me.lblWBEvaporation.AutoSize = True + Me.lblWBEvaporation.Location = New System.Drawing.Point(140, 20) + Me.lblWBEvaporation.Name = "lblWBEvaporation" + Me.lblWBEvaporation.Size = New System.Drawing.Size(64, 13) + Me.lblWBEvaporation.TabIndex = 48 + Me.lblWBEvaporation.Tag = "Evaporation" + Me.lblWBEvaporation.Text = "Evaporation" + ' 'ucrNudWBCapacity ' Me.ucrNudWBCapacity.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) @@ -297,6 +317,26 @@ Partial Class dlgTransformClimatic Me.grpSpell.TabStop = False Me.grpSpell.Text = "Spell" ' + 'ucrInputSpellUpper + ' + Me.ucrInputSpellUpper.AddQuotesIfUnrecognised = True + Me.ucrInputSpellUpper.IsMultiline = False + Me.ucrInputSpellUpper.IsReadOnly = False + Me.ucrInputSpellUpper.Location = New System.Drawing.Point(186, 12) + Me.ucrInputSpellUpper.Name = "ucrInputSpellUpper" + Me.ucrInputSpellUpper.Size = New System.Drawing.Size(63, 21) + Me.ucrInputSpellUpper.TabIndex = 57 + ' + 'ucrInputSpellLower + ' + Me.ucrInputSpellLower.AddQuotesIfUnrecognised = True + Me.ucrInputSpellLower.IsMultiline = False + Me.ucrInputSpellLower.IsReadOnly = False + Me.ucrInputSpellLower.Location = New System.Drawing.Point(88, 10) + Me.ucrInputSpellLower.Name = "ucrInputSpellLower" + Me.ucrInputSpellLower.Size = New System.Drawing.Size(63, 21) + Me.ucrInputSpellLower.TabIndex = 56 + ' 'lblSpellAnd ' Me.lblSpellAnd.AutoSize = True @@ -461,46 +501,6 @@ Partial Class dlgTransformClimatic Me.ucrBase.Size = New System.Drawing.Size(402, 52) Me.ucrBase.TabIndex = 0 ' - 'lblWBEvaporation - ' - Me.lblWBEvaporation.AutoSize = True - Me.lblWBEvaporation.Location = New System.Drawing.Point(140, 20) - Me.lblWBEvaporation.Name = "lblWBEvaporation" - Me.lblWBEvaporation.Size = New System.Drawing.Size(64, 13) - Me.lblWBEvaporation.TabIndex = 48 - Me.lblWBEvaporation.Tag = "Evaporation" - Me.lblWBEvaporation.Text = "Evaporation" - ' - 'ucrInputEvaporation - ' - Me.ucrInputEvaporation.AddQuotesIfUnrecognised = True - Me.ucrInputEvaporation.IsMultiline = False - Me.ucrInputEvaporation.IsReadOnly = False - Me.ucrInputEvaporation.Location = New System.Drawing.Point(210, 19) - Me.ucrInputEvaporation.Name = "ucrInputEvaporation" - Me.ucrInputEvaporation.Size = New System.Drawing.Size(63, 21) - Me.ucrInputEvaporation.TabIndex = 49 - ' - 'ucrInputSpellLower - ' - Me.ucrInputSpellLower.AddQuotesIfUnrecognised = True - Me.ucrInputSpellLower.IsMultiline = False - Me.ucrInputSpellLower.IsReadOnly = False - Me.ucrInputSpellLower.Location = New System.Drawing.Point(88, 10) - Me.ucrInputSpellLower.Name = "ucrInputSpellLower" - Me.ucrInputSpellLower.Size = New System.Drawing.Size(63, 21) - Me.ucrInputSpellLower.TabIndex = 56 - ' - 'ucrInputSpellUpper - ' - Me.ucrInputSpellUpper.AddQuotesIfUnrecognised = True - Me.ucrInputSpellUpper.IsMultiline = False - Me.ucrInputSpellUpper.IsReadOnly = False - Me.ucrInputSpellUpper.Location = New System.Drawing.Point(186, 12) - Me.ucrInputSpellUpper.Name = "ucrInputSpellUpper" - Me.ucrInputSpellUpper.Size = New System.Drawing.Size(63, 21) - Me.ucrInputSpellUpper.TabIndex = 57 - ' 'ucrSaveTransform ' Me.ucrSaveTransform.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink diff --git a/instat/dlgTransformClimatic.vb b/instat/dlgTransformClimatic.vb index f274968048c..6e11be51f8b 100644 --- a/instat/dlgTransformClimatic.vb +++ b/instat/dlgTransformClimatic.vb @@ -13,6 +13,7 @@ ' ' You should have received a copy of the GNU General Public License k ' along with this program. If not, see . +Imports instat Imports instat.Translations Public Class dlgTransformClimatic Private bFirstload As Boolean = True @@ -78,6 +79,10 @@ Public Class dlgTransformClimatic End Sub + Private Sub ucrPnlTransform_Load(sender As Object, e As EventArgs) Handles ucrPnlTransform.Load + + End Sub + Private Sub SetRCodeForControls(bReset As Boolean) End Sub @@ -92,4 +97,15 @@ Public Class dlgTransformClimatic TestOkEnabled() End Sub + Private Sub ucrPnlTransform_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrPnlTransform.ControlContentsChanged + If rdoSum.Checked Then + ucrSaveTransform.SetPrefix("Sum") + ElseIf rdoCount.Checked Then + ucrSaveTransform.SetPrefix("Count") + ElseIf rdoSpell.Checked Then + ucrSaveTransform.SetPrefix("Spell") + ElseIf rdoWaterBalance.Checked Then + ucrSaveTransform.SetPrefix("Water_balance") + End If + End Sub End Class \ No newline at end of file From f650b372af2c983a21a948fa210516433fc478da Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Fri, 5 May 2017 12:58:21 +0300 Subject: [PATCH 19/52] implementing dictionary contents for comboo box and numeric updowns. --- instat/dlgTransformClimatic.vb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/instat/dlgTransformClimatic.vb b/instat/dlgTransformClimatic.vb index 6e11be51f8b..92b7ae70912 100644 --- a/instat/dlgTransformClimatic.vb +++ b/instat/dlgTransformClimatic.vb @@ -18,6 +18,7 @@ Imports instat.Translations Public Class dlgTransformClimatic Private bFirstload As Boolean = True Private bReset As Boolean = True + Private clsSumFunction, clsCountFunction, clsSpellFunction, clsWaterBalanceFunction As New RFunction Private Sub dlgTransformClimatic_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstload Then @@ -34,6 +35,7 @@ Public Class dlgTransformClimatic End Sub Private Sub InitialiseDialog() + Dim dctInputSumPairs As New Dictionary(Of String, String) ucrReceiverStation.Selector = ucrSelectorTransform ucrReceiverYear.Selector = ucrSelectorTransform ucrReceiverDate.Selector = ucrSelectorTransform @@ -62,6 +64,24 @@ Public Class dlgTransformClimatic ucrPnlTransform.AddFunctionNamesCondition(rdoSpell, "") ucrPnlTransform.AddFunctionNamesCondition(rdoWaterBalance, "") + ucrNudThreshold.SetParameter(New RParameter("threshold")) + ucrNudThreshold.SetMinMax(0, 100) + ucrNudThreshold.Increment = 0.01 + ucrNudThreshold.DecimalPlaces = 2 + ucrNudThreshold.SetRDefault("0.85") + + ucrInputSum.SetParameter(New RParameter("summary")) + dctInputSumPairs.Add("Sum", Chr(34) & "sum" & Chr(34)) + dctInputSumPairs.Add("Max", Chr(34) & "max" & Chr(34)) + dctInputSumPairs.Add("Min", Chr(34) & "min" & Chr(34)) + dctInputSumPairs.Add("Mean", Chr(34) & "mean" & Chr(34)) + ucrInputSum.SetItems(dctInputSumPairs) + + ucrNudSumOver.SetParameter(New RParameter("sum_over")) + ucrNudSumOver.SetMinMax(1, 31) + ucrNudSumOver.Increment = 1 + 'ucrNudSumOver.SetRDefault("3") + ucrSaveTransform.SetDataFrameSelector(ucrSelectorTransform.ucrAvailableDataFrames) ucrSaveTransform.SetLabelText("New Column Name:") ucrSaveTransform.SetIsTextBox() From ae90087cd55423af9f82ef4ee231e02a9a4a3b18 Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Fri, 5 May 2017 15:35:57 +0300 Subject: [PATCH 20/52] edits --- instat/dlgTransformClimatic.vb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/instat/dlgTransformClimatic.vb b/instat/dlgTransformClimatic.vb index 92b7ae70912..16eb93b9fb1 100644 --- a/instat/dlgTransformClimatic.vb +++ b/instat/dlgTransformClimatic.vb @@ -78,9 +78,21 @@ Public Class dlgTransformClimatic ucrInputSum.SetItems(dctInputSumPairs) ucrNudSumOver.SetParameter(New RParameter("sum_over")) - ucrNudSumOver.SetMinMax(1, 31) + ucrNudSumOver.SetMinMax(1, 366) ucrNudSumOver.Increment = 1 'ucrNudSumOver.SetRDefault("3") + ucrNudCountOver.SetParameter(New RParameter("count_over")) + ucrNudCountOver.SetMinMax(1, 366) + ucrNudCountOver.Increment = 1 + + ucrInputSpellLower.SetValidationTypeAsNumeric() + ucrInputSpellLower.SetParameter(New RParameter("spell_lower")) + + ucrInputSpellUpper.SetValidationTypeAsNumeric() + ucrInputSpellUpper.SetParameter(New RParameter("spell_upper")) + + ucrInputEvaporation.SetValidationTypeAsNumeric() + ucrInputSpellUpper.SetParameter(New RParameter("spell_upper")) ucrSaveTransform.SetDataFrameSelector(ucrSelectorTransform.ucrAvailableDataFrames) ucrSaveTransform.SetLabelText("New Column Name:") From ea20314f278c2b0e5b098e6867ea911bb9a3eb2f Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Fri, 5 May 2017 15:42:12 +0300 Subject: [PATCH 21/52] new edits --- instat/dlgTransformClimatic.vb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/instat/dlgTransformClimatic.vb b/instat/dlgTransformClimatic.vb index 16eb93b9fb1..11363907e0e 100644 --- a/instat/dlgTransformClimatic.vb +++ b/instat/dlgTransformClimatic.vb @@ -84,6 +84,7 @@ Public Class dlgTransformClimatic ucrNudCountOver.SetParameter(New RParameter("count_over")) ucrNudCountOver.SetMinMax(1, 366) ucrNudCountOver.Increment = 1 + 'ucrNudCountOver.SetRDefault("3") ucrInputSpellLower.SetValidationTypeAsNumeric() ucrInputSpellLower.SetParameter(New RParameter("spell_lower")) @@ -91,8 +92,12 @@ Public Class dlgTransformClimatic ucrInputSpellUpper.SetValidationTypeAsNumeric() ucrInputSpellUpper.SetParameter(New RParameter("spell_upper")) + ucrNudWBCapacity.SetParameter(New RParameter("capacity")) + ucrNudWBCapacity.SetMinMax(1, 366) + ucrNudWBCapacity.Increment = 1 + 'ucrNudWBCapacity.SetRDefault("60") ucrInputEvaporation.SetValidationTypeAsNumeric() - ucrInputSpellUpper.SetParameter(New RParameter("spell_upper")) + ucrInputEvaporation.SetParameter(New RParameter("evaporation")) ucrSaveTransform.SetDataFrameSelector(ucrSelectorTransform.ucrAvailableDataFrames) ucrSaveTransform.SetLabelText("New Column Name:") From 1390b8d4477f3cb72fd9e1f9d2631dc4526560dd Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Sat, 6 May 2017 15:34:39 +0300 Subject: [PATCH 22/52] linked display fix --- instat/dlgTransformClimatic.vb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/instat/dlgTransformClimatic.vb b/instat/dlgTransformClimatic.vb index 11363907e0e..a9c8bb2ad63 100644 --- a/instat/dlgTransformClimatic.vb +++ b/instat/dlgTransformClimatic.vb @@ -76,10 +76,13 @@ Public Class dlgTransformClimatic dctInputSumPairs.Add("Min", Chr(34) & "min" & Chr(34)) dctInputSumPairs.Add("Mean", Chr(34) & "mean" & Chr(34)) ucrInputSum.SetItems(dctInputSumPairs) + ucrInputSum.SetLinkedDisplayControl(lblSumOver) ucrNudSumOver.SetParameter(New RParameter("sum_over")) ucrNudSumOver.SetMinMax(1, 366) ucrNudSumOver.Increment = 1 + ucrNudSumOver.SetLinkedDisplayControl(lblSumRows) + 'ucrNudSumOver.SetRDefault("3") ucrNudCountOver.SetParameter(New RParameter("count_over")) ucrNudCountOver.SetMinMax(1, 366) @@ -104,6 +107,11 @@ Public Class dlgTransformClimatic ucrSaveTransform.SetIsTextBox() ucrSaveTransform.SetPrefix("Sum") ucrSaveTransform.SetSaveTypeAsColumn() + + ucrPnlTransform.AddToLinkedControls({ucrInputSum, ucrNudSumOver}, {rdoCount}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) + + 'ucrChkLong.AddToLinkedControls(ucrReceiverDataColumn, {True}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) + 'ucrChkLong.AddToLinkedControls(ucrReceiverStations, {True}, bNewLinkedHideIfParameterMissing:=True) End Sub Private Sub SetDefaults() @@ -136,13 +144,21 @@ Public Class dlgTransformClimatic Private Sub ucrPnlTransform_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrPnlTransform.ControlContentsChanged If rdoSum.Checked Then + ucrBase.clsRsyntax.SetBaseRFunction(clsSumFunction) ucrSaveTransform.SetPrefix("Sum") ElseIf rdoCount.Checked Then + ucrBase.clsRsyntax.SetBaseRFunction(clsCountFunction) ucrSaveTransform.SetPrefix("Count") ElseIf rdoSpell.Checked Then + ucrBase.clsRsyntax.SetBaseRFunction(clsSpellFunction) ucrSaveTransform.SetPrefix("Spell") ElseIf rdoWaterBalance.Checked Then + ucrBase.clsRsyntax.SetBaseRFunction(clsWaterBalanceFunction) ucrSaveTransform.SetPrefix("Water_balance") End If End Sub + + Private Sub ucrReceiverDate_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverDate.ControlContentsChanged ' add more teskok controls + TestOkEnabled() + End Sub End Class \ No newline at end of file From df8ccf6aa6c995c992c33bfd1f5fdde4ee4b6337 Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Sat, 6 May 2017 15:41:57 +0300 Subject: [PATCH 23/52] count linked display fixes --- instat/dlgTransformClimatic.vb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/instat/dlgTransformClimatic.vb b/instat/dlgTransformClimatic.vb index a9c8bb2ad63..6015eb32187 100644 --- a/instat/dlgTransformClimatic.vb +++ b/instat/dlgTransformClimatic.vb @@ -82,11 +82,13 @@ Public Class dlgTransformClimatic ucrNudSumOver.SetMinMax(1, 366) ucrNudSumOver.Increment = 1 ucrNudSumOver.SetLinkedDisplayControl(lblSumRows) - 'ucrNudSumOver.SetRDefault("3") + ucrNudCountOver.SetParameter(New RParameter("count_over")) ucrNudCountOver.SetMinMax(1, 366) ucrNudCountOver.Increment = 1 + ucrNudCountOver.SetLinkedDisplayControl(lblCountOver) + ucrNudCountOver.SetLinkedDisplayControl(lblCountRows) 'ucrNudCountOver.SetRDefault("3") ucrInputSpellLower.SetValidationTypeAsNumeric() @@ -108,8 +110,10 @@ Public Class dlgTransformClimatic ucrSaveTransform.SetPrefix("Sum") ucrSaveTransform.SetSaveTypeAsColumn() - ucrPnlTransform.AddToLinkedControls({ucrInputSum, ucrNudSumOver}, {rdoCount}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) - + ucrPnlTransform.AddToLinkedControls({ucrInputSum, ucrNudSumOver}, {rdoSum}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) + ucrPnlTransform.AddToLinkedControls({ucrNudCountOver}, {rdoCount}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) + ucrPnlTransform.AddToLinkedControls({ucrInputSum, ucrNudSumOver}, {rdoSpell}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) + ucrPnlTransform.AddToLinkedControls({ucrInputSum, ucrNudSumOver}, {rdoWaterBalance}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) 'ucrChkLong.AddToLinkedControls(ucrReceiverDataColumn, {True}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) 'ucrChkLong.AddToLinkedControls(ucrReceiverStations, {True}, bNewLinkedHideIfParameterMissing:=True) End Sub From 48da461229c56e351ea13df6cd73b3fd655a7fda Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Sat, 6 May 2017 15:50:03 +0300 Subject: [PATCH 24/52] fixing spell linked display --- instat/dlgTransformClimatic.vb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/instat/dlgTransformClimatic.vb b/instat/dlgTransformClimatic.vb index 6015eb32187..986c20f1d3b 100644 --- a/instat/dlgTransformClimatic.vb +++ b/instat/dlgTransformClimatic.vb @@ -89,10 +89,14 @@ Public Class dlgTransformClimatic ucrNudCountOver.Increment = 1 ucrNudCountOver.SetLinkedDisplayControl(lblCountOver) ucrNudCountOver.SetLinkedDisplayControl(lblCountRows) + + 'ucrNudCountOver.SetRDefault("3") ucrInputSpellLower.SetValidationTypeAsNumeric() ucrInputSpellLower.SetParameter(New RParameter("spell_lower")) + ucrInputSpellLower.SetLinkedDisplayControl(lblValuesBetween) + ucrInputSpellLower.SetLinkedDisplayControl(lblSpellAnd) ucrInputSpellUpper.SetValidationTypeAsNumeric() ucrInputSpellUpper.SetParameter(New RParameter("spell_upper")) @@ -111,8 +115,8 @@ Public Class dlgTransformClimatic ucrSaveTransform.SetSaveTypeAsColumn() ucrPnlTransform.AddToLinkedControls({ucrInputSum, ucrNudSumOver}, {rdoSum}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) - ucrPnlTransform.AddToLinkedControls({ucrNudCountOver}, {rdoCount}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) - ucrPnlTransform.AddToLinkedControls({ucrInputSum, ucrNudSumOver}, {rdoSpell}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) + ucrPnlTransform.AddToLinkedControls({ucrNudCountOver, ucrChkValuesUnderthreshold}, {rdoCount}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) + ucrPnlTransform.AddToLinkedControls({ucrInputSpellLower, ucrInputSpellUpper}, {rdoSpell}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) ucrPnlTransform.AddToLinkedControls({ucrInputSum, ucrNudSumOver}, {rdoWaterBalance}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) 'ucrChkLong.AddToLinkedControls(ucrReceiverDataColumn, {True}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) 'ucrChkLong.AddToLinkedControls(ucrReceiverStations, {True}, bNewLinkedHideIfParameterMissing:=True) From 260aeed0bab0ea2787190a69555250f5772bec15 Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Sat, 6 May 2017 16:03:31 +0300 Subject: [PATCH 25/52] waterbalance linked display controls fixes --- instat/dlgTransformClimatic.vb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/instat/dlgTransformClimatic.vb b/instat/dlgTransformClimatic.vb index 986c20f1d3b..294e1304746 100644 --- a/instat/dlgTransformClimatic.vb +++ b/instat/dlgTransformClimatic.vb @@ -104,7 +104,10 @@ Public Class dlgTransformClimatic ucrNudWBCapacity.SetParameter(New RParameter("capacity")) ucrNudWBCapacity.SetMinMax(1, 366) ucrNudWBCapacity.Increment = 1 + ucrNudWBCapacity.SetLinkedDisplayControl(lblWBCapacity) + ucrNudWBCapacity.SetLinkedDisplayControl(lblWBEvaporation) 'ucrNudWBCapacity.SetRDefault("60") + ucrInputEvaporation.SetValidationTypeAsNumeric() ucrInputEvaporation.SetParameter(New RParameter("evaporation")) @@ -117,7 +120,7 @@ Public Class dlgTransformClimatic ucrPnlTransform.AddToLinkedControls({ucrInputSum, ucrNudSumOver}, {rdoSum}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) ucrPnlTransform.AddToLinkedControls({ucrNudCountOver, ucrChkValuesUnderthreshold}, {rdoCount}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) ucrPnlTransform.AddToLinkedControls({ucrInputSpellLower, ucrInputSpellUpper}, {rdoSpell}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) - ucrPnlTransform.AddToLinkedControls({ucrInputSum, ucrNudSumOver}, {rdoWaterBalance}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) + ucrPnlTransform.AddToLinkedControls({ucrNudWBCapacity, ucrInputEvaporation}, {rdoWaterBalance}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) 'ucrChkLong.AddToLinkedControls(ucrReceiverDataColumn, {True}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) 'ucrChkLong.AddToLinkedControls(ucrReceiverStations, {True}, bNewLinkedHideIfParameterMissing:=True) End Sub From 08856fdcc70fd4e0523eabdecbcd1b858b999052 Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Sat, 6 May 2017 16:16:11 +0300 Subject: [PATCH 26/52] minor edits --- instat/dlgTransformClimatic.vb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/instat/dlgTransformClimatic.vb b/instat/dlgTransformClimatic.vb index 294e1304746..23b5e75c664 100644 --- a/instat/dlgTransformClimatic.vb +++ b/instat/dlgTransformClimatic.vb @@ -88,28 +88,29 @@ Public Class dlgTransformClimatic ucrNudCountOver.SetMinMax(1, 366) ucrNudCountOver.Increment = 1 ucrNudCountOver.SetLinkedDisplayControl(lblCountOver) - ucrNudCountOver.SetLinkedDisplayControl(lblCountRows) - - 'ucrNudCountOver.SetRDefault("3") + ucrChkValuesUnderthreshold.SetParameter(New RParameter("values_under_threshold")) + ucrChkValuesUnderthreshold.SetText("Values Under Threshold") + ucrChkValuesUnderthreshold.SetLinkedDisplayControl(lblCountRows) + ucrInputSpellLower.SetValidationTypeAsNumeric() ucrInputSpellLower.SetParameter(New RParameter("spell_lower")) ucrInputSpellLower.SetLinkedDisplayControl(lblValuesBetween) - ucrInputSpellLower.SetLinkedDisplayControl(lblSpellAnd) ucrInputSpellUpper.SetValidationTypeAsNumeric() ucrInputSpellUpper.SetParameter(New RParameter("spell_upper")) + ucrInputSpellUpper.SetLinkedDisplayControl(lblSpellAnd) ucrNudWBCapacity.SetParameter(New RParameter("capacity")) ucrNudWBCapacity.SetMinMax(1, 366) ucrNudWBCapacity.Increment = 1 ucrNudWBCapacity.SetLinkedDisplayControl(lblWBCapacity) - ucrNudWBCapacity.SetLinkedDisplayControl(lblWBEvaporation) 'ucrNudWBCapacity.SetRDefault("60") ucrInputEvaporation.SetValidationTypeAsNumeric() ucrInputEvaporation.SetParameter(New RParameter("evaporation")) + ucrInputEvaporation.SetLinkedDisplayControl(lblWBEvaporation) ucrSaveTransform.SetDataFrameSelector(ucrSelectorTransform.ucrAvailableDataFrames) ucrSaveTransform.SetLabelText("New Column Name:") From 5fa2b90e433a7911ea4745ee5d2b0c0d1233c1b8 Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Sat, 6 May 2017 17:06:34 +0300 Subject: [PATCH 27/52] ninor edits --- instat/dlgTransformClimatic.vb | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/instat/dlgTransformClimatic.vb b/instat/dlgTransformClimatic.vb index 23b5e75c664..df4e8b09bfb 100644 --- a/instat/dlgTransformClimatic.vb +++ b/instat/dlgTransformClimatic.vb @@ -35,6 +35,7 @@ Public Class dlgTransformClimatic End Sub Private Sub InitialiseDialog() + ucrBase.iHelpTopicID = 358 Dim dctInputSumPairs As New Dictionary(Of String, String) ucrReceiverStation.Selector = ucrSelectorTransform ucrReceiverYear.Selector = ucrSelectorTransform @@ -122,8 +123,6 @@ Public Class dlgTransformClimatic ucrPnlTransform.AddToLinkedControls({ucrNudCountOver, ucrChkValuesUnderthreshold}, {rdoCount}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) ucrPnlTransform.AddToLinkedControls({ucrInputSpellLower, ucrInputSpellUpper}, {rdoSpell}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) ucrPnlTransform.AddToLinkedControls({ucrNudWBCapacity, ucrInputEvaporation}, {rdoWaterBalance}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) - 'ucrChkLong.AddToLinkedControls(ucrReceiverDataColumn, {True}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) - 'ucrChkLong.AddToLinkedControls(ucrReceiverStations, {True}, bNewLinkedHideIfParameterMissing:=True) End Sub Private Sub SetDefaults() @@ -133,11 +132,7 @@ Public Class dlgTransformClimatic clsWaterBalanceFunction = New RFunction ucrSaveTransform.Reset() ucrSelectorTransform.Reset() - - End Sub - - Private Sub ucrPnlTransform_Load(sender As Object, e As EventArgs) Handles ucrPnlTransform.Load - + ucrBase.clsRsyntax.SetBaseRFunction(clsSumFunction) End Sub Private Sub SetRCodeForControls(bReset As Boolean) From 1060fa04864204d6762d74416a9823e6d38acc33 Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Mon, 8 May 2017 11:38:54 +0300 Subject: [PATCH 28/52] editing groupbox text --- instat/dlgTransformClimatic.Designer.vb | 34 ++++++++++++------------- instat/dlgTransformClimatic.vb | 4 +++ 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/instat/dlgTransformClimatic.Designer.vb b/instat/dlgTransformClimatic.Designer.vb index b5259f4cea3..0507424aad9 100644 --- a/instat/dlgTransformClimatic.Designer.vb +++ b/instat/dlgTransformClimatic.Designer.vb @@ -32,7 +32,7 @@ Partial Class dlgTransformClimatic Me.rdoCount = New System.Windows.Forms.RadioButton() Me.rdoWaterBalance = New System.Windows.Forms.RadioButton() Me.lblThreshold = New System.Windows.Forms.Label() - Me.grpsum = New System.Windows.Forms.GroupBox() + Me.grpTransform = New System.Windows.Forms.GroupBox() Me.lblSumRows = New System.Windows.Forms.Label() Me.ucrNudSumOver = New instat.ucrNud() Me.lblSumOver = New System.Windows.Forms.Label() @@ -62,7 +62,7 @@ Partial Class dlgTransformClimatic Me.ucrReceiverData = New instat.ucrReceiverSingle() Me.ucrBase = New instat.ucrButtons() Me.ucrSaveTransform = New instat.ucrSave() - Me.grpsum.SuspendLayout() + Me.grpTransform.SuspendLayout() Me.grpWaterBalance.SuspendLayout() Me.grpSpell.SuspendLayout() Me.grpCount.SuspendLayout() @@ -195,18 +195,18 @@ Partial Class dlgTransformClimatic Me.lblThreshold.Tag = "Threshold <=" Me.lblThreshold.Text = "Threshold <=" ' - 'grpsum + 'grpTransform ' - Me.grpsum.Controls.Add(Me.lblSumRows) - Me.grpsum.Controls.Add(Me.ucrNudSumOver) - Me.grpsum.Controls.Add(Me.lblSumOver) - Me.grpsum.Controls.Add(Me.ucrInputSum) - Me.grpsum.Location = New System.Drawing.Point(27, 275) - Me.grpsum.Name = "grpsum" - Me.grpsum.Size = New System.Drawing.Size(289, 48) - Me.grpsum.TabIndex = 46 - Me.grpsum.TabStop = False - Me.grpsum.Text = "Sum" + Me.grpTransform.Controls.Add(Me.lblSumRows) + Me.grpTransform.Controls.Add(Me.ucrNudSumOver) + Me.grpTransform.Controls.Add(Me.lblSumOver) + Me.grpTransform.Controls.Add(Me.ucrInputSum) + Me.grpTransform.Location = New System.Drawing.Point(27, 275) + Me.grpTransform.Name = "grpTransform" + Me.grpTransform.Size = New System.Drawing.Size(289, 48) + Me.grpTransform.TabIndex = 46 + Me.grpTransform.TabStop = False + Me.grpTransform.Text = "Sum" ' 'lblSumRows ' @@ -518,7 +518,7 @@ Partial Class dlgTransformClimatic Me.Controls.Add(Me.grpWaterBalance) Me.Controls.Add(Me.grpSpell) Me.Controls.Add(Me.grpCount) - Me.Controls.Add(Me.grpsum) + Me.Controls.Add(Me.grpTransform) Me.Controls.Add(Me.ucrNudThreshold) Me.Controls.Add(Me.lblThreshold) Me.Controls.Add(Me.rdoWaterBalance) @@ -544,8 +544,8 @@ Partial Class dlgTransformClimatic Me.Name = "dlgTransformClimatic" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Text = "Transform" - Me.grpsum.ResumeLayout(False) - Me.grpsum.PerformLayout() + Me.grpTransform.ResumeLayout(False) + Me.grpTransform.PerformLayout() Me.grpWaterBalance.ResumeLayout(False) Me.grpWaterBalance.PerformLayout() Me.grpSpell.ResumeLayout(False) @@ -580,7 +580,7 @@ Partial Class dlgTransformClimatic Friend WithEvents lblCountRows As Label Friend WithEvents ucrNudCountOver As ucrNud Friend WithEvents lblCountOver As Label - Friend WithEvents grpsum As GroupBox + Friend WithEvents grpTransform As GroupBox Friend WithEvents lblSumRows As Label Friend WithEvents ucrNudSumOver As ucrNud Friend WithEvents lblSumOver As Label diff --git a/instat/dlgTransformClimatic.vb b/instat/dlgTransformClimatic.vb index df4e8b09bfb..fd8ea5e42af 100644 --- a/instat/dlgTransformClimatic.vb +++ b/instat/dlgTransformClimatic.vb @@ -153,15 +153,19 @@ Public Class dlgTransformClimatic If rdoSum.Checked Then ucrBase.clsRsyntax.SetBaseRFunction(clsSumFunction) ucrSaveTransform.SetPrefix("Sum") + grpTransform.Text = "Sum" ElseIf rdoCount.Checked Then ucrBase.clsRsyntax.SetBaseRFunction(clsCountFunction) ucrSaveTransform.SetPrefix("Count") + grpTransform.Text = "Count" ElseIf rdoSpell.Checked Then ucrBase.clsRsyntax.SetBaseRFunction(clsSpellFunction) ucrSaveTransform.SetPrefix("Spell") + grpTransform.Text = "Spell" ElseIf rdoWaterBalance.Checked Then ucrBase.clsRsyntax.SetBaseRFunction(clsWaterBalanceFunction) ucrSaveTransform.SetPrefix("Water_balance") + grpTransform.Text = "Water_balance" End If End Sub From db58e3dbc7ad47663a2f8be22911c51f413d4732 Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Mon, 8 May 2017 14:33:28 +0300 Subject: [PATCH 29/52] adding functionality to the rdoSum --- instat/dlgTransformClimatic.vb | 44 +++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/instat/dlgTransformClimatic.vb b/instat/dlgTransformClimatic.vb index fd8ea5e42af..9afe9738840 100644 --- a/instat/dlgTransformClimatic.vb +++ b/instat/dlgTransformClimatic.vb @@ -18,8 +18,9 @@ Imports instat.Translations Public Class dlgTransformClimatic Private bFirstload As Boolean = True Private bReset As Boolean = True - + Private clsRSumOver, clsRCalculatedFrom As New RFunction Private clsSumFunction, clsCountFunction, clsSpellFunction, clsWaterBalanceFunction As New RFunction + Private strCurrDataName As String = "" Private Sub dlgTransformClimatic_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstload Then InitialiseDialog() @@ -55,6 +56,14 @@ Public Class dlgTransformClimatic ucrReceiverData.bAutoFill = True ucrReceiverYear.bAutoFill = True + 'ucrSSTDataframe.SetParameter(New RParameter("data_name", 0)) + 'ucrSSTDataframe.SetParameterIsrfunction() + + clsRSumOver.SetRCommand("instat_calculation$new") + clsRSumOver.SetAssignTo("sum_over") + clsRCalculatedFrom.SetRCommand("list") + + ucrPnlTransform.AddRadioButton(rdoSum) ucrPnlTransform.AddRadioButton(rdoCount) ucrPnlTransform.AddRadioButton(rdoSpell) @@ -123,6 +132,8 @@ Public Class dlgTransformClimatic ucrPnlTransform.AddToLinkedControls({ucrNudCountOver, ucrChkValuesUnderthreshold}, {rdoCount}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) ucrPnlTransform.AddToLinkedControls({ucrInputSpellLower, ucrInputSpellUpper}, {rdoSpell}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) ucrPnlTransform.AddToLinkedControls({ucrNudWBCapacity, ucrInputEvaporation}, {rdoWaterBalance}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) + + End Sub Private Sub SetDefaults() @@ -132,7 +143,9 @@ Public Class dlgTransformClimatic clsWaterBalanceFunction = New RFunction ucrSaveTransform.Reset() ucrSelectorTransform.Reset() - ucrBase.clsRsyntax.SetBaseRFunction(clsSumFunction) + 'ucrBase.clsRsyntax.SetBaseRFunction(clsSumFunction) + ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$apply_instat_calculation") + ucrBase.clsRsyntax.AddParameter("calc", clsRFunctionParameter:=clsRSumOver) End Sub Private Sub SetRCodeForControls(bReset As Boolean) @@ -151,19 +164,20 @@ Public Class dlgTransformClimatic Private Sub ucrPnlTransform_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrPnlTransform.ControlContentsChanged If rdoSum.Checked Then - ucrBase.clsRsyntax.SetBaseRFunction(clsSumFunction) + ucrBase.clsRsyntax.AddParameter("calc", clsRFunctionParameter:=clsRSumOver) + 'ucrBase.clsRsyntax.SetBaseRFunction(clsSumFunction) ucrSaveTransform.SetPrefix("Sum") grpTransform.Text = "Sum" ElseIf rdoCount.Checked Then - ucrBase.clsRsyntax.SetBaseRFunction(clsCountFunction) + 'ucrBase.clsRsyntax.SetBaseRFunction(clsCountFunction) ucrSaveTransform.SetPrefix("Count") grpTransform.Text = "Count" ElseIf rdoSpell.Checked Then - ucrBase.clsRsyntax.SetBaseRFunction(clsSpellFunction) + 'ucrBase.clsRsyntax.SetBaseRFunction(clsSpellFunction) ucrSaveTransform.SetPrefix("Spell") grpTransform.Text = "Spell" ElseIf rdoWaterBalance.Checked Then - ucrBase.clsRsyntax.SetBaseRFunction(clsWaterBalanceFunction) + 'ucrBase.clsRsyntax.SetBaseRFunction(clsWaterBalanceFunction) ucrSaveTransform.SetPrefix("Water_balance") grpTransform.Text = "Water_balance" End If @@ -172,4 +186,22 @@ Public Class dlgTransformClimatic Private Sub ucrReceiverDate_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverDate.ControlContentsChanged ' add more teskok controls TestOkEnabled() End Sub + + Private Sub sum_over() + If Not ucrReceiverData.IsEmpty Then + 'clsRSumOver.AddParameter("function_exp", Chr(34) & ucrReceiverDOY.GetVariableNames(False) & ">=" & nudFrom.Value & " & " & ucrReceiverDOY.GetVariableNames(False) & "<=" & nudTo.Value & Chr(34)) + clsRSumOver.AddParameter("calculated_from", " list(" & strCurrDataName & "=" & ucrReceiverDOY.GetVariableNames() & ")") + clsRSumOver.AddParameter("type", Chr(34) & "calculation" & Chr(34)) + 'Else + ' clsDayFromAndTo.RemoveParameterByName("function_exp") + ' clsDayFromAndTo.RemoveParameterByName("calculated_from") + End If + End Sub + + Private Sub ucrSelectorTransform_ControlContentsChanged(ucrchangedControl As ucrCore) Handles ucrSelectorTransform.ControlContentsChanged + strCurrDataName = Chr(34) & ucrSelectorTransform.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34) + sum_over() + 'clsAddKey.AddParameter("data_name", strCurrDataName) + 'firstDayofTheYear() + End Sub End Class \ No newline at end of file From 65919466ad3c8d74f87e05648b025fac81a58783 Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Mon, 8 May 2017 17:09:11 +0300 Subject: [PATCH 30/52] edits --- instat/dlgTransformClimatic.vb | 46 ++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/instat/dlgTransformClimatic.vb b/instat/dlgTransformClimatic.vb index 9afe9738840..ef104f01133 100644 --- a/instat/dlgTransformClimatic.vb +++ b/instat/dlgTransformClimatic.vb @@ -18,7 +18,7 @@ Imports instat.Translations Public Class dlgTransformClimatic Private bFirstload As Boolean = True Private bReset As Boolean = True - Private clsRSumOver, clsRCalculatedFrom As New RFunction + Private clsRTrasform, clsRZoo, clsRSumFuncExpr As New RFunction Private clsSumFunction, clsCountFunction, clsSpellFunction, clsWaterBalanceFunction As New RFunction Private strCurrDataName As String = "" Private Sub dlgTransformClimatic_Load(sender As Object, e As EventArgs) Handles MyBase.Load @@ -59,9 +59,12 @@ Public Class dlgTransformClimatic 'ucrSSTDataframe.SetParameter(New RParameter("data_name", 0)) 'ucrSSTDataframe.SetParameterIsrfunction() - clsRSumOver.SetRCommand("instat_calculation$new") - clsRSumOver.SetAssignTo("sum_over") - clsRCalculatedFrom.SetRCommand("list") + clsRTrasform.SetRCommand("instat_calculation$new") + clsRTrasform.SetAssignTo("transform_calculation") + clsRSumFuncExpr.SetRCommand("rollapply") + clsRZoo.SetRCommand("zoo") + + ucrPnlTransform.AddRadioButton(rdoSum) @@ -88,7 +91,7 @@ Public Class dlgTransformClimatic ucrInputSum.SetItems(dctInputSumPairs) ucrInputSum.SetLinkedDisplayControl(lblSumOver) - ucrNudSumOver.SetParameter(New RParameter("sum_over")) + ucrNudSumOver.SetParameter(New RParameter("width")) ucrNudSumOver.SetMinMax(1, 366) ucrNudSumOver.Increment = 1 ucrNudSumOver.SetLinkedDisplayControl(lblSumRows) @@ -122,6 +125,9 @@ Public Class dlgTransformClimatic ucrInputEvaporation.SetParameter(New RParameter("evaporation")) ucrInputEvaporation.SetLinkedDisplayControl(lblWBEvaporation) + ucrSaveTransform.SetParameter(New RParameter("result_name")) + + ucrSaveTransform.SetDataFrameSelector(ucrSelectorTransform.ucrAvailableDataFrames) ucrSaveTransform.SetLabelText("New Column Name:") ucrSaveTransform.SetIsTextBox() @@ -143,13 +149,27 @@ Public Class dlgTransformClimatic clsWaterBalanceFunction = New RFunction ucrSaveTransform.Reset() ucrSelectorTransform.Reset() + + ucrReceiverData.SetParameter(New RParameter("x", 0)) + ucrReceiverData.SetParameterIsString() + ucrReceiverData.bWithQuotes = False + ucrReceiverData.SetParameterIncludeArgumentName(False) + + clsRSumFuncExpr.AddParameter("data", clsRFunctionParameter:=clsRZoo) + clsRTrasform.AddParameter("function_exp", clsRFunctionParameter:=clsRSumFuncExpr) + clsRTrasform.AddParameter("type", Chr(34) & "calculation" & Chr(34)) + 'This might not Beep right + clsRTrasform.AddParameter("result_name", Chr(34) & ucrSaveTransform.ucrInputTextSave.GetText & Chr(34)) + clsRTrasform.AddParameter("save", 2) 'ucrBase.clsRsyntax.SetBaseRFunction(clsSumFunction) ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$apply_instat_calculation") - ucrBase.clsRsyntax.AddParameter("calc", clsRFunctionParameter:=clsRSumOver) + ucrBase.clsRsyntax.AddParameter("calc", clsRFunctionParameter:=clsRTrasform) End Sub Private Sub SetRCodeForControls(bReset As Boolean) - + ucrNudSumOver.SetRCode(clsRSumFuncExpr, bReset) + ucrReceiverData.SetRCode(clsRZoo, bReset) + ucrSaveTransform.SetRCode(clsRTrasform, bReset) End Sub Private Sub TestOkEnabled() @@ -164,7 +184,7 @@ Public Class dlgTransformClimatic Private Sub ucrPnlTransform_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrPnlTransform.ControlContentsChanged If rdoSum.Checked Then - ucrBase.clsRsyntax.AddParameter("calc", clsRFunctionParameter:=clsRSumOver) + ucrBase.clsRsyntax.AddParameter("calc", clsRFunctionParameter:=clsRTrasform) 'ucrBase.clsRsyntax.SetBaseRFunction(clsSumFunction) ucrSaveTransform.SetPrefix("Sum") grpTransform.Text = "Sum" @@ -189,9 +209,13 @@ Public Class dlgTransformClimatic Private Sub sum_over() If Not ucrReceiverData.IsEmpty Then - 'clsRSumOver.AddParameter("function_exp", Chr(34) & ucrReceiverDOY.GetVariableNames(False) & ">=" & nudFrom.Value & " & " & ucrReceiverDOY.GetVariableNames(False) & "<=" & nudTo.Value & Chr(34)) - clsRSumOver.AddParameter("calculated_from", " list(" & strCurrDataName & "=" & ucrReceiverDOY.GetVariableNames() & ")") - clsRSumOver.AddParameter("type", Chr(34) & "calculation" & Chr(34)) + 'clsRSumOver.AddParameter("function_exp", Chr(34) & "rollapply(data = zoo(" & ucrReceiverData.GetVariableNames(bWithQuotes:=False) & "), width =4, FUN=sum, fill = NA, align= 'right')" & Chr(34)) + 'clsRSumOve.AddParameter("function_exp", Chr(34) & "rollapply(data = zoo(" & ucrReceiverData.GetVariableNames(bWithQuotes:=False) & "), width =4, FUN=sum, fill = NA, align= 'right')" & Chr(34)) + clsRTrasform.AddParameter("calculated_from", " list(" & strCurrDataName & "=" & ucrReceiverData.GetVariableNames() & ")") + 'clsRTrasform.AddParameter("type", Chr(34) & "calculation" & Chr(34)) + ''This might not Beep right + 'clsRTrasform.AddParameter("result_name", Chr(34) & ucrSaveTransform.ucrInputTextSave.GetText & Chr(34)) + 'clsRTrasform.AddParameter("save", 2) 'Else ' clsDayFromAndTo.RemoveParameterByName("function_exp") ' clsDayFromAndTo.RemoveParameterByName("calculated_from") From 8aa890348fa328d379b3a393589d3cd5563eb19c Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Tue, 9 May 2017 01:18:25 +0300 Subject: [PATCH 31/52] adding rdo functionality --- instat/dlgTransformClimatic.Designer.vb | 20 +++---- instat/dlgTransformClimatic.vb | 69 +++++++++++++++++-------- 2 files changed, 59 insertions(+), 30 deletions(-) diff --git a/instat/dlgTransformClimatic.Designer.vb b/instat/dlgTransformClimatic.Designer.vb index 0507424aad9..6452fbfa2a3 100644 --- a/instat/dlgTransformClimatic.Designer.vb +++ b/instat/dlgTransformClimatic.Designer.vb @@ -61,7 +61,7 @@ Partial Class dlgTransformClimatic Me.ucrReceiverDOY = New instat.ucrReceiverSingle() Me.ucrReceiverData = New instat.ucrReceiverSingle() Me.ucrBase = New instat.ucrButtons() - Me.ucrSaveTransform = New instat.ucrSave() + Me.UcrInputTextBox1 = New instat.ucrInputTextBox() Me.grpTransform.SuspendLayout() Me.grpWaterBalance.SuspendLayout() Me.grpSpell.SuspendLayout() @@ -501,20 +501,22 @@ Partial Class dlgTransformClimatic Me.ucrBase.Size = New System.Drawing.Size(402, 52) Me.ucrBase.TabIndex = 0 ' - 'ucrSaveTransform + 'UcrInputTextBox1 ' - Me.ucrSaveTransform.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrSaveTransform.Location = New System.Drawing.Point(43, 413) - Me.ucrSaveTransform.Name = "ucrSaveTransform" - Me.ucrSaveTransform.Size = New System.Drawing.Size(423, 24) - Me.ucrSaveTransform.TabIndex = 48 + Me.UcrInputTextBox1.AddQuotesIfUnrecognised = True + Me.UcrInputTextBox1.IsMultiline = False + Me.UcrInputTextBox1.IsReadOnly = False + Me.UcrInputTextBox1.Location = New System.Drawing.Point(476, 157) + Me.UcrInputTextBox1.Name = "UcrInputTextBox1" + Me.UcrInputTextBox1.Size = New System.Drawing.Size(137, 21) + Me.UcrInputTextBox1.TabIndex = 49 ' 'dlgTransformClimatic ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(650, 492) - Me.Controls.Add(Me.ucrSaveTransform) + Me.Controls.Add(Me.UcrInputTextBox1) Me.Controls.Add(Me.grpWaterBalance) Me.Controls.Add(Me.grpSpell) Me.Controls.Add(Me.grpCount) @@ -596,5 +598,5 @@ Partial Class dlgTransformClimatic Friend WithEvents lblWBEvaporation As Label Friend WithEvents ucrInputSpellUpper As ucrInputTextBox Friend WithEvents ucrInputSpellLower As ucrInputTextBox - Friend WithEvents ucrSaveTransform As ucrSave + Friend WithEvents UcrInputTextBox1 As ucrInputTextBox End Class diff --git a/instat/dlgTransformClimatic.vb b/instat/dlgTransformClimatic.vb index ef104f01133..0d96f5547ae 100644 --- a/instat/dlgTransformClimatic.vb +++ b/instat/dlgTransformClimatic.vb @@ -83,14 +83,13 @@ Public Class dlgTransformClimatic ucrNudThreshold.DecimalPlaces = 2 ucrNudThreshold.SetRDefault("0.85") - ucrInputSum.SetParameter(New RParameter("summary")) - dctInputSumPairs.Add("Sum", Chr(34) & "sum" & Chr(34)) - dctInputSumPairs.Add("Max", Chr(34) & "max" & Chr(34)) - dctInputSumPairs.Add("Min", Chr(34) & "min" & Chr(34)) - dctInputSumPairs.Add("Mean", Chr(34) & "mean" & Chr(34)) + ucrInputSum.SetParameter(New RParameter("FUN")) + dctInputSumPairs.Add("sum", "sum") + dctInputSumPairs.Add("max", "max") + dctInputSumPairs.Add("min", "min") + dctInputSumPairs.Add("mean", "mean") ucrInputSum.SetItems(dctInputSumPairs) ucrInputSum.SetLinkedDisplayControl(lblSumOver) - ucrNudSumOver.SetParameter(New RParameter("width")) ucrNudSumOver.SetMinMax(1, 366) ucrNudSumOver.Increment = 1 @@ -125,14 +124,18 @@ Public Class dlgTransformClimatic ucrInputEvaporation.SetParameter(New RParameter("evaporation")) ucrInputEvaporation.SetLinkedDisplayControl(lblWBEvaporation) - ucrSaveTransform.SetParameter(New RParameter("result_name")) + 'ucrSaveTransform.SetParameter(New RParameter("result_name")) + + UcrInputTextBox1.SetParameter(New RParameter("result_name")) + UcrInputTextBox1.SetPrefix("sum") + UcrInputTextBox1.SetName("sum") - ucrSaveTransform.SetDataFrameSelector(ucrSelectorTransform.ucrAvailableDataFrames) - ucrSaveTransform.SetLabelText("New Column Name:") - ucrSaveTransform.SetIsTextBox() - ucrSaveTransform.SetPrefix("Sum") - ucrSaveTransform.SetSaveTypeAsColumn() + 'ucrSaveTransform.SetDataFrameSelector(ucrSelectorTransform.ucrAvailableDataFrames) + 'ucrSaveTransform.SetLabelText("New Column Name:") + 'ucrSaveTransform.SetIsTextBox() + 'ucrSaveTransform.SetPrefix("Sum") + 'ucrSaveTransform.SetSaveTypeAsColumn() ucrPnlTransform.AddToLinkedControls({ucrInputSum, ucrNudSumOver}, {rdoSum}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) ucrPnlTransform.AddToLinkedControls({ucrNudCountOver, ucrChkValuesUnderthreshold}, {rdoCount}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) @@ -147,7 +150,7 @@ Public Class dlgTransformClimatic clsCountFunction = New RFunction clsSpellFunction = New RFunction clsWaterBalanceFunction = New RFunction - ucrSaveTransform.Reset() + 'ucrSaveTransform.Reset() ucrSelectorTransform.Reset() ucrReceiverData.SetParameter(New RParameter("x", 0)) @@ -156,10 +159,15 @@ Public Class dlgTransformClimatic ucrReceiverData.SetParameterIncludeArgumentName(False) clsRSumFuncExpr.AddParameter("data", clsRFunctionParameter:=clsRZoo) - clsRTrasform.AddParameter("function_exp", clsRFunctionParameter:=clsRSumFuncExpr) + clsRSumFuncExpr.AddParameter("fill", "NA") + clsRSumFuncExpr.AddParameter("width", 1) + clsRSumFuncExpr.AddParameter("FUN", "sum") + clsRSumFuncExpr.AddParameter("align", Chr(39) & "right" & Chr(39)) + clsRTrasform.AddParameter("function_exp", Chr(34) & clsRSumFuncExpr.ToScript.ToString & Chr(34)) clsRTrasform.AddParameter("type", Chr(34) & "calculation" & Chr(34)) + clsRTrasform.AddParameter("result_name", Chr(34) & "sum" & Chr(34)) 'This might not Beep right - clsRTrasform.AddParameter("result_name", Chr(34) & ucrSaveTransform.ucrInputTextSave.GetText & Chr(34)) + 'clsRTrasform.AddParameter("result_name", Chr(34) & ucrSaveTransform.ucrInputTextSave.GetText & Chr(34)) clsRTrasform.AddParameter("save", 2) 'ucrBase.clsRsyntax.SetBaseRFunction(clsSumFunction) ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$apply_instat_calculation") @@ -169,7 +177,8 @@ Public Class dlgTransformClimatic Private Sub SetRCodeForControls(bReset As Boolean) ucrNudSumOver.SetRCode(clsRSumFuncExpr, bReset) ucrReceiverData.SetRCode(clsRZoo, bReset) - ucrSaveTransform.SetRCode(clsRTrasform, bReset) + 'ucrSaveTransform.SetRCode(clsRTrasform, bReset) + ucrInputSum.SetRCode(clsRSumFuncExpr, bReset) End Sub Private Sub TestOkEnabled() @@ -186,19 +195,27 @@ Public Class dlgTransformClimatic If rdoSum.Checked Then ucrBase.clsRsyntax.AddParameter("calc", clsRFunctionParameter:=clsRTrasform) 'ucrBase.clsRsyntax.SetBaseRFunction(clsSumFunction) - ucrSaveTransform.SetPrefix("Sum") + 'ucrSaveTransform.SetPrefix("Sum") + UcrInputTextBox1.SetPrefix("Sum") + UcrInputTextBox1.SetName("Sum") grpTransform.Text = "Sum" ElseIf rdoCount.Checked Then 'ucrBase.clsRsyntax.SetBaseRFunction(clsCountFunction) - ucrSaveTransform.SetPrefix("Count") + 'ucrSaveTransform.SetPrefix("Count") + UcrInputTextBox1.SetPrefix("Count") + UcrInputTextBox1.SetName("Count") grpTransform.Text = "Count" ElseIf rdoSpell.Checked Then 'ucrBase.clsRsyntax.SetBaseRFunction(clsSpellFunction) - ucrSaveTransform.SetPrefix("Spell") + 'ucrSaveTransform.SetPrefix("Spell") + UcrInputTextBox1.SetPrefix("Spell") + UcrInputTextBox1.SetName("Spell") grpTransform.Text = "Spell" ElseIf rdoWaterBalance.Checked Then 'ucrBase.clsRsyntax.SetBaseRFunction(clsWaterBalanceFunction) - ucrSaveTransform.SetPrefix("Water_balance") + 'ucrSaveTransform.SetPrefix("Water_balance") + UcrInputTextBox1.SetPrefix("Water_balance") + UcrInputTextBox1.SetName("Water_balance") grpTransform.Text = "Water_balance" End If End Sub @@ -209,9 +226,10 @@ Public Class dlgTransformClimatic Private Sub sum_over() If Not ucrReceiverData.IsEmpty Then + clsRTrasform.AddParameter("function_exp", Chr(34) & clsRSumFuncExpr.ToScript.ToString & Chr(34)) 'clsRSumOver.AddParameter("function_exp", Chr(34) & "rollapply(data = zoo(" & ucrReceiverData.GetVariableNames(bWithQuotes:=False) & "), width =4, FUN=sum, fill = NA, align= 'right')" & Chr(34)) 'clsRSumOve.AddParameter("function_exp", Chr(34) & "rollapply(data = zoo(" & ucrReceiverData.GetVariableNames(bWithQuotes:=False) & "), width =4, FUN=sum, fill = NA, align= 'right')" & Chr(34)) - clsRTrasform.AddParameter("calculated_from", " list(" & strCurrDataName & "=" & ucrReceiverData.GetVariableNames() & ")") + 'clsRTrasform.AddParameter("calculated_from", " list(" & strCurrDataName & "=" & ucrReceiverData.GetVariableNames() & ")") 'clsRTrasform.AddParameter("type", Chr(34) & "calculation" & Chr(34)) ''This might not Beep right 'clsRTrasform.AddParameter("result_name", Chr(34) & ucrSaveTransform.ucrInputTextSave.GetText & Chr(34)) @@ -224,7 +242,16 @@ Public Class dlgTransformClimatic Private Sub ucrSelectorTransform_ControlContentsChanged(ucrchangedControl As ucrCore) Handles ucrSelectorTransform.ControlContentsChanged strCurrDataName = Chr(34) & ucrSelectorTransform.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34) + 'sum_over() + clsRTrasform.AddParameter("calculated_from", " list(" & strCurrDataName & "=" & ucrReceiverData.GetVariableNames() & ")") + 'clsAddKey.AddParameter("data_name", strCurrDataName) + 'firstDayofTheYear() + End Sub + + Private Sub ucrControls_ControlContentsChanged(ucrchangedControl As ucrCore) Handles ucrReceiverData.ControlContentsChanged, ucrInputSum.ControlContentsChanged, ucrNudSumOver.ControlContentsChanged + 'strCurrDataName = Chr(34) & ucrSelectorTransform.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34) sum_over() + 'clsRTrasform.AddParameter("calculated_from", " list(" & strCurrDataName & "=" & ucrReceiverData.GetVariableNames() & ")") 'clsAddKey.AddParameter("data_name", strCurrDataName) 'firstDayofTheYear() End Sub From c1efd8a8786f962117b9a01a0ee73b8e6e0b5824 Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Tue, 9 May 2017 01:20:10 +0300 Subject: [PATCH 32/52] tyding up --- instat/dlgTransformClimatic.vb | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/instat/dlgTransformClimatic.vb b/instat/dlgTransformClimatic.vb index 0d96f5547ae..7f0d508230e 100644 --- a/instat/dlgTransformClimatic.vb +++ b/instat/dlgTransformClimatic.vb @@ -194,25 +194,21 @@ Public Class dlgTransformClimatic Private Sub ucrPnlTransform_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrPnlTransform.ControlContentsChanged If rdoSum.Checked Then ucrBase.clsRsyntax.AddParameter("calc", clsRFunctionParameter:=clsRTrasform) - 'ucrBase.clsRsyntax.SetBaseRFunction(clsSumFunction) 'ucrSaveTransform.SetPrefix("Sum") UcrInputTextBox1.SetPrefix("Sum") UcrInputTextBox1.SetName("Sum") grpTransform.Text = "Sum" ElseIf rdoCount.Checked Then - 'ucrBase.clsRsyntax.SetBaseRFunction(clsCountFunction) 'ucrSaveTransform.SetPrefix("Count") UcrInputTextBox1.SetPrefix("Count") UcrInputTextBox1.SetName("Count") grpTransform.Text = "Count" ElseIf rdoSpell.Checked Then - 'ucrBase.clsRsyntax.SetBaseRFunction(clsSpellFunction) 'ucrSaveTransform.SetPrefix("Spell") UcrInputTextBox1.SetPrefix("Spell") UcrInputTextBox1.SetName("Spell") grpTransform.Text = "Spell" ElseIf rdoWaterBalance.Checked Then - 'ucrBase.clsRsyntax.SetBaseRFunction(clsWaterBalanceFunction) 'ucrSaveTransform.SetPrefix("Water_balance") UcrInputTextBox1.SetPrefix("Water_balance") UcrInputTextBox1.SetName("Water_balance") @@ -227,32 +223,15 @@ Public Class dlgTransformClimatic Private Sub sum_over() If Not ucrReceiverData.IsEmpty Then clsRTrasform.AddParameter("function_exp", Chr(34) & clsRSumFuncExpr.ToScript.ToString & Chr(34)) - 'clsRSumOver.AddParameter("function_exp", Chr(34) & "rollapply(data = zoo(" & ucrReceiverData.GetVariableNames(bWithQuotes:=False) & "), width =4, FUN=sum, fill = NA, align= 'right')" & Chr(34)) - 'clsRSumOve.AddParameter("function_exp", Chr(34) & "rollapply(data = zoo(" & ucrReceiverData.GetVariableNames(bWithQuotes:=False) & "), width =4, FUN=sum, fill = NA, align= 'right')" & Chr(34)) - 'clsRTrasform.AddParameter("calculated_from", " list(" & strCurrDataName & "=" & ucrReceiverData.GetVariableNames() & ")") - 'clsRTrasform.AddParameter("type", Chr(34) & "calculation" & Chr(34)) - ''This might not Beep right - 'clsRTrasform.AddParameter("result_name", Chr(34) & ucrSaveTransform.ucrInputTextSave.GetText & Chr(34)) - 'clsRTrasform.AddParameter("save", 2) - 'Else - ' clsDayFromAndTo.RemoveParameterByName("function_exp") - ' clsDayFromAndTo.RemoveParameterByName("calculated_from") End If End Sub Private Sub ucrSelectorTransform_ControlContentsChanged(ucrchangedControl As ucrCore) Handles ucrSelectorTransform.ControlContentsChanged strCurrDataName = Chr(34) & ucrSelectorTransform.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34) - 'sum_over() clsRTrasform.AddParameter("calculated_from", " list(" & strCurrDataName & "=" & ucrReceiverData.GetVariableNames() & ")") - 'clsAddKey.AddParameter("data_name", strCurrDataName) - 'firstDayofTheYear() End Sub Private Sub ucrControls_ControlContentsChanged(ucrchangedControl As ucrCore) Handles ucrReceiverData.ControlContentsChanged, ucrInputSum.ControlContentsChanged, ucrNudSumOver.ControlContentsChanged - 'strCurrDataName = Chr(34) & ucrSelectorTransform.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34) sum_over() - 'clsRTrasform.AddParameter("calculated_from", " list(" & strCurrDataName & "=" & ucrReceiverData.GetVariableNames() & ")") - 'clsAddKey.AddParameter("data_name", strCurrDataName) - 'firstDayofTheYear() End Sub End Class \ No newline at end of file From 34ef5b011e7e01a3698aab7ab95724b6d8538927 Mon Sep 17 00:00:00 2001 From: John Lunalo Date: Tue, 9 May 2017 12:04:39 +0300 Subject: [PATCH 33/52] changing a message to error --- instat/static/InstatObject/R/data_object_R6.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/static/InstatObject/R/data_object_R6.R b/instat/static/InstatObject/R/data_object_R6.R index b7f7faeaf58..2acc63d1eb0 100644 --- a/instat/static/InstatObject/R/data_object_R6.R +++ b/instat/static/InstatObject/R/data_object_R6.R @@ -1480,7 +1480,7 @@ data_object$set("public", "add_key", function(col_names, key_name) { stop("key columns cannot have missing values") } if(self$is_key(col_names)) { - message("A key with these columns already exists. No action will be taken.") + stop("A key with these columns already exists.") } else { if(missing(key_name)) key_name <- next_default_item("key", names(private$keys)) From afa2077e266abd04402c9479e40fa7ba2d732a5f Mon Sep 17 00:00:00 2001 From: John Lunalo Date: Tue, 9 May 2017 14:37:36 +0300 Subject: [PATCH 34/52] warning message --- instat/static/InstatObject/R/data_object_R6.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/static/InstatObject/R/data_object_R6.R b/instat/static/InstatObject/R/data_object_R6.R index 833e4f4937b..3e6c23f6cfa 100644 --- a/instat/static/InstatObject/R/data_object_R6.R +++ b/instat/static/InstatObject/R/data_object_R6.R @@ -1484,7 +1484,7 @@ data_object$set("public", "add_key", function(col_names, key_name) { stop("key columns cannot have missing values") } if(self$is_key(col_names)) { - stop("A key with these columns already exists.") + warning("A key with these columns already exists. No action will be taken.") } else { if(missing(key_name)) key_name <- next_default_item("key", names(private$keys)) From 09ad31f2ff5642039ffd06fb9246636afa754a5a Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Tue, 9 May 2017 15:06:58 +0300 Subject: [PATCH 35/52] edits --- instat/dlgTransformClimatic.Designer.vb | 35 ++++++++++++------ instat/dlgTransformClimatic.vb | 48 +++++++++++++------------ 2 files changed, 50 insertions(+), 33 deletions(-) diff --git a/instat/dlgTransformClimatic.Designer.vb b/instat/dlgTransformClimatic.Designer.vb index 6452fbfa2a3..a9c5166d674 100644 --- a/instat/dlgTransformClimatic.Designer.vb +++ b/instat/dlgTransformClimatic.Designer.vb @@ -61,7 +61,8 @@ Partial Class dlgTransformClimatic Me.ucrReceiverDOY = New instat.ucrReceiverSingle() Me.ucrReceiverData = New instat.ucrReceiverSingle() Me.ucrBase = New instat.ucrButtons() - Me.UcrInputTextBox1 = New instat.ucrInputTextBox() + Me.ucrInputColName = New instat.ucrInputTextBox() + Me.lblNewColName = New System.Windows.Forms.Label() Me.grpTransform.SuspendLayout() Me.grpWaterBalance.SuspendLayout() Me.grpSpell.SuspendLayout() @@ -501,22 +502,33 @@ Partial Class dlgTransformClimatic Me.ucrBase.Size = New System.Drawing.Size(402, 52) Me.ucrBase.TabIndex = 0 ' - 'UcrInputTextBox1 + 'ucrInputColName ' - Me.UcrInputTextBox1.AddQuotesIfUnrecognised = True - Me.UcrInputTextBox1.IsMultiline = False - Me.UcrInputTextBox1.IsReadOnly = False - Me.UcrInputTextBox1.Location = New System.Drawing.Point(476, 157) - Me.UcrInputTextBox1.Name = "UcrInputTextBox1" - Me.UcrInputTextBox1.Size = New System.Drawing.Size(137, 21) - Me.UcrInputTextBox1.TabIndex = 49 + Me.ucrInputColName.AddQuotesIfUnrecognised = True + Me.ucrInputColName.IsMultiline = False + Me.ucrInputColName.IsReadOnly = False + Me.ucrInputColName.Location = New System.Drawing.Point(153, 413) + Me.ucrInputColName.Name = "ucrInputColName" + Me.ucrInputColName.Size = New System.Drawing.Size(137, 21) + Me.ucrInputColName.TabIndex = 49 + ' + 'lblNewColName + ' + Me.lblNewColName.AutoSize = True + Me.lblNewColName.Location = New System.Drawing.Point(40, 417) + Me.lblNewColName.Name = "lblNewColName" + Me.lblNewColName.Size = New System.Drawing.Size(101, 13) + Me.lblNewColName.TabIndex = 50 + Me.lblNewColName.Tag = "New Column Name:" + Me.lblNewColName.Text = "New Column Name:" ' 'dlgTransformClimatic ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(650, 492) - Me.Controls.Add(Me.UcrInputTextBox1) + Me.Controls.Add(Me.lblNewColName) + Me.Controls.Add(Me.ucrInputColName) Me.Controls.Add(Me.grpWaterBalance) Me.Controls.Add(Me.grpSpell) Me.Controls.Add(Me.grpCount) @@ -598,5 +610,6 @@ Partial Class dlgTransformClimatic Friend WithEvents lblWBEvaporation As Label Friend WithEvents ucrInputSpellUpper As ucrInputTextBox Friend WithEvents ucrInputSpellLower As ucrInputTextBox - Friend WithEvents UcrInputTextBox1 As ucrInputTextBox + Friend WithEvents ucrInputColName As ucrInputTextBox + Friend WithEvents lblNewColName As Label End Class diff --git a/instat/dlgTransformClimatic.vb b/instat/dlgTransformClimatic.vb index 7f0d508230e..b23b6000960 100644 --- a/instat/dlgTransformClimatic.vb +++ b/instat/dlgTransformClimatic.vb @@ -64,18 +64,17 @@ Public Class dlgTransformClimatic clsRSumFuncExpr.SetRCommand("rollapply") clsRZoo.SetRCommand("zoo") - - - ucrPnlTransform.AddRadioButton(rdoSum) ucrPnlTransform.AddRadioButton(rdoCount) ucrPnlTransform.AddRadioButton(rdoSpell) ucrPnlTransform.AddRadioButton(rdoWaterBalance) - ucrPnlTransform.AddFunctionNamesCondition(rdoSum, "") - ucrPnlTransform.AddFunctionNamesCondition(rdoCount, "") - ucrPnlTransform.AddFunctionNamesCondition(rdoSpell, "") - ucrPnlTransform.AddFunctionNamesCondition(rdoWaterBalance, "") + 'ucrPnlTransform.AddParameterIsRFunctionCondition(rdoSum, "clsSumFunction") + + 'ucrPnlTransform.AddFunctionNamesCondition(rdoSum, "clsRSumFuncExpr") + 'ucrPnlTransform.AddFunctionNamesCondition(rdoCount, "") + 'ucrPnlTransform.AddFunctionNamesCondition(rdoSpell, "") + 'ucrPnlTransform.AddFunctionNamesCondition(rdoWaterBalance, "") ucrNudThreshold.SetParameter(New RParameter("threshold")) ucrNudThreshold.SetMinMax(0, 100) @@ -126,10 +125,10 @@ Public Class dlgTransformClimatic 'ucrSaveTransform.SetParameter(New RParameter("result_name")) - UcrInputTextBox1.SetParameter(New RParameter("result_name")) + ucrInputColName.SetParameter(New RParameter("result_name")) - UcrInputTextBox1.SetPrefix("sum") - UcrInputTextBox1.SetName("sum") + ucrInputColName.SetPrefix("sum") + ucrInputColName.SetName("sum") 'ucrSaveTransform.SetDataFrameSelector(ucrSelectorTransform.ucrAvailableDataFrames) 'ucrSaveTransform.SetLabelText("New Column Name:") @@ -169,9 +168,9 @@ Public Class dlgTransformClimatic 'This might not Beep right 'clsRTrasform.AddParameter("result_name", Chr(34) & ucrSaveTransform.ucrInputTextSave.GetText & Chr(34)) clsRTrasform.AddParameter("save", 2) - 'ucrBase.clsRsyntax.SetBaseRFunction(clsSumFunction) - ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$apply_instat_calculation") - ucrBase.clsRsyntax.AddParameter("calc", clsRFunctionParameter:=clsRTrasform) + clsSumFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$apply_instat_calculation") + clsSumFunction.AddParameter("calc", clsRFunctionParameter:=clsRTrasform) + ucrBase.clsRsyntax.SetBaseRFunction(clsSumFunction) End Sub Private Sub SetRCodeForControls(bReset As Boolean) @@ -179,6 +178,7 @@ Public Class dlgTransformClimatic ucrReceiverData.SetRCode(clsRZoo, bReset) 'ucrSaveTransform.SetRCode(clsRTrasform, bReset) ucrInputSum.SetRCode(clsRSumFuncExpr, bReset) + 'ucrPnlTransform.SetRCode(clsRSumFuncExpr, bReset) End Sub Private Sub TestOkEnabled() @@ -193,25 +193,29 @@ Public Class dlgTransformClimatic Private Sub ucrPnlTransform_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrPnlTransform.ControlContentsChanged If rdoSum.Checked Then - ucrBase.clsRsyntax.AddParameter("calc", clsRFunctionParameter:=clsRTrasform) + ucrBase.clsRsyntax.SetBaseRFunction(clsSumFunction) + 'ucrBase.clsRsyntax.AddParameter("calc", clsRFunctionParameter:=clsRTrasform) 'ucrSaveTransform.SetPrefix("Sum") - UcrInputTextBox1.SetPrefix("Sum") - UcrInputTextBox1.SetName("Sum") + ucrInputColName.SetPrefix("Sum") + ucrInputColName.SetName("Sum") grpTransform.Text = "Sum" ElseIf rdoCount.Checked Then + ucrBase.clsRsyntax.SetBaseRFunction(clsCountFunction) 'ucrSaveTransform.SetPrefix("Count") - UcrInputTextBox1.SetPrefix("Count") - UcrInputTextBox1.SetName("Count") + ucrInputColName.SetPrefix("Count") + ucrInputColName.SetName("Count") grpTransform.Text = "Count" ElseIf rdoSpell.Checked Then + ucrBase.clsRsyntax.SetBaseRFunction(clsSpellFunction) 'ucrSaveTransform.SetPrefix("Spell") - UcrInputTextBox1.SetPrefix("Spell") - UcrInputTextBox1.SetName("Spell") + ucrInputColName.SetPrefix("Spell") + ucrInputColName.SetName("Spell") grpTransform.Text = "Spell" ElseIf rdoWaterBalance.Checked Then + ucrBase.clsRsyntax.SetBaseRFunction(clsWaterBalanceFunction) 'ucrSaveTransform.SetPrefix("Water_balance") - UcrInputTextBox1.SetPrefix("Water_balance") - UcrInputTextBox1.SetName("Water_balance") + ucrInputColName.SetPrefix("Water_balance") + ucrInputColName.SetName("Water_balance") grpTransform.Text = "Water_balance" End If End Sub From 0c92d1df14167c0c5ff7731ba1e2c336d4e79580 Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Tue, 9 May 2017 16:41:11 +0300 Subject: [PATCH 36/52] edits --- instat/dlgTransformClimatic.Designer.vb | 2 +- instat/dlgTransformClimatic.vb | 36 ++++++++++++------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/instat/dlgTransformClimatic.Designer.vb b/instat/dlgTransformClimatic.Designer.vb index a9c5166d674..d55fb5ad0bb 100644 --- a/instat/dlgTransformClimatic.Designer.vb +++ b/instat/dlgTransformClimatic.Designer.vb @@ -507,7 +507,7 @@ Partial Class dlgTransformClimatic Me.ucrInputColName.AddQuotesIfUnrecognised = True Me.ucrInputColName.IsMultiline = False Me.ucrInputColName.IsReadOnly = False - Me.ucrInputColName.Location = New System.Drawing.Point(153, 413) + Me.ucrInputColName.Location = New System.Drawing.Point(144, 412) Me.ucrInputColName.Name = "ucrInputColName" Me.ucrInputColName.Size = New System.Drawing.Size(137, 21) Me.ucrInputColName.TabIndex = 49 diff --git a/instat/dlgTransformClimatic.vb b/instat/dlgTransformClimatic.vb index b23b6000960..6dc2e437e53 100644 --- a/instat/dlgTransformClimatic.vb +++ b/instat/dlgTransformClimatic.vb @@ -18,7 +18,7 @@ Imports instat.Translations Public Class dlgTransformClimatic Private bFirstload As Boolean = True Private bReset As Boolean = True - Private clsRTrasform, clsRZoo, clsRSumFuncExpr As New RFunction + Private clsRTrasform, clsRSumFuncExpr As New RFunction Private clsSumFunction, clsCountFunction, clsSpellFunction, clsWaterBalanceFunction As New RFunction Private strCurrDataName As String = "" Private Sub dlgTransformClimatic_Load(sender As Object, e As EventArgs) Handles MyBase.Load @@ -56,13 +56,17 @@ Public Class dlgTransformClimatic ucrReceiverData.bAutoFill = True ucrReceiverYear.bAutoFill = True + ucrReceiverData.SetParameter(New RParameter("data", 0)) + ucrReceiverData.SetParameterIsString() + ucrReceiverData.bWithQuotes = False + ucrReceiverData.SetParameterIncludeArgumentName(False) + 'ucrSSTDataframe.SetParameter(New RParameter("data_name", 0)) 'ucrSSTDataframe.SetParameterIsrfunction() clsRTrasform.SetRCommand("instat_calculation$new") - clsRTrasform.SetAssignTo("transform_calculation") + 'clsRTrasform.SetAssignTo("transform_calculation") clsRSumFuncExpr.SetRCommand("rollapply") - clsRZoo.SetRCommand("zoo") ucrPnlTransform.AddRadioButton(rdoSum) ucrPnlTransform.AddRadioButton(rdoCount) @@ -130,18 +134,10 @@ Public Class dlgTransformClimatic ucrInputColName.SetPrefix("sum") ucrInputColName.SetName("sum") - 'ucrSaveTransform.SetDataFrameSelector(ucrSelectorTransform.ucrAvailableDataFrames) - 'ucrSaveTransform.SetLabelText("New Column Name:") - 'ucrSaveTransform.SetIsTextBox() - 'ucrSaveTransform.SetPrefix("Sum") - 'ucrSaveTransform.SetSaveTypeAsColumn() - ucrPnlTransform.AddToLinkedControls({ucrInputSum, ucrNudSumOver}, {rdoSum}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) ucrPnlTransform.AddToLinkedControls({ucrNudCountOver, ucrChkValuesUnderthreshold}, {rdoCount}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) ucrPnlTransform.AddToLinkedControls({ucrInputSpellLower, ucrInputSpellUpper}, {rdoSpell}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) ucrPnlTransform.AddToLinkedControls({ucrNudWBCapacity, ucrInputEvaporation}, {rdoWaterBalance}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) - - End Sub Private Sub SetDefaults() @@ -152,12 +148,9 @@ Public Class dlgTransformClimatic 'ucrSaveTransform.Reset() ucrSelectorTransform.Reset() - ucrReceiverData.SetParameter(New RParameter("x", 0)) - ucrReceiverData.SetParameterIsString() - ucrReceiverData.bWithQuotes = False - ucrReceiverData.SetParameterIncludeArgumentName(False) - clsRSumFuncExpr.AddParameter("data", clsRFunctionParameter:=clsRZoo) + + clsRSumFuncExpr.AddParameter("data", ucrReceiverData.GetVariableNames(bWithQuotes:=False)) clsRSumFuncExpr.AddParameter("fill", "NA") clsRSumFuncExpr.AddParameter("width", 1) clsRSumFuncExpr.AddParameter("FUN", "sum") @@ -168,16 +161,18 @@ Public Class dlgTransformClimatic 'This might not Beep right 'clsRTrasform.AddParameter("result_name", Chr(34) & ucrSaveTransform.ucrInputTextSave.GetText & Chr(34)) clsRTrasform.AddParameter("save", 2) - clsSumFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$apply_instat_calculation") + clsSumFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$run_instat_calculation") + clsSumFunction.AddParameter("display", "FALSE") clsSumFunction.AddParameter("calc", clsRFunctionParameter:=clsRTrasform) ucrBase.clsRsyntax.SetBaseRFunction(clsSumFunction) End Sub Private Sub SetRCodeForControls(bReset As Boolean) ucrNudSumOver.SetRCode(clsRSumFuncExpr, bReset) - ucrReceiverData.SetRCode(clsRZoo, bReset) + ucrReceiverData.SetRCode(clsRSumFuncExpr, bReset) 'ucrSaveTransform.SetRCode(clsRTrasform, bReset) ucrInputSum.SetRCode(clsRSumFuncExpr, bReset) + ucrInputColName.SetRCode(clsRTrasform, bReset) 'ucrPnlTransform.SetRCode(clsRSumFuncExpr, bReset) End Sub @@ -238,4 +233,9 @@ Public Class dlgTransformClimatic Private Sub ucrControls_ControlContentsChanged(ucrchangedControl As ucrCore) Handles ucrReceiverData.ControlContentsChanged, ucrInputSum.ControlContentsChanged, ucrNudSumOver.ControlContentsChanged sum_over() End Sub + + Private Sub ucrControls_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverData.ControlValueChanged, ucrInputSum.ControlValueChanged, ucrNudSumOver.ControlValueChanged + sum_over() + 'clsRTrasform.SetAssignTo("transform_calculation") + End Sub End Class \ No newline at end of file From 9a4f25d08ec047d5405c114408fe91cb6572f54e Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Tue, 9 May 2017 16:54:32 +0300 Subject: [PATCH 37/52] tyding up the code --- instat/dlgTransformClimatic.Designer.vb | 115 ++++++++---------------- instat/dlgTransformClimatic.vb | 14 ++- 2 files changed, 41 insertions(+), 88 deletions(-) diff --git a/instat/dlgTransformClimatic.Designer.vb b/instat/dlgTransformClimatic.Designer.vb index d55fb5ad0bb..3be3d1e5bb4 100644 --- a/instat/dlgTransformClimatic.Designer.vb +++ b/instat/dlgTransformClimatic.Designer.vb @@ -37,18 +37,14 @@ Partial Class dlgTransformClimatic Me.ucrNudSumOver = New instat.ucrNud() Me.lblSumOver = New System.Windows.Forms.Label() Me.ucrInputSum = New instat.ucrInputComboBox() - Me.grpWaterBalance = New System.Windows.Forms.GroupBox() Me.ucrInputEvaporation = New instat.ucrInputTextBox() Me.lblWBEvaporation = New System.Windows.Forms.Label() Me.ucrNudWBCapacity = New instat.ucrNud() Me.lblWBCapacity = New System.Windows.Forms.Label() - Me.grpSpell = New System.Windows.Forms.GroupBox() Me.ucrInputSpellUpper = New instat.ucrInputTextBox() Me.ucrInputSpellLower = New instat.ucrInputTextBox() Me.lblSpellAnd = New System.Windows.Forms.Label() Me.lblValuesBetween = New System.Windows.Forms.Label() - Me.grpCount = New System.Windows.Forms.GroupBox() - Me.ucrChkValuesUnderthreshold = New instat.ucrCheck() Me.lblCountRows = New System.Windows.Forms.Label() Me.ucrNudCountOver = New instat.ucrNud() Me.lblCountOver = New System.Windows.Forms.Label() @@ -63,10 +59,8 @@ Partial Class dlgTransformClimatic Me.ucrBase = New instat.ucrButtons() Me.ucrInputColName = New instat.ucrInputTextBox() Me.lblNewColName = New System.Windows.Forms.Label() + Me.ucrChkValuesUnderthreshold = New instat.ucrCheck() Me.grpTransform.SuspendLayout() - Me.grpWaterBalance.SuspendLayout() - Me.grpSpell.SuspendLayout() - Me.grpCount.SuspendLayout() Me.SuspendLayout() ' 'lblYear @@ -198,13 +192,25 @@ Partial Class dlgTransformClimatic ' 'grpTransform ' + Me.grpTransform.Controls.Add(Me.ucrInputEvaporation) + Me.grpTransform.Controls.Add(Me.ucrInputSpellUpper) + Me.grpTransform.Controls.Add(Me.lblWBEvaporation) + Me.grpTransform.Controls.Add(Me.ucrChkValuesUnderthreshold) + Me.grpTransform.Controls.Add(Me.ucrNudWBCapacity) + Me.grpTransform.Controls.Add(Me.ucrInputSpellLower) + Me.grpTransform.Controls.Add(Me.lblWBCapacity) Me.grpTransform.Controls.Add(Me.lblSumRows) + Me.grpTransform.Controls.Add(Me.lblSpellAnd) + Me.grpTransform.Controls.Add(Me.lblCountRows) + Me.grpTransform.Controls.Add(Me.lblValuesBetween) Me.grpTransform.Controls.Add(Me.ucrNudSumOver) + Me.grpTransform.Controls.Add(Me.ucrNudCountOver) Me.grpTransform.Controls.Add(Me.lblSumOver) + Me.grpTransform.Controls.Add(Me.lblCountOver) Me.grpTransform.Controls.Add(Me.ucrInputSum) Me.grpTransform.Location = New System.Drawing.Point(27, 275) Me.grpTransform.Name = "grpTransform" - Me.grpTransform.Size = New System.Drawing.Size(289, 48) + Me.grpTransform.Size = New System.Drawing.Size(289, 139) Me.grpTransform.TabIndex = 46 Me.grpTransform.TabStop = False Me.grpTransform.Text = "Sum" @@ -250,25 +256,12 @@ Partial Class dlgTransformClimatic Me.ucrInputSum.Size = New System.Drawing.Size(106, 21) Me.ucrInputSum.TabIndex = 0 ' - 'grpWaterBalance - ' - Me.grpWaterBalance.Controls.Add(Me.ucrInputEvaporation) - Me.grpWaterBalance.Controls.Add(Me.lblWBEvaporation) - Me.grpWaterBalance.Controls.Add(Me.ucrNudWBCapacity) - Me.grpWaterBalance.Controls.Add(Me.lblWBCapacity) - Me.grpWaterBalance.Location = New System.Drawing.Point(354, 343) - Me.grpWaterBalance.Name = "grpWaterBalance" - Me.grpWaterBalance.Size = New System.Drawing.Size(284, 50) - Me.grpWaterBalance.TabIndex = 47 - Me.grpWaterBalance.TabStop = False - Me.grpWaterBalance.Text = "Water Balance" - ' 'ucrInputEvaporation ' Me.ucrInputEvaporation.AddQuotesIfUnrecognised = True Me.ucrInputEvaporation.IsMultiline = False Me.ucrInputEvaporation.IsReadOnly = False - Me.ucrInputEvaporation.Location = New System.Drawing.Point(210, 19) + Me.ucrInputEvaporation.Location = New System.Drawing.Point(198, 104) Me.ucrInputEvaporation.Name = "ucrInputEvaporation" Me.ucrInputEvaporation.Size = New System.Drawing.Size(63, 21) Me.ucrInputEvaporation.TabIndex = 49 @@ -276,7 +269,7 @@ Partial Class dlgTransformClimatic 'lblWBEvaporation ' Me.lblWBEvaporation.AutoSize = True - Me.lblWBEvaporation.Location = New System.Drawing.Point(140, 20) + Me.lblWBEvaporation.Location = New System.Drawing.Point(128, 105) Me.lblWBEvaporation.Name = "lblWBEvaporation" Me.lblWBEvaporation.Size = New System.Drawing.Size(64, 13) Me.lblWBEvaporation.TabIndex = 48 @@ -287,7 +280,7 @@ Partial Class dlgTransformClimatic ' Me.ucrNudWBCapacity.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudWBCapacity.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudWBCapacity.Location = New System.Drawing.Point(92, 19) + Me.ucrNudWBCapacity.Location = New System.Drawing.Point(80, 104) Me.ucrNudWBCapacity.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) Me.ucrNudWBCapacity.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudWBCapacity.Name = "ucrNudWBCapacity" @@ -298,32 +291,19 @@ Partial Class dlgTransformClimatic 'lblWBCapacity ' Me.lblWBCapacity.AutoSize = True - Me.lblWBCapacity.Location = New System.Drawing.Point(38, 20) + Me.lblWBCapacity.Location = New System.Drawing.Point(26, 105) Me.lblWBCapacity.Name = "lblWBCapacity" Me.lblWBCapacity.Size = New System.Drawing.Size(48, 13) Me.lblWBCapacity.TabIndex = 46 Me.lblWBCapacity.Tag = "Capacity" Me.lblWBCapacity.Text = "Capacity" ' - 'grpSpell - ' - Me.grpSpell.Controls.Add(Me.ucrInputSpellUpper) - Me.grpSpell.Controls.Add(Me.ucrInputSpellLower) - Me.grpSpell.Controls.Add(Me.lblSpellAnd) - Me.grpSpell.Controls.Add(Me.lblValuesBetween) - Me.grpSpell.Location = New System.Drawing.Point(345, 265) - Me.grpSpell.Name = "grpSpell" - Me.grpSpell.Size = New System.Drawing.Size(255, 41) - Me.grpSpell.TabIndex = 47 - Me.grpSpell.TabStop = False - Me.grpSpell.Text = "Spell" - ' 'ucrInputSpellUpper ' Me.ucrInputSpellUpper.AddQuotesIfUnrecognised = True Me.ucrInputSpellUpper.IsMultiline = False Me.ucrInputSpellUpper.IsReadOnly = False - Me.ucrInputSpellUpper.Location = New System.Drawing.Point(186, 12) + Me.ucrInputSpellUpper.Location = New System.Drawing.Point(193, 76) Me.ucrInputSpellUpper.Name = "ucrInputSpellUpper" Me.ucrInputSpellUpper.Size = New System.Drawing.Size(63, 21) Me.ucrInputSpellUpper.TabIndex = 57 @@ -333,7 +313,7 @@ Partial Class dlgTransformClimatic Me.ucrInputSpellLower.AddQuotesIfUnrecognised = True Me.ucrInputSpellLower.IsMultiline = False Me.ucrInputSpellLower.IsReadOnly = False - Me.ucrInputSpellLower.Location = New System.Drawing.Point(88, 10) + Me.ucrInputSpellLower.Location = New System.Drawing.Point(95, 74) Me.ucrInputSpellLower.Name = "ucrInputSpellLower" Me.ucrInputSpellLower.Size = New System.Drawing.Size(63, 21) Me.ucrInputSpellLower.TabIndex = 56 @@ -341,7 +321,7 @@ Partial Class dlgTransformClimatic 'lblSpellAnd ' Me.lblSpellAnd.AutoSize = True - Me.lblSpellAnd.Location = New System.Drawing.Point(149, 12) + Me.lblSpellAnd.Location = New System.Drawing.Point(156, 76) Me.lblSpellAnd.Name = "lblSpellAnd" Me.lblSpellAnd.Size = New System.Drawing.Size(25, 13) Me.lblSpellAnd.TabIndex = 54 @@ -351,38 +331,17 @@ Partial Class dlgTransformClimatic 'lblValuesBetween ' Me.lblValuesBetween.AutoSize = True - Me.lblValuesBetween.Location = New System.Drawing.Point(6, 12) + Me.lblValuesBetween.Location = New System.Drawing.Point(13, 76) Me.lblValuesBetween.Name = "lblValuesBetween" Me.lblValuesBetween.Size = New System.Drawing.Size(84, 13) Me.lblValuesBetween.TabIndex = 52 Me.lblValuesBetween.Tag = "Values_Between" Me.lblValuesBetween.Text = "Values Between" ' - 'grpCount - ' - Me.grpCount.Controls.Add(Me.ucrChkValuesUnderthreshold) - Me.grpCount.Controls.Add(Me.lblCountRows) - Me.grpCount.Controls.Add(Me.ucrNudCountOver) - Me.grpCount.Controls.Add(Me.lblCountOver) - Me.grpCount.Location = New System.Drawing.Point(43, 329) - Me.grpCount.Name = "grpCount" - Me.grpCount.Size = New System.Drawing.Size(264, 77) - Me.grpCount.TabIndex = 47 - Me.grpCount.TabStop = False - Me.grpCount.Text = "Count" - ' - 'ucrChkValuesUnderthreshold - ' - Me.ucrChkValuesUnderthreshold.Checked = False - Me.ucrChkValuesUnderthreshold.Location = New System.Drawing.Point(12, 44) - Me.ucrChkValuesUnderthreshold.Name = "ucrChkValuesUnderthreshold" - Me.ucrChkValuesUnderthreshold.Size = New System.Drawing.Size(100, 20) - Me.ucrChkValuesUnderthreshold.TabIndex = 52 - ' 'lblCountRows ' Me.lblCountRows.AutoSize = True - Me.lblCountRows.Location = New System.Drawing.Point(136, 18) + Me.lblCountRows.Location = New System.Drawing.Point(140, 42) Me.lblCountRows.Name = "lblCountRows" Me.lblCountRows.Size = New System.Drawing.Size(29, 13) Me.lblCountRows.TabIndex = 51 @@ -393,7 +352,7 @@ Partial Class dlgTransformClimatic ' Me.ucrNudCountOver.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudCountOver.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudCountOver.Location = New System.Drawing.Point(80, 18) + Me.ucrNudCountOver.Location = New System.Drawing.Point(84, 42) Me.ucrNudCountOver.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) Me.ucrNudCountOver.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudCountOver.Name = "ucrNudCountOver" @@ -404,7 +363,7 @@ Partial Class dlgTransformClimatic 'lblCountOver ' Me.lblCountOver.AutoSize = True - Me.lblCountOver.Location = New System.Drawing.Point(9, 18) + Me.lblCountOver.Location = New System.Drawing.Point(13, 42) Me.lblCountOver.Name = "lblCountOver" Me.lblCountOver.Size = New System.Drawing.Size(61, 13) Me.lblCountOver.TabIndex = 49 @@ -522,16 +481,21 @@ Partial Class dlgTransformClimatic Me.lblNewColName.Tag = "New Column Name:" Me.lblNewColName.Text = "New Column Name:" ' + 'ucrChkValuesUnderthreshold + ' + Me.ucrChkValuesUnderthreshold.Checked = False + Me.ucrChkValuesUnderthreshold.Location = New System.Drawing.Point(177, 42) + Me.ucrChkValuesUnderthreshold.Name = "ucrChkValuesUnderthreshold" + Me.ucrChkValuesUnderthreshold.Size = New System.Drawing.Size(100, 20) + Me.ucrChkValuesUnderthreshold.TabIndex = 52 + ' 'dlgTransformClimatic ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(650, 492) + Me.ClientSize = New System.Drawing.Size(471, 492) Me.Controls.Add(Me.lblNewColName) Me.Controls.Add(Me.ucrInputColName) - Me.Controls.Add(Me.grpWaterBalance) - Me.Controls.Add(Me.grpSpell) - Me.Controls.Add(Me.grpCount) Me.Controls.Add(Me.grpTransform) Me.Controls.Add(Me.ucrNudThreshold) Me.Controls.Add(Me.lblThreshold) @@ -560,12 +524,6 @@ Partial Class dlgTransformClimatic Me.Text = "Transform" Me.grpTransform.ResumeLayout(False) Me.grpTransform.PerformLayout() - Me.grpWaterBalance.ResumeLayout(False) - Me.grpWaterBalance.PerformLayout() - Me.grpSpell.ResumeLayout(False) - Me.grpSpell.PerformLayout() - Me.grpCount.ResumeLayout(False) - Me.grpCount.PerformLayout() Me.ResumeLayout(False) Me.PerformLayout() @@ -588,9 +546,6 @@ Partial Class dlgTransformClimatic Friend WithEvents rdoSum As RadioButton Friend WithEvents rdoCount As RadioButton Friend WithEvents ucrPnlTransform As UcrPanel - Friend WithEvents grpWaterBalance As GroupBox - Friend WithEvents grpSpell As GroupBox - Friend WithEvents grpCount As GroupBox Friend WithEvents lblCountRows As Label Friend WithEvents ucrNudCountOver As ucrNud Friend WithEvents lblCountOver As Label @@ -603,7 +558,6 @@ Partial Class dlgTransformClimatic Friend WithEvents lblThreshold As Label Friend WithEvents lblSpellAnd As Label Friend WithEvents lblValuesBetween As Label - Friend WithEvents ucrChkValuesUnderthreshold As ucrCheck Friend WithEvents ucrNudWBCapacity As ucrNud Friend WithEvents lblWBCapacity As Label Friend WithEvents ucrInputEvaporation As ucrInputTextBox @@ -612,4 +566,5 @@ Partial Class dlgTransformClimatic Friend WithEvents ucrInputSpellLower As ucrInputTextBox Friend WithEvents ucrInputColName As ucrInputTextBox Friend WithEvents lblNewColName As Label + Friend WithEvents ucrChkValuesUnderthreshold As ucrCheck End Class diff --git a/instat/dlgTransformClimatic.vb b/instat/dlgTransformClimatic.vb index 6dc2e437e53..bbfd45db745 100644 --- a/instat/dlgTransformClimatic.vb +++ b/instat/dlgTransformClimatic.vb @@ -131,7 +131,7 @@ Public Class dlgTransformClimatic ucrInputColName.SetParameter(New RParameter("result_name")) - ucrInputColName.SetPrefix("sum") + 'ucrInputColName.SetPrefix("sum") ucrInputColName.SetName("sum") ucrPnlTransform.AddToLinkedControls({ucrInputSum, ucrNudSumOver}, {rdoSum}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True) @@ -147,8 +147,7 @@ Public Class dlgTransformClimatic clsWaterBalanceFunction = New RFunction 'ucrSaveTransform.Reset() ucrSelectorTransform.Reset() - - + rdoSum.Checked = True 'this wil be fixed properly clsRSumFuncExpr.AddParameter("data", ucrReceiverData.GetVariableNames(bWithQuotes:=False)) clsRSumFuncExpr.AddParameter("fill", "NA") @@ -191,25 +190,25 @@ Public Class dlgTransformClimatic ucrBase.clsRsyntax.SetBaseRFunction(clsSumFunction) 'ucrBase.clsRsyntax.AddParameter("calc", clsRFunctionParameter:=clsRTrasform) 'ucrSaveTransform.SetPrefix("Sum") - ucrInputColName.SetPrefix("Sum") + 'ucrInputColName.SetPrefix("Sum") ucrInputColName.SetName("Sum") grpTransform.Text = "Sum" ElseIf rdoCount.Checked Then ucrBase.clsRsyntax.SetBaseRFunction(clsCountFunction) 'ucrSaveTransform.SetPrefix("Count") - ucrInputColName.SetPrefix("Count") + 'ucrInputColName.SetPrefix("Count") ucrInputColName.SetName("Count") grpTransform.Text = "Count" ElseIf rdoSpell.Checked Then ucrBase.clsRsyntax.SetBaseRFunction(clsSpellFunction) 'ucrSaveTransform.SetPrefix("Spell") - ucrInputColName.SetPrefix("Spell") + 'ucrInputColName.SetPrefix("Spell") ucrInputColName.SetName("Spell") grpTransform.Text = "Spell" ElseIf rdoWaterBalance.Checked Then ucrBase.clsRsyntax.SetBaseRFunction(clsWaterBalanceFunction) 'ucrSaveTransform.SetPrefix("Water_balance") - ucrInputColName.SetPrefix("Water_balance") + 'ucrInputColName.SetPrefix("Water_balance") ucrInputColName.SetName("Water_balance") grpTransform.Text = "Water_balance" End If @@ -236,6 +235,5 @@ Public Class dlgTransformClimatic Private Sub ucrControls_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverData.ControlValueChanged, ucrInputSum.ControlValueChanged, ucrNudSumOver.ControlValueChanged sum_over() - 'clsRTrasform.SetAssignTo("transform_calculation") End Sub End Class \ No newline at end of file From fa1983f05ab3b2022442c48baac9abe22c96a493 Mon Sep 17 00:00:00 2001 From: shadrack kibet Date: Tue, 9 May 2017 19:23:41 +0300 Subject: [PATCH 38/52] designer changes and disabling some controls for now. --- instat/dlgTransformClimatic.Designer.vb | 341 ++++++++++++++---------- instat/dlgTransformClimatic.vb | 8 + 2 files changed, 201 insertions(+), 148 deletions(-) diff --git a/instat/dlgTransformClimatic.Designer.vb b/instat/dlgTransformClimatic.Designer.vb index 3be3d1e5bb4..f33ac49e348 100644 --- a/instat/dlgTransformClimatic.Designer.vb +++ b/instat/dlgTransformClimatic.Designer.vb @@ -34,20 +34,26 @@ Partial Class dlgTransformClimatic Me.lblThreshold = New System.Windows.Forms.Label() Me.grpTransform = New System.Windows.Forms.GroupBox() Me.lblSumRows = New System.Windows.Forms.Label() - Me.ucrNudSumOver = New instat.ucrNud() Me.lblSumOver = New System.Windows.Forms.Label() - Me.ucrInputSum = New instat.ucrInputComboBox() - Me.ucrInputEvaporation = New instat.ucrInputTextBox() + Me.lblNewColName = New System.Windows.Forms.Label() + Me.grpCount = New System.Windows.Forms.GroupBox() + Me.lblCountRows = New System.Windows.Forms.Label() + Me.lblCountOver = New System.Windows.Forms.Label() + Me.grpSpells = New System.Windows.Forms.GroupBox() + Me.lblSpellAnd = New System.Windows.Forms.Label() + Me.lblValuesBetween = New System.Windows.Forms.Label() + Me.grpWaterbalance = New System.Windows.Forms.GroupBox() Me.lblWBEvaporation = New System.Windows.Forms.Label() - Me.ucrNudWBCapacity = New instat.ucrNud() Me.lblWBCapacity = New System.Windows.Forms.Label() + Me.ucrInputEvaporation = New instat.ucrInputTextBox() + Me.ucrNudWBCapacity = New instat.ucrNud() Me.ucrInputSpellUpper = New instat.ucrInputTextBox() Me.ucrInputSpellLower = New instat.ucrInputTextBox() - Me.lblSpellAnd = New System.Windows.Forms.Label() - Me.lblValuesBetween = New System.Windows.Forms.Label() - Me.lblCountRows = New System.Windows.Forms.Label() + Me.ucrChkValuesUnderthreshold = New instat.ucrCheck() Me.ucrNudCountOver = New instat.ucrNud() - Me.lblCountOver = New System.Windows.Forms.Label() + Me.ucrInputColName = New instat.ucrInputTextBox() + Me.ucrNudSumOver = New instat.ucrNud() + Me.ucrInputSum = New instat.ucrInputComboBox() Me.ucrNudThreshold = New instat.ucrNud() Me.ucrPnlTransform = New instat.UcrPanel() Me.ucrReceiverStation = New instat.ucrReceiverSingle() @@ -57,10 +63,10 @@ Partial Class dlgTransformClimatic Me.ucrReceiverDOY = New instat.ucrReceiverSingle() Me.ucrReceiverData = New instat.ucrReceiverSingle() Me.ucrBase = New instat.ucrButtons() - Me.ucrInputColName = New instat.ucrInputTextBox() - Me.lblNewColName = New System.Windows.Forms.Label() - Me.ucrChkValuesUnderthreshold = New instat.ucrCheck() Me.grpTransform.SuspendLayout() + Me.grpCount.SuspendLayout() + Me.grpSpells.SuspendLayout() + Me.grpWaterbalance.SuspendLayout() Me.SuspendLayout() ' 'lblYear @@ -192,25 +198,13 @@ Partial Class dlgTransformClimatic ' 'grpTransform ' - Me.grpTransform.Controls.Add(Me.ucrInputEvaporation) - Me.grpTransform.Controls.Add(Me.ucrInputSpellUpper) - Me.grpTransform.Controls.Add(Me.lblWBEvaporation) - Me.grpTransform.Controls.Add(Me.ucrChkValuesUnderthreshold) - Me.grpTransform.Controls.Add(Me.ucrNudWBCapacity) - Me.grpTransform.Controls.Add(Me.ucrInputSpellLower) - Me.grpTransform.Controls.Add(Me.lblWBCapacity) Me.grpTransform.Controls.Add(Me.lblSumRows) - Me.grpTransform.Controls.Add(Me.lblSpellAnd) - Me.grpTransform.Controls.Add(Me.lblCountRows) - Me.grpTransform.Controls.Add(Me.lblValuesBetween) Me.grpTransform.Controls.Add(Me.ucrNudSumOver) - Me.grpTransform.Controls.Add(Me.ucrNudCountOver) Me.grpTransform.Controls.Add(Me.lblSumOver) - Me.grpTransform.Controls.Add(Me.lblCountOver) Me.grpTransform.Controls.Add(Me.ucrInputSum) - Me.grpTransform.Location = New System.Drawing.Point(27, 275) + Me.grpTransform.Location = New System.Drawing.Point(10, 273) Me.grpTransform.Name = "grpTransform" - Me.grpTransform.Size = New System.Drawing.Size(289, 139) + Me.grpTransform.Size = New System.Drawing.Size(284, 58) Me.grpTransform.TabIndex = 46 Me.grpTransform.TabStop = False Me.grpTransform.Text = "Sum" @@ -225,18 +219,6 @@ Partial Class dlgTransformClimatic Me.lblSumRows.Tag = "rows" Me.lblSumRows.Text = "rows" ' - 'ucrNudSumOver - ' - Me.ucrNudSumOver.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudSumOver.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudSumOver.Location = New System.Drawing.Point(173, 18) - Me.ucrNudSumOver.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudSumOver.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudSumOver.Name = "ucrNudSumOver" - Me.ucrNudSumOver.Size = New System.Drawing.Size(50, 20) - Me.ucrNudSumOver.TabIndex = 47 - Me.ucrNudSumOver.Value = New Decimal(New Integer() {0, 0, 0, 0}) - ' 'lblSumOver ' Me.lblSumOver.AutoSize = True @@ -247,128 +229,207 @@ Partial Class dlgTransformClimatic Me.lblSumOver.Tag = "Over" Me.lblSumOver.Text = "Over" ' - 'ucrInputSum + 'lblNewColName ' - Me.ucrInputSum.AddQuotesIfUnrecognised = True - Me.ucrInputSum.IsReadOnly = False - Me.ucrInputSum.Location = New System.Drawing.Point(16, 18) - Me.ucrInputSum.Name = "ucrInputSum" - Me.ucrInputSum.Size = New System.Drawing.Size(106, 21) - Me.ucrInputSum.TabIndex = 0 + Me.lblNewColName.AutoSize = True + Me.lblNewColName.Location = New System.Drawing.Point(10, 409) + Me.lblNewColName.Name = "lblNewColName" + Me.lblNewColName.Size = New System.Drawing.Size(101, 13) + Me.lblNewColName.TabIndex = 50 + Me.lblNewColName.Tag = "New Column Name:" + Me.lblNewColName.Text = "New Column Name:" ' - 'ucrInputEvaporation + 'grpCount ' - Me.ucrInputEvaporation.AddQuotesIfUnrecognised = True - Me.ucrInputEvaporation.IsMultiline = False - Me.ucrInputEvaporation.IsReadOnly = False - Me.ucrInputEvaporation.Location = New System.Drawing.Point(198, 104) - Me.ucrInputEvaporation.Name = "ucrInputEvaporation" - Me.ucrInputEvaporation.Size = New System.Drawing.Size(63, 21) - Me.ucrInputEvaporation.TabIndex = 49 + Me.grpCount.Controls.Add(Me.ucrChkValuesUnderthreshold) + Me.grpCount.Controls.Add(Me.lblCountRows) + Me.grpCount.Controls.Add(Me.ucrNudCountOver) + Me.grpCount.Controls.Add(Me.lblCountOver) + Me.grpCount.Location = New System.Drawing.Point(313, 273) + Me.grpCount.Name = "grpCount" + Me.grpCount.Size = New System.Drawing.Size(256, 58) + Me.grpCount.TabIndex = 51 + Me.grpCount.TabStop = False + Me.grpCount.Text = "Count" + ' + 'lblCountRows + ' + Me.lblCountRows.AutoSize = True + Me.lblCountRows.Location = New System.Drawing.Point(115, 20) + Me.lblCountRows.Name = "lblCountRows" + Me.lblCountRows.Size = New System.Drawing.Size(29, 13) + Me.lblCountRows.TabIndex = 55 + Me.lblCountRows.Tag = "rows" + Me.lblCountRows.Text = "rows" + ' + 'lblCountOver + ' + Me.lblCountOver.AutoSize = True + Me.lblCountOver.Location = New System.Drawing.Point(-1, 20) + Me.lblCountOver.Name = "lblCountOver" + Me.lblCountOver.Size = New System.Drawing.Size(61, 13) + Me.lblCountOver.TabIndex = 53 + Me.lblCountOver.Tag = "Count_Over" + Me.lblCountOver.Text = "Count Over" + ' + 'grpSpells + ' + Me.grpSpells.Controls.Add(Me.ucrInputSpellUpper) + Me.grpSpells.Controls.Add(Me.ucrInputSpellLower) + Me.grpSpells.Controls.Add(Me.lblSpellAnd) + Me.grpSpells.Controls.Add(Me.lblValuesBetween) + Me.grpSpells.Location = New System.Drawing.Point(318, 337) + Me.grpSpells.Name = "grpSpells" + Me.grpSpells.Size = New System.Drawing.Size(251, 60) + Me.grpSpells.TabIndex = 0 + Me.grpSpells.TabStop = False + Me.grpSpells.Text = "Spells" + ' + 'lblSpellAnd + ' + Me.lblSpellAnd.AutoSize = True + Me.lblSpellAnd.Location = New System.Drawing.Point(151, 20) + Me.lblSpellAnd.Name = "lblSpellAnd" + Me.lblSpellAnd.Size = New System.Drawing.Size(25, 13) + Me.lblSpellAnd.TabIndex = 59 + Me.lblSpellAnd.Tag = "and" + Me.lblSpellAnd.Text = "and" + ' + 'lblValuesBetween + ' + Me.lblValuesBetween.AutoSize = True + Me.lblValuesBetween.Location = New System.Drawing.Point(0, 20) + Me.lblValuesBetween.Name = "lblValuesBetween" + Me.lblValuesBetween.Size = New System.Drawing.Size(84, 13) + Me.lblValuesBetween.TabIndex = 58 + Me.lblValuesBetween.Tag = "Values_Between" + Me.lblValuesBetween.Text = "Values Between" + ' + 'grpWaterbalance + ' + Me.grpWaterbalance.Controls.Add(Me.ucrInputEvaporation) + Me.grpWaterbalance.Controls.Add(Me.lblWBEvaporation) + Me.grpWaterbalance.Controls.Add(Me.ucrNudWBCapacity) + Me.grpWaterbalance.Controls.Add(Me.lblWBCapacity) + Me.grpWaterbalance.Location = New System.Drawing.Point(10, 330) + Me.grpWaterbalance.Name = "grpWaterbalance" + Me.grpWaterbalance.Size = New System.Drawing.Size(292, 67) + Me.grpWaterbalance.TabIndex = 52 + Me.grpWaterbalance.TabStop = False + Me.grpWaterbalance.Text = "Water Balance" ' 'lblWBEvaporation ' Me.lblWBEvaporation.AutoSize = True - Me.lblWBEvaporation.Location = New System.Drawing.Point(128, 105) + Me.lblWBEvaporation.Location = New System.Drawing.Point(146, 20) Me.lblWBEvaporation.Name = "lblWBEvaporation" Me.lblWBEvaporation.Size = New System.Drawing.Size(64, 13) - Me.lblWBEvaporation.TabIndex = 48 + Me.lblWBEvaporation.TabIndex = 52 Me.lblWBEvaporation.Tag = "Evaporation" Me.lblWBEvaporation.Text = "Evaporation" ' + 'lblWBCapacity + ' + Me.lblWBCapacity.AutoSize = True + Me.lblWBCapacity.Location = New System.Drawing.Point(20, 21) + Me.lblWBCapacity.Name = "lblWBCapacity" + Me.lblWBCapacity.Size = New System.Drawing.Size(48, 13) + Me.lblWBCapacity.TabIndex = 50 + Me.lblWBCapacity.Tag = "Capacity" + Me.lblWBCapacity.Text = "Capacity" + ' + 'ucrInputEvaporation + ' + Me.ucrInputEvaporation.AddQuotesIfUnrecognised = True + Me.ucrInputEvaporation.IsMultiline = False + Me.ucrInputEvaporation.IsReadOnly = False + Me.ucrInputEvaporation.Location = New System.Drawing.Point(212, 16) + Me.ucrInputEvaporation.Name = "ucrInputEvaporation" + Me.ucrInputEvaporation.Size = New System.Drawing.Size(63, 21) + Me.ucrInputEvaporation.TabIndex = 53 + ' 'ucrNudWBCapacity ' Me.ucrNudWBCapacity.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudWBCapacity.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudWBCapacity.Location = New System.Drawing.Point(80, 104) + Me.ucrNudWBCapacity.Location = New System.Drawing.Point(75, 20) Me.ucrNudWBCapacity.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) Me.ucrNudWBCapacity.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudWBCapacity.Name = "ucrNudWBCapacity" Me.ucrNudWBCapacity.Size = New System.Drawing.Size(50, 20) - Me.ucrNudWBCapacity.TabIndex = 47 + Me.ucrNudWBCapacity.TabIndex = 51 Me.ucrNudWBCapacity.Value = New Decimal(New Integer() {0, 0, 0, 0}) ' - 'lblWBCapacity - ' - Me.lblWBCapacity.AutoSize = True - Me.lblWBCapacity.Location = New System.Drawing.Point(26, 105) - Me.lblWBCapacity.Name = "lblWBCapacity" - Me.lblWBCapacity.Size = New System.Drawing.Size(48, 13) - Me.lblWBCapacity.TabIndex = 46 - Me.lblWBCapacity.Tag = "Capacity" - Me.lblWBCapacity.Text = "Capacity" - ' 'ucrInputSpellUpper ' Me.ucrInputSpellUpper.AddQuotesIfUnrecognised = True Me.ucrInputSpellUpper.IsMultiline = False Me.ucrInputSpellUpper.IsReadOnly = False - Me.ucrInputSpellUpper.Location = New System.Drawing.Point(193, 76) + Me.ucrInputSpellUpper.Location = New System.Drawing.Point(180, 15) Me.ucrInputSpellUpper.Name = "ucrInputSpellUpper" Me.ucrInputSpellUpper.Size = New System.Drawing.Size(63, 21) - Me.ucrInputSpellUpper.TabIndex = 57 + Me.ucrInputSpellUpper.TabIndex = 61 ' 'ucrInputSpellLower ' Me.ucrInputSpellLower.AddQuotesIfUnrecognised = True Me.ucrInputSpellLower.IsMultiline = False Me.ucrInputSpellLower.IsReadOnly = False - Me.ucrInputSpellLower.Location = New System.Drawing.Point(95, 74) + Me.ucrInputSpellLower.Location = New System.Drawing.Point(86, 17) Me.ucrInputSpellLower.Name = "ucrInputSpellLower" Me.ucrInputSpellLower.Size = New System.Drawing.Size(63, 21) - Me.ucrInputSpellLower.TabIndex = 56 - ' - 'lblSpellAnd - ' - Me.lblSpellAnd.AutoSize = True - Me.lblSpellAnd.Location = New System.Drawing.Point(156, 76) - Me.lblSpellAnd.Name = "lblSpellAnd" - Me.lblSpellAnd.Size = New System.Drawing.Size(25, 13) - Me.lblSpellAnd.TabIndex = 54 - Me.lblSpellAnd.Tag = "and" - Me.lblSpellAnd.Text = "and" - ' - 'lblValuesBetween - ' - Me.lblValuesBetween.AutoSize = True - Me.lblValuesBetween.Location = New System.Drawing.Point(13, 76) - Me.lblValuesBetween.Name = "lblValuesBetween" - Me.lblValuesBetween.Size = New System.Drawing.Size(84, 13) - Me.lblValuesBetween.TabIndex = 52 - Me.lblValuesBetween.Tag = "Values_Between" - Me.lblValuesBetween.Text = "Values Between" + Me.ucrInputSpellLower.TabIndex = 60 ' - 'lblCountRows + 'ucrChkValuesUnderthreshold ' - Me.lblCountRows.AutoSize = True - Me.lblCountRows.Location = New System.Drawing.Point(140, 42) - Me.lblCountRows.Name = "lblCountRows" - Me.lblCountRows.Size = New System.Drawing.Size(29, 13) - Me.lblCountRows.TabIndex = 51 - Me.lblCountRows.Tag = "rows" - Me.lblCountRows.Text = "rows" + Me.ucrChkValuesUnderthreshold.Checked = False + Me.ucrChkValuesUnderthreshold.Location = New System.Drawing.Point(149, 20) + Me.ucrChkValuesUnderthreshold.Name = "ucrChkValuesUnderthreshold" + Me.ucrChkValuesUnderthreshold.Size = New System.Drawing.Size(100, 20) + Me.ucrChkValuesUnderthreshold.TabIndex = 56 ' 'ucrNudCountOver ' Me.ucrNudCountOver.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudCountOver.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudCountOver.Location = New System.Drawing.Point(84, 42) + Me.ucrNudCountOver.Location = New System.Drawing.Point(62, 20) Me.ucrNudCountOver.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) Me.ucrNudCountOver.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudCountOver.Name = "ucrNudCountOver" Me.ucrNudCountOver.Size = New System.Drawing.Size(50, 20) - Me.ucrNudCountOver.TabIndex = 50 + Me.ucrNudCountOver.TabIndex = 54 Me.ucrNudCountOver.Value = New Decimal(New Integer() {0, 0, 0, 0}) ' - 'lblCountOver + 'ucrInputColName ' - Me.lblCountOver.AutoSize = True - Me.lblCountOver.Location = New System.Drawing.Point(13, 42) - Me.lblCountOver.Name = "lblCountOver" - Me.lblCountOver.Size = New System.Drawing.Size(61, 13) - Me.lblCountOver.TabIndex = 49 - Me.lblCountOver.Tag = "Count_Over" - Me.lblCountOver.Text = "Count Over" + Me.ucrInputColName.AddQuotesIfUnrecognised = True + Me.ucrInputColName.IsMultiline = False + Me.ucrInputColName.IsReadOnly = False + Me.ucrInputColName.Location = New System.Drawing.Point(116, 406) + Me.ucrInputColName.Name = "ucrInputColName" + Me.ucrInputColName.Size = New System.Drawing.Size(137, 21) + Me.ucrInputColName.TabIndex = 49 + ' + 'ucrNudSumOver + ' + Me.ucrNudSumOver.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudSumOver.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudSumOver.Location = New System.Drawing.Point(173, 18) + Me.ucrNudSumOver.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudSumOver.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudSumOver.Name = "ucrNudSumOver" + Me.ucrNudSumOver.Size = New System.Drawing.Size(50, 20) + Me.ucrNudSumOver.TabIndex = 47 + Me.ucrNudSumOver.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrInputSum + ' + Me.ucrInputSum.AddQuotesIfUnrecognised = True + Me.ucrInputSum.IsReadOnly = False + Me.ucrInputSum.Location = New System.Drawing.Point(16, 18) + Me.ucrInputSum.Name = "ucrInputSum" + Me.ucrInputSum.Size = New System.Drawing.Size(106, 21) + Me.ucrInputSum.TabIndex = 0 ' 'ucrNudThreshold ' @@ -456,44 +517,19 @@ Partial Class dlgTransformClimatic ' 'ucrBase ' - Me.ucrBase.Location = New System.Drawing.Point(38, 438) + Me.ucrBase.Location = New System.Drawing.Point(10, 436) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(402, 52) Me.ucrBase.TabIndex = 0 ' - 'ucrInputColName - ' - Me.ucrInputColName.AddQuotesIfUnrecognised = True - Me.ucrInputColName.IsMultiline = False - Me.ucrInputColName.IsReadOnly = False - Me.ucrInputColName.Location = New System.Drawing.Point(144, 412) - Me.ucrInputColName.Name = "ucrInputColName" - Me.ucrInputColName.Size = New System.Drawing.Size(137, 21) - Me.ucrInputColName.TabIndex = 49 - ' - 'lblNewColName - ' - Me.lblNewColName.AutoSize = True - Me.lblNewColName.Location = New System.Drawing.Point(40, 417) - Me.lblNewColName.Name = "lblNewColName" - Me.lblNewColName.Size = New System.Drawing.Size(101, 13) - Me.lblNewColName.TabIndex = 50 - Me.lblNewColName.Tag = "New Column Name:" - Me.lblNewColName.Text = "New Column Name:" - ' - 'ucrChkValuesUnderthreshold - ' - Me.ucrChkValuesUnderthreshold.Checked = False - Me.ucrChkValuesUnderthreshold.Location = New System.Drawing.Point(177, 42) - Me.ucrChkValuesUnderthreshold.Name = "ucrChkValuesUnderthreshold" - Me.ucrChkValuesUnderthreshold.Size = New System.Drawing.Size(100, 20) - Me.ucrChkValuesUnderthreshold.TabIndex = 52 - ' 'dlgTransformClimatic ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(471, 492) + Me.ClientSize = New System.Drawing.Size(579, 492) + Me.Controls.Add(Me.grpWaterbalance) + Me.Controls.Add(Me.grpSpells) + Me.Controls.Add(Me.grpCount) Me.Controls.Add(Me.lblNewColName) Me.Controls.Add(Me.ucrInputColName) Me.Controls.Add(Me.grpTransform) @@ -524,6 +560,12 @@ Partial Class dlgTransformClimatic Me.Text = "Transform" Me.grpTransform.ResumeLayout(False) Me.grpTransform.PerformLayout() + Me.grpCount.ResumeLayout(False) + Me.grpCount.PerformLayout() + Me.grpSpells.ResumeLayout(False) + Me.grpSpells.PerformLayout() + Me.grpWaterbalance.ResumeLayout(False) + Me.grpWaterbalance.PerformLayout() Me.ResumeLayout(False) Me.PerformLayout() @@ -546,9 +588,6 @@ Partial Class dlgTransformClimatic Friend WithEvents rdoSum As RadioButton Friend WithEvents rdoCount As RadioButton Friend WithEvents ucrPnlTransform As UcrPanel - Friend WithEvents lblCountRows As Label - Friend WithEvents ucrNudCountOver As ucrNud - Friend WithEvents lblCountOver As Label Friend WithEvents grpTransform As GroupBox Friend WithEvents lblSumRows As Label Friend WithEvents ucrNudSumOver As ucrNud @@ -556,15 +595,21 @@ Partial Class dlgTransformClimatic Friend WithEvents ucrInputSum As ucrInputComboBox Friend WithEvents ucrNudThreshold As ucrNud Friend WithEvents lblThreshold As Label - Friend WithEvents lblSpellAnd As Label - Friend WithEvents lblValuesBetween As Label - Friend WithEvents ucrNudWBCapacity As ucrNud - Friend WithEvents lblWBCapacity As Label + Friend WithEvents ucrInputColName As ucrInputTextBox + Friend WithEvents lblNewColName As Label + Friend WithEvents grpCount As GroupBox + Friend WithEvents ucrChkValuesUnderthreshold As ucrCheck + Friend WithEvents lblCountRows As Label + Friend WithEvents ucrNudCountOver As ucrNud + Friend WithEvents lblCountOver As Label + Friend WithEvents grpWaterbalance As GroupBox Friend WithEvents ucrInputEvaporation As ucrInputTextBox Friend WithEvents lblWBEvaporation As Label + Friend WithEvents ucrNudWBCapacity As ucrNud + Friend WithEvents lblWBCapacity As Label + Friend WithEvents grpSpells As GroupBox Friend WithEvents ucrInputSpellUpper As ucrInputTextBox Friend WithEvents ucrInputSpellLower As ucrInputTextBox - Friend WithEvents ucrInputColName As ucrInputTextBox - Friend WithEvents lblNewColName As Label - Friend WithEvents ucrChkValuesUnderthreshold As ucrCheck + Friend WithEvents lblSpellAnd As Label + Friend WithEvents lblValuesBetween As Label End Class diff --git a/instat/dlgTransformClimatic.vb b/instat/dlgTransformClimatic.vb index bbfd45db745..a540e8557c9 100644 --- a/instat/dlgTransformClimatic.vb +++ b/instat/dlgTransformClimatic.vb @@ -149,6 +149,14 @@ Public Class dlgTransformClimatic ucrSelectorTransform.Reset() rdoSum.Checked = True 'this wil be fixed properly + 'Temporary disable + rdoCount.Enabled = False + rdoSpell.Enabled = False + rdoWaterBalance.Enabled = False + grpCount.Enabled = False + grpSpells.Enabled = False + grpWaterbalance.Enabled = False + clsRSumFuncExpr.AddParameter("data", ucrReceiverData.GetVariableNames(bWithQuotes:=False)) clsRSumFuncExpr.AddParameter("fill", "NA") clsRSumFuncExpr.AddParameter("width", 1) From 8746a3daae7f2cc028bf90933cf12b6b39d133eb Mon Sep 17 00:00:00 2001 From: maxwell fundi Date: Tue, 9 May 2017 20:30:15 +0300 Subject: [PATCH 39/52] Finalised barchart --- instat/dlgBarAndPieChart.Designer.vb | 227 ++++++++++++----------- instat/dlgBarAndPieChart.vb | 267 +++++++++++++-------------- 2 files changed, 251 insertions(+), 243 deletions(-) diff --git a/instat/dlgBarAndPieChart.Designer.vb b/instat/dlgBarAndPieChart.Designer.vb index 2231b12d32a..7175941228e 100644 --- a/instat/dlgBarAndPieChart.Designer.vb +++ b/instat/dlgBarAndPieChart.Designer.vb @@ -1,42 +1,41 @@ - _ -Partial Class dlgBarAndPieChart - Inherits System.Windows.Forms.Form - - 'Form overrides dispose to clean up the component list. - _ - Protected Overrides Sub Dispose(ByVal disposing As Boolean) - Try - If disposing AndAlso components IsNot Nothing Then - components.Dispose() - End If - Finally - MyBase.Dispose(disposing) - End Try - End Sub - - 'Required by the Windows Form Designer - Private components As System.ComponentModel.IContainer - - 'NOTE: The following procedure is required by the Windows Form Designer - 'It can be modified using the Windows Form Designer. - 'Do not modify it using the code editor. - _ - Private Sub InitializeComponent() + +Partial Class dlgBarAndPieChart + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. + + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + + Private Sub InitializeComponent() Me.lblFactor = New System.Windows.Forms.Label() Me.lblSecondFactor = New System.Windows.Forms.Label() Me.cmdBarChartOptions = New System.Windows.Forms.Button() Me.cmdOptions = New System.Windows.Forms.Button() Me.cmdPieChartOptions = New System.Windows.Forms.Button() + Me.rdoPieChart = New System.Windows.Forms.RadioButton() + Me.rdoBarChart = New System.Windows.Forms.RadioButton() + Me.ucrSaveBar = New instat.ucrSave() + Me.ucrChkFlipCoordinates = New instat.ucrCheck() Me.ucrSecondReceiver = New instat.ucrReceiverSingle() Me.ucrFactorReceiver = New instat.ucrReceiverSingle() Me.ucrBarChartSelector = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() - Me.ucrSaveBar = New instat.ucrSaveGraph() - Me.rdoPieChart = New System.Windows.Forms.RadioButton() - Me.rdoBarChart = New System.Windows.Forms.RadioButton() - Me.grpSelection = New System.Windows.Forms.GroupBox() - Me.chkFlipCoordinates = New System.Windows.Forms.CheckBox() - Me.grpSelection.SuspendLayout() + Me.ucrPnlOptions = New instat.UcrPanel() Me.SuspendLayout() ' 'lblFactor @@ -45,7 +44,7 @@ Partial Class dlgBarAndPieChart Me.lblFactor.Location = New System.Drawing.Point(255, 69) Me.lblFactor.Name = "lblFactor" Me.lblFactor.Size = New System.Drawing.Size(40, 13) - Me.lblFactor.TabIndex = 2 + Me.lblFactor.TabIndex = 4 Me.lblFactor.Tag = "Factor:" Me.lblFactor.Text = "Factor:" ' @@ -55,7 +54,7 @@ Partial Class dlgBarAndPieChart Me.lblSecondFactor.Location = New System.Drawing.Point(254, 120) Me.lblSecondFactor.Name = "lblSecondFactor" Me.lblSecondFactor.Size = New System.Drawing.Size(128, 13) - Me.lblSecondFactor.TabIndex = 4 + Me.lblSecondFactor.TabIndex = 6 Me.lblSecondFactor.Tag = "Second_Factor:" Me.lblSecondFactor.Text = "Second Factor (Optional):" ' @@ -64,7 +63,7 @@ Partial Class dlgBarAndPieChart Me.cmdBarChartOptions.Location = New System.Drawing.Point(11, 230) Me.cmdBarChartOptions.Name = "cmdBarChartOptions" Me.cmdBarChartOptions.Size = New System.Drawing.Size(120, 25) - Me.cmdBarChartOptions.TabIndex = 6 + Me.cmdBarChartOptions.TabIndex = 9 Me.cmdBarChartOptions.Tag = "Bar_Chart_Options" Me.cmdBarChartOptions.Text = "Bar Chart Options" Me.cmdBarChartOptions.UseVisualStyleBackColor = True @@ -74,7 +73,7 @@ Partial Class dlgBarAndPieChart Me.cmdOptions.Location = New System.Drawing.Point(10, 262) Me.cmdOptions.Name = "cmdOptions" Me.cmdOptions.Size = New System.Drawing.Size(120, 25) - Me.cmdOptions.TabIndex = 7 + Me.cmdOptions.TabIndex = 10 Me.cmdOptions.Tag = "Plot_Options..." Me.cmdOptions.Text = "Plot Options..." Me.cmdOptions.UseVisualStyleBackColor = True @@ -89,23 +88,78 @@ Partial Class dlgBarAndPieChart Me.cmdPieChartOptions.Text = "Pie Chart Options" Me.cmdPieChartOptions.UseVisualStyleBackColor = True ' + 'rdoPieChart + ' + Me.rdoPieChart.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoPieChart.BackColor = System.Drawing.SystemColors.Control + Me.rdoPieChart.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoPieChart.FlatAppearance.BorderSize = 2 + Me.rdoPieChart.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoPieChart.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoPieChart.Location = New System.Drawing.Point(176, 12) + Me.rdoPieChart.Name = "rdoPieChart" + Me.rdoPieChart.Size = New System.Drawing.Size(100, 28) + Me.rdoPieChart.TabIndex = 2 + Me.rdoPieChart.TabStop = True + Me.rdoPieChart.Tag = "Pie_Chart" + Me.rdoPieChart.Text = "Pie Chart" + Me.rdoPieChart.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoPieChart.UseVisualStyleBackColor = False + ' + 'rdoBarChart + ' + Me.rdoBarChart.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoBarChart.BackColor = System.Drawing.SystemColors.Control + Me.rdoBarChart.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoBarChart.FlatAppearance.BorderSize = 2 + Me.rdoBarChart.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoBarChart.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoBarChart.Location = New System.Drawing.Point(78, 12) + Me.rdoBarChart.Name = "rdoBarChart" + Me.rdoBarChart.Size = New System.Drawing.Size(100, 28) + Me.rdoBarChart.TabIndex = 1 + Me.rdoBarChart.TabStop = True + Me.rdoBarChart.Tag = "Bar_Chart" + Me.rdoBarChart.Text = "Bar Chart" + Me.rdoBarChart.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoBarChart.UseVisualStyleBackColor = False + ' + 'ucrSaveBar + ' + Me.ucrSaveBar.Location = New System.Drawing.Point(10, 306) + Me.ucrSaveBar.Name = "ucrSaveBar" + Me.ucrSaveBar.Size = New System.Drawing.Size(313, 24) + Me.ucrSaveBar.TabIndex = 11 + ' + 'ucrChkFlipCoordinates + ' + Me.ucrChkFlipCoordinates.Checked = False + Me.ucrChkFlipCoordinates.Location = New System.Drawing.Point(255, 168) + Me.ucrChkFlipCoordinates.Name = "ucrChkFlipCoordinates" + Me.ucrChkFlipCoordinates.Size = New System.Drawing.Size(166, 20) + Me.ucrChkFlipCoordinates.TabIndex = 8 + ' 'ucrSecondReceiver ' + Me.ucrSecondReceiver.frmParent = Me Me.ucrSecondReceiver.Location = New System.Drawing.Point(255, 135) Me.ucrSecondReceiver.Margin = New System.Windows.Forms.Padding(0) Me.ucrSecondReceiver.Name = "ucrSecondReceiver" Me.ucrSecondReceiver.Selector = Nothing Me.ucrSecondReceiver.Size = New System.Drawing.Size(120, 20) - Me.ucrSecondReceiver.TabIndex = 5 + Me.ucrSecondReceiver.TabIndex = 7 + Me.ucrSecondReceiver.ucrSelector = Nothing ' 'ucrFactorReceiver ' + Me.ucrFactorReceiver.frmParent = Me Me.ucrFactorReceiver.Location = New System.Drawing.Point(255, 85) Me.ucrFactorReceiver.Margin = New System.Windows.Forms.Padding(0) Me.ucrFactorReceiver.Name = "ucrFactorReceiver" Me.ucrFactorReceiver.Selector = Nothing Me.ucrFactorReceiver.Size = New System.Drawing.Size(120, 20) - Me.ucrFactorReceiver.TabIndex = 3 + Me.ucrFactorReceiver.TabIndex = 5 + Me.ucrFactorReceiver.ucrSelector = Nothing ' 'ucrBarChartSelector ' @@ -115,75 +169,31 @@ Partial Class dlgBarAndPieChart Me.ucrBarChartSelector.Margin = New System.Windows.Forms.Padding(0) Me.ucrBarChartSelector.Name = "ucrBarChartSelector" Me.ucrBarChartSelector.Size = New System.Drawing.Size(210, 180) - Me.ucrBarChartSelector.TabIndex = 1 + Me.ucrBarChartSelector.TabIndex = 3 ' 'ucrBase ' - Me.ucrBase.Location = New System.Drawing.Point(10, 322) + Me.ucrBase.Location = New System.Drawing.Point(12, 336) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(410, 52) - Me.ucrBase.TabIndex = 9 - ' - 'ucrSaveBar + Me.ucrBase.TabIndex = 12 ' - Me.ucrSaveBar.Location = New System.Drawing.Point(10, 295) - Me.ucrSaveBar.Name = "ucrSaveBar" - Me.ucrSaveBar.Size = New System.Drawing.Size(265, 20) - Me.ucrSaveBar.TabIndex = 8 - ' - 'rdoPieChart + 'ucrPnlOptions ' - Me.rdoPieChart.AutoSize = True - Me.rdoPieChart.Location = New System.Drawing.Point(280, 10) - Me.rdoPieChart.Name = "rdoPieChart" - Me.rdoPieChart.Size = New System.Drawing.Size(68, 17) - Me.rdoPieChart.TabIndex = 1 - Me.rdoPieChart.TabStop = True - Me.rdoPieChart.Tag = "Pie_Chart" - Me.rdoPieChart.Text = "Pie Chart" - Me.rdoPieChart.UseVisualStyleBackColor = True - ' - 'rdoBarChart - ' - Me.rdoBarChart.AutoSize = True - Me.rdoBarChart.Location = New System.Drawing.Point(10, 10) - Me.rdoBarChart.Name = "rdoBarChart" - Me.rdoBarChart.Size = New System.Drawing.Size(69, 17) - Me.rdoBarChart.TabIndex = 0 - Me.rdoBarChart.TabStop = True - Me.rdoBarChart.Tag = "Bar_Chart" - Me.rdoBarChart.Text = "Bar Chart" - Me.rdoBarChart.UseVisualStyleBackColor = True - ' - 'grpSelection - ' - Me.grpSelection.Controls.Add(Me.rdoBarChart) - Me.grpSelection.Controls.Add(Me.rdoPieChart) - Me.grpSelection.Location = New System.Drawing.Point(10, 4) - Me.grpSelection.Name = "grpSelection" - Me.grpSelection.Size = New System.Drawing.Size(397, 31) - Me.grpSelection.TabIndex = 0 - Me.grpSelection.TabStop = False - ' - 'chkFlipCoordinates - ' - Me.chkFlipCoordinates.AutoSize = True - Me.chkFlipCoordinates.Location = New System.Drawing.Point(258, 249) - Me.chkFlipCoordinates.Name = "chkFlipCoordinates" - Me.chkFlipCoordinates.Size = New System.Drawing.Size(100, 17) - Me.chkFlipCoordinates.TabIndex = 10 - Me.chkFlipCoordinates.Tag = "Horizontal_Boxplot" - Me.chkFlipCoordinates.Text = "Flip coordinates" - Me.chkFlipCoordinates.UseVisualStyleBackColor = True + Me.ucrPnlOptions.Location = New System.Drawing.Point(65, 6) + Me.ucrPnlOptions.Name = "ucrPnlOptions" + Me.ucrPnlOptions.Size = New System.Drawing.Size(211, 36) + Me.ucrPnlOptions.TabIndex = 0 ' 'dlgBarAndPieChart ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(421, 379) - Me.Controls.Add(Me.chkFlipCoordinates) + Me.ClientSize = New System.Drawing.Size(433, 400) Me.Controls.Add(Me.ucrSaveBar) - Me.Controls.Add(Me.grpSelection) + Me.Controls.Add(Me.ucrChkFlipCoordinates) + Me.Controls.Add(Me.rdoBarChart) + Me.Controls.Add(Me.rdoPieChart) Me.Controls.Add(Me.cmdOptions) Me.Controls.Add(Me.lblSecondFactor) Me.Controls.Add(Me.lblFactor) @@ -193,6 +203,7 @@ Partial Class dlgBarAndPieChart Me.Controls.Add(Me.ucrBase) Me.Controls.Add(Me.cmdBarChartOptions) Me.Controls.Add(Me.cmdPieChartOptions) + Me.Controls.Add(Me.ucrPnlOptions) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False Me.MinimizeBox = False @@ -200,25 +211,23 @@ Partial Class dlgBarAndPieChart Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Tag = "Bar_And_Pie_Chart" Me.Text = "Bar and Pie Chart" - Me.grpSelection.ResumeLayout(False) - Me.grpSelection.PerformLayout() Me.ResumeLayout(False) Me.PerformLayout() - End Sub - - Friend WithEvents ucrBase As ucrButtons - Friend WithEvents ucrBarChartSelector As ucrSelectorByDataFrameAddRemove - Friend WithEvents ucrFactorReceiver As ucrReceiverSingle - Friend WithEvents ucrSecondReceiver As ucrReceiverSingle - Friend WithEvents lblFactor As Label - Friend WithEvents lblSecondFactor As Label - Friend WithEvents cmdBarChartOptions As Button - Friend WithEvents cmdOptions As Button + End Sub + + Friend WithEvents ucrBase As ucrButtons + Friend WithEvents ucrBarChartSelector As ucrSelectorByDataFrameAddRemove + Friend WithEvents ucrFactorReceiver As ucrReceiverSingle + Friend WithEvents ucrSecondReceiver As ucrReceiverSingle + Friend WithEvents lblFactor As Label + Friend WithEvents lblSecondFactor As Label + Friend WithEvents cmdBarChartOptions As Button + Friend WithEvents cmdOptions As Button Friend WithEvents cmdPieChartOptions As Button - Friend WithEvents ucrSaveBar As ucrSaveGraph - Friend WithEvents rdoPieChart As RadioButton + Friend WithEvents ucrSaveBar As ucrSave + Friend WithEvents ucrChkFlipCoordinates As ucrCheck Friend WithEvents rdoBarChart As RadioButton - Friend WithEvents grpSelection As GroupBox - Friend WithEvents chkFlipCoordinates As CheckBox -End Class + Friend WithEvents rdoPieChart As RadioButton + Friend WithEvents ucrPnlOptions As UcrPanel +End Class \ No newline at end of file diff --git a/instat/dlgBarAndPieChart.vb b/instat/dlgBarAndPieChart.vb index fc961cc6b05..7d59b99d29a 100644 --- a/instat/dlgBarAndPieChart.vb +++ b/instat/dlgBarAndPieChart.vb @@ -16,169 +16,192 @@ Imports instat.Translations Public Class dlgBarAndPieChart Private clsRggplotFunction As New RFunction - Private clsRgeom_barchart As New RFunction - Private clsRaesFunction As New RFunction - Private clsTempRFunc As New RFunction + Private clsRgeomBarFunction As New RFunction + Private clsBarAesFunction As New RFunction + Private clsPieAesFunction As New RFunction + + Private clsBaseOperator As New ROperator + Private clsRCoordPolarParam As New RParameter + Private bReset As Boolean = True Private bFirstLoad As Boolean = True - Private Sub dlgBarAndPieChart_Load(sender As Object, e As EventArgs) Handles MyBase.Load + Private Sub cmdOptions_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then InitialiseDialog() - SetDefaults() bFirstLoad = False - Else - ReopenDialog() End If - + If bReset Then + SetDefaults() + End If + SetRCodeForControls(bReset) + bReset = False autoTranslate(Me) + TestOkEnabled() End Sub + Private Sub SetRCodeForControls(bReset As Boolean) + ucrFactorReceiver.SetRCode(clsBarAesFunction, bReset) + ucrFactorReceiver.AddAdditionalCodeParameterPair(clsPieAesFunction, New RParameter("fill", 0), iAdditionalPairNo:=1) - Private Sub SetDefaults() - 'Set main dialog defaults... - clsRgeom_barchart.ClearParameters() - clsRaesFunction.ClearParameters() - rdoBarChart.Checked = True - ucrBarChartSelector.Reset() - ucrBarChartSelector.Focus() - ucrFactorReceiver.SetMeAsReceiver() - ucrSaveBar.Reset() - sdgPlots.Reset() - chkFlipCoordinates.Checked = False + ucrSecondReceiver.SetRCode(clsBarAesFunction, bReset) + + ucrSaveBar.SetRCode(clsBaseOperator, bReset) + ucrBarChartSelector.SetRCode(clsRggplotFunction, bReset) + ucrPnlOptions.SetRCode(clsBaseOperator, bReset) + ucrChkFlipCoordinates.SetRCode(clsBaseOperator, bReset) + End Sub + + Private Sub TestOkEnabled() + If ucrFactorReceiver.IsEmpty OrElse Not ucrSaveBar.IsComplete Then + ucrBase.OKEnabled(False) + Else + ucrBase.OKEnabled(True) + End If + End Sub + + Private Sub AllControls_ContenctsChanged() Handles ucrFactorReceiver.ControlContentsChanged, ucrSaveBar.ControlContentsChanged + TestOkEnabled() End Sub Private Sub InitialiseDialog() - ucrBase.clsRsyntax.SetOperation("+") - clsRggplotFunction.SetRCommand("ggplot") - clsRaesFunction.SetRCommand("aes") - clsRggplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRaesFunction) - ucrBase.clsRsyntax.SetOperatorParameter(True, clsRFunc:=clsRggplotFunction) - clsRgeom_barchart.SetRCommand("geom_bar") - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRgeom_barchart) + Dim clsCoordFlipFunc As New RFunction + Dim clsCoordFlipParam As New RParameter + Dim clsRCoordPolarFunction As New RFunction + + ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False + ucrBase.clsRsyntax.iCallType = 3 + ucrBase.iHelpTopicID = 439 + + ucrPnlOptions.AddRadioButton(rdoBarChart) + ucrPnlOptions.AddRadioButton(rdoPieChart) + ucrPnlOptions.AddParameterPresentCondition(rdoPieChart, "coord_polar") + ucrPnlOptions.AddParameterPresentCondition(rdoBarChart, "coord_polar", False) + + ucrPnlOptions.AddToLinkedControls(ucrChkFlipCoordinates, {rdoBarChart}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrPnlOptions.AddToLinkedControls(ucrSecondReceiver, {rdoBarChart}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrSecondReceiver.SetLinkedDisplayControl(lblSecondFactor) + + ucrBarChartSelector.SetParameter(New RParameter("data", 0)) + ucrBarChartSelector.SetParameterIsrfunction() + ucrFactorReceiver.Selector = ucrBarChartSelector ucrFactorReceiver.SetIncludedDataTypes({"factor"}) + ucrFactorReceiver.SetParameter(New RParameter("x", 0)) + ucrFactorReceiver.bWithQuotes = False + ucrFactorReceiver.SetParameterIsString() ucrSecondReceiver.Selector = ucrBarChartSelector ucrSecondReceiver.SetIncludedDataTypes({"factor"}) + ucrSecondReceiver.SetParameter(New RParameter("fill", 1)) + ucrSecondReceiver.bWithQuotes = False + ucrSecondReceiver.SetParameterIsString() sdgPlots.SetRSyntax(ucrBase.clsRsyntax) - ucrBase.clsRsyntax.iCallType = 0 - ucrBase.iHelpTopicID = 438 + ucrSaveBar.SetIsComboBox() + ucrSaveBar.SetCheckBoxText("Save Graph") + ucrSaveBar.SetDataFrameSelector(ucrBarChartSelector.ucrAvailableDataFrames) + ucrSaveBar.SetSaveTypeAsGraph() + ucrSaveBar.SetPrefix("Bar") + ucrSaveBar.SetAssignToIfUncheckedValue("last_graph") + clsRCoordPolarFunction.SetPackageName("ggplot2") + clsRCoordPolarFunction.SetRCommand("coord_polar") + clsRCoordPolarFunction.AddParameter("theta", Chr(34) & "y" & Chr(34)) + clsRCoordPolarParam.SetArgumentName("coord_polar") + clsRCoordPolarParam.SetArgument(clsRCoordPolarFunction) - ucrSaveBar.SetDataFrameSelector(ucrBarChartSelector.ucrAvailableDataFrames) - ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False - ucrSaveBar.strPrefix = "Bar" - ucrBase.clsRsyntax.iCallType = 3 + clsCoordFlipFunc.SetPackageName("ggplot2") + clsCoordFlipFunc.SetRCommand("coord_flip") + clsCoordFlipParam.SetArgumentName("coord_flip") + clsCoordFlipParam.SetArgument(clsCoordFlipFunc) + ucrChkFlipCoordinates.SetText("Flip Coordinates") + ucrChkFlipCoordinates.SetParameter(clsCoordFlipParam, bNewChangeParameterValue:=False, bNewAddRemoveParameter:=True) End Sub - Private Sub ReopenDialog() - End Sub + Private Sub SetDefaults() + clsBaseOperator = New ROperator + clsRggplotFunction = New RFunction + clsRgeomBarFunction = New RFunction + clsBarAesFunction = New RFunction + clsPieAesFunction = New RFunction - Public Sub TestOKEnabled() - If ucrFactorReceiver.IsEmpty OrElse (ucrSaveBar.chkSaveGraph.Checked AndAlso ucrSaveBar.ucrInputGraphName.IsEmpty) Then - ucrBase.OKEnabled(False) - Else - ucrBase.OKEnabled(True) - End If - End Sub + ucrBarChartSelector.Reset() + ucrFactorReceiver.SetMeAsReceiver() + ucrSaveBar.Reset() - Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset - SetDefaults() - TestOKEnabled() - End Sub + clsBaseOperator.SetOperation("+") + clsBaseOperator.AddParameter("ggplot", clsRFunctionParameter:=clsRggplotFunction, iPosition:=0) + clsBaseOperator.AddParameter("geomfunc", clsRFunctionParameter:=clsRgeomBarFunction) - Private Sub ucrBarChartSelector_DataFrameChanged() Handles ucrBarChartSelector.DataFrameChanged - clsRggplotFunction.AddParameter("data", clsRFunctionParameter:=ucrBarChartSelector.ucrAvailableDataFrames.clsCurrDataFrame) - End Sub + clsRggplotFunction.SetPackageName("ggplot2") + clsRggplotFunction.SetRCommand("ggplot") + clsRggplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsBarAesFunction, iPosition:=1) - Private Sub ucrFactorReceiver_SelectionChanged() Handles ucrFactorReceiver.SelectionChanged - SetFactorReceiverParameter() - End Sub + clsBarAesFunction.SetPackageName("ggplot2") + clsBarAesFunction.SetRCommand("aes") - Private Sub SetFactorReceiverParameter() - If rdoBarChart.Checked = True Then - If Not ucrFactorReceiver.IsEmpty Then - clsRaesFunction.AddParameter("x", ucrFactorReceiver.GetVariableNames(False)) - Else - clsRaesFunction.RemoveParameterByName("x") - End If - Else - If Not ucrFactorReceiver.IsEmpty Then - clsRaesFunction.AddParameter("fill", ucrFactorReceiver.GetVariableNames(False)) - Else - clsRaesFunction.RemoveParameterByName("fill") - End If - End If - TestOKEnabled() - End Sub + clsPieAesFunction.SetPackageName("ggplot2") + clsPieAesFunction.SetRCommand("aes") + clsPieAesFunction.AddParameter("x", Chr(34) & Chr(34)) + clsRgeomBarFunction.SetPackageName("ggplot2") + clsRgeomBarFunction.SetRCommand("geom_bar") - Private Sub ucrSecondReceiver_SelectionChanged() Handles ucrSecondReceiver.SelectionChanged - SetSecondFactorReceiverParameter() + clsBaseOperator.SetAssignTo("last_graph", strTempDataframe:=ucrBarChartSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph") + ucrBase.clsRsyntax.SetBaseROperator(clsBaseOperator) End Sub - Private Sub SetSecondFactorReceiverParameter() - If rdoBarChart.Checked AndAlso Not ucrSecondReceiver.IsEmpty Then - clsRaesFunction.AddParameter("fill", ucrSecondReceiver.GetVariableNames(False)) - Else - clsRaesFunction.RemoveParameterByName("fill") - End If - TestOKEnabled() + Private Sub ucrPnlOptions_ControlValueChanged() Handles ucrPnlOptions.ControlValueChanged + SetDailogOptions() End Sub - Private Sub grpSelection_CheckedChanged(sender As Object, e As EventArgs) Handles rdoBarChart.CheckedChanged, rdoPieChart.CheckedChanged - If rdoBarChart.Checked = True Then - ucrSaveBar.strPrefix = "Bar" - clsRgeom_barchart.RemoveParameterByName("width") - ucrBase.clsRsyntax.RemoveOperatorParameter("polar") - cmdBarChartOptions.Visible = True + Private Sub SetDailogOptions() + If rdoBarChart.Checked Then + clsRggplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsBarAesFunction, iPosition:=1) + ucrSaveBar.SetPrefix("Bar") cmdPieChartOptions.Visible = False - ucrSecondReceiver.Visible = True - lblSecondFactor.Visible = True - chkFlipCoordinates.Visible = True - SetCoordFlip() - ElseIf rdoPieChart.Checked = True Then - ucrSaveBar.strPrefix = "Pie" - clsRaesFunction.AddParameter("x", Chr(34) & Chr(34)) - clsRgeom_barchart.AddParameter("width", "1") - clsTempRFunc.SetRCommand("coord_polar") - clsTempRFunc.AddParameter("theta", Chr(34) & "y" & Chr(34)) - ucrBase.clsRsyntax.AddOperatorParameter("polar", clsRFunc:=clsTempRFunc) - cmdBarChartOptions.Visible = False + cmdBarChartOptions.Visible = True + clsRgeomBarFunction.RemoveParameterByName("width") + clsBaseOperator.RemoveParameter(clsRCoordPolarParam) + ElseIf rdoPieChart.Checked Then + clsRggplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsPieAesFunction, iPosition:=1) + ucrSaveBar.SetPrefix("Pie") + clsRgeomBarFunction.AddParameter("width", "1") + clsBaseOperator.AddParameter(clsRCoordPolarParam) cmdPieChartOptions.Visible = True - ucrSecondReceiver.Visible = False - lblSecondFactor.Visible = False - chkFlipCoordinates.Visible = False - ucrBase.clsRsyntax.RemoveOperatorParameter("coord_flip") + cmdBarChartOptions.Visible = False End If - SetSecondFactorReceiverParameter() 'Warning: need to set second factor first, as in the pie chart case, it erases "fill" parameter (in clsRaesFunction), which is the parameter that takes the value in the first factor receiver. - SetFactorReceiverParameter() - TestOKEnabled() + End Sub + + Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset + SetDefaults() + SetRCodeForControls(True) + TestOkEnabled() + sdgPlots.Reset() End Sub Private Sub cmdOptions_Click(sender As Object, e As EventArgs) Handles cmdOptions.Click sdgPlots.SetDataFrame(strNewDataFrame:=ucrBarChartSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text) sdgPlots.ShowDialog() - 'Warning, when coordinate flip is added to coordinates tab on sdgPLots, then link with chkFlipCoordinates... + 'Warning, when coordinate flip is added to coordinates tab on sdgPLots, then link with ucrChkFlipCoordinates... End Sub Private Sub cmdBarChartOptions_Click(sender As Object, e As EventArgs) Handles cmdBarChartOptions.Click - sdgLayerOptions.SetupLayer(clsTempGgPlot:=clsRggplotFunction, clsTempGeomFunc:=clsRgeom_barchart, clsTempAesFunc:=clsRaesFunction, bFixAes:=True, bFixGeom:=True, strDataframe:=ucrBarChartSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, bApplyAesGlobally:=True, bIgnoreGlobalAes:=False) + sdgLayerOptions.SetupLayer(clsTempGgPlot:=clsRggplotFunction, clsTempGeomFunc:=clsRgeomBarFunction, clsTempAesFunc:=clsBarAesFunction, bFixAes:=True, bFixGeom:=True, strDataframe:=ucrBarChartSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, bApplyAesGlobally:=True, bIgnoreGlobalAes:=False) sdgLayerOptions.ShowDialog() - For Each clsParam In clsRaesFunction.clsParameters + For Each clsParam In clsBarAesFunction.clsParameters If clsParam.strArgumentName = "x" Then ucrFactorReceiver.Add(clsParam.strArgumentValue) ElseIf clsParam.strArgumentName = "fill" Then ucrSecondReceiver.Add(clsParam.strArgumentValue) End If Next - TestOKEnabled() + TestOkEnabled() End Sub Private Sub cmdPieChartOptions_Click(sender As Object, e As EventArgs) Handles cmdPieChartOptions.Click - sdgLayerOptions.SetupLayer(clsTempGgPlot:=clsRggplotFunction, clsTempGeomFunc:=clsRgeom_barchart, clsTempAesFunc:=clsRaesFunction, bFixAes:=True, bFixGeom:=True, strDataframe:=ucrBarChartSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, bApplyAesGlobally:=True) + sdgLayerOptions.SetupLayer(clsTempGgPlot:=clsRggplotFunction, clsTempGeomFunc:=clsRgeomBarFunction, clsTempAesFunc:=clsPieAesFunction, bFixAes:=True, bFixGeom:=True, strDataframe:=ucrBarChartSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, bApplyAesGlobally:=True) sdgLayerOptions.ShowDialog() - For Each clsParam In clsRaesFunction.clsParameters + For Each clsParam In clsPieAesFunction.clsParameters If clsParam.strArgumentName = "x" Then If clsParam.strArgumentValue = Chr(34) & Chr(34) Then ucrFactorReceiver.Clear() @@ -189,33 +212,9 @@ Public Class dlgBarAndPieChart ucrSecondReceiver.Add(clsParam.strArgumentValue) End If Next - TestOKEnabled() + TestOkEnabled() End Sub - - Private Sub ucrSaveBar_GraphNameChanged() Handles ucrSaveBar.GraphNameChanged, ucrSaveBar.SaveGraphCheckedChanged - If ucrSaveBar.bSaveGraph Then - ucrBase.clsRsyntax.SetAssignTo(ucrSaveBar.strGraphName, strTempDataframe:=ucrBarChartSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:=ucrSaveBar.strGraphName) - Else - ucrBase.clsRsyntax.SetAssignTo("last_graph", strTempDataframe:=ucrBarChartSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph") - End If - TestOKEnabled() - End Sub - - Private Sub ucrSaveBar_ContentsChanged() Handles ucrSaveBar.ContentsChanged - TestOKEnabled() - End Sub - - Public Sub SetCoordFlip() - Dim clsTempRFunc As New RFunction - If chkFlipCoordinates.Checked Then - clsTempRFunc.SetRCommand("coord_flip") - ucrBase.clsRsyntax.AddOperatorParameter("coord_flip", clsRFunc:=clsTempRFunc) - Else - ucrBase.clsRsyntax.RemoveOperatorParameter("coord_flip") - End If - End Sub - - Private Sub chkFlipCoordinates_CheckedChanged(sender As Object, e As EventArgs) Handles chkFlipCoordinates.CheckedChanged - SetCoordFlip() + Private Sub AllControlsChanged() Handles ucrSaveBar.ControlContentsChanged, ucrFactorReceiver.ControlContentsChanged + TestOkEnabled() End Sub End Class \ No newline at end of file From 431ac036dd4bb4706e197e78af4181fef32d1ecd Mon Sep 17 00:00:00 2001 From: Alex Sananka Date: Wed, 10 May 2017 10:10:10 +0300 Subject: [PATCH 40/52] creating new dialog and minor designer changes --- instat/dlgFlatFrequencyTable.Designer.vb | 52 ++++++++++ instat/dlgFlatFrequencyTable.resx | 120 +++++++++++++++++++++++ instat/dlgFlatFrequencyTable.vb | 51 ++++++++++ instat/instat.vbproj | 9 ++ 4 files changed, 232 insertions(+) create mode 100644 instat/dlgFlatFrequencyTable.Designer.vb create mode 100644 instat/dlgFlatFrequencyTable.resx create mode 100644 instat/dlgFlatFrequencyTable.vb diff --git a/instat/dlgFlatFrequencyTable.Designer.vb b/instat/dlgFlatFrequencyTable.Designer.vb new file mode 100644 index 00000000000..99257ce1f9a --- /dev/null +++ b/instat/dlgFlatFrequencyTable.Designer.vb @@ -0,0 +1,52 @@ + _ +Partial Class dlgFlatFrequencyTable + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + _ + Private Sub InitializeComponent() + Me.ucrBase = New instat.ucrButtons() + Me.SuspendLayout() + ' + 'ucrBase + ' + Me.ucrBase.Location = New System.Drawing.Point(5, 264) + Me.ucrBase.Name = "ucrBase" + Me.ucrBase.Size = New System.Drawing.Size(403, 52) + Me.ucrBase.TabIndex = 0 + ' + 'dlgFlatFrequencyTable + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(414, 328) + Me.Controls.Add(Me.ucrBase) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow + Me.MaximizeBox = False + Me.MinimizeBox = False + Me.Name = "dlgFlatFrequencyTable" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "Flat Frequency Table" + Me.ResumeLayout(False) + + End Sub + + Friend WithEvents ucrBase As ucrButtons +End Class diff --git a/instat/dlgFlatFrequencyTable.resx b/instat/dlgFlatFrequencyTable.resx new file mode 100644 index 00000000000..29dcb1b3a35 --- /dev/null +++ b/instat/dlgFlatFrequencyTable.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/instat/dlgFlatFrequencyTable.vb b/instat/dlgFlatFrequencyTable.vb new file mode 100644 index 00000000000..cff34eddf43 --- /dev/null +++ b/instat/dlgFlatFrequencyTable.vb @@ -0,0 +1,51 @@ +' Instat-R +' Copyright (C) 2015 +' +' This program is free software: you can redistribute it and/or modify +' it under the terms of the GNU General Public License as published by +' the Free Software Foundation, either version 3 of the License, or +' (at your option) any later version. +' +' This program is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU General Public License for more details. +' +' You should have received a copy of the GNU General Public License k +' along with this program. If not, see . + +Imports instat.Translations +Public Class dlgFlatFrequencyTable + Private bFirstLoad As Boolean = True + Private bReset As Boolean = True + Private Sub dlgFlatFrequencyTable_Load(sender As Object, e As EventArgs) Handles MyBase.Load + autoTranslate(Me) + If bFirstLoad Then + InitialiseDialog() + bFirstLoad = False + End If + If bReset Then + SetDefaults() + End If + SetRCodeForControls(bReset) + bReset = False + TestOkEnabled() + End Sub + + Private Sub InitialiseDialog() + + End Sub + + Private Sub SetDefaults() + + End Sub + + Private Sub SetRCodeForControls(bReset As Boolean) + + End Sub + + Private Sub TestOkEnabled() + + End Sub + +End Class \ No newline at end of file diff --git a/instat/instat.vbproj b/instat/instat.vbproj index d44c91886c9..f9ef1a0bccd 100644 --- a/instat/instat.vbproj +++ b/instat/instat.vbproj @@ -335,6 +335,12 @@ Form + + dlgFlatFrequencyTable.vb + + + Form + dlgFrequency.vb @@ -2500,6 +2506,9 @@ dlgFitModel.vb + + dlgFlatFrequencyTable.vb + dlgFourVariableModelling.vb From 3dfc6fb92b3ce13fa07a9b18ad25d063dc3d7eee Mon Sep 17 00:00:00 2001 From: Alex Sananka Date: Wed, 10 May 2017 10:12:48 +0300 Subject: [PATCH 41/52] adding dialog to frmmain --- instat/frmMain.Designer.vb | 24 ++++++++++++++++-------- instat/frmMain.vb | 4 ++++ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/instat/frmMain.Designer.vb b/instat/frmMain.Designer.vb index 39b1e960a3d..2df76025a1d 100644 --- a/instat/frmMain.Designer.vb +++ b/instat/frmMain.Designer.vb @@ -317,9 +317,9 @@ Partial Class frmMain Me.tlSeparatorFile = New System.Windows.Forms.ToolStripSeparator() Me.mnuExport = New System.Windows.Forms.ToolStripMenuItem() Me.ExportDataSetToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() - Me.ExportRWorkspaceToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.ExportGraphAsImageToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.ExportRObjectsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() + Me.ExportRWorkspaceToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.mnuFileCloseData = New System.Windows.Forms.ToolStripMenuItem() Me.ToolStripSeparator8 = New System.Windows.Forms.ToolStripSeparator() Me.mnuPrepare = New System.Windows.Forms.ToolStripMenuItem() @@ -468,6 +468,7 @@ Partial Class frmMain Me.splDataOutput = New System.Windows.Forms.SplitContainer() Me.ucrDataViewer = New instat.ucrDataView() Me.ucrOutput = New instat.ucrOutputWindow() + Me.FrequencyTablesToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.stsStrip.SuspendLayout() Me.Tool_strip.SuspendLayout() Me.mnuBar.SuspendLayout() @@ -704,7 +705,7 @@ Partial Class frmMain ' 'mnuDescribeGeneral ' - Me.mnuDescribeGeneral.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuDescribeGeneralColumnSummaries, Me.DescribeGeneralTabulation, Me.DescribeGeneralGraphics}) + Me.mnuDescribeGeneral.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuDescribeGeneralColumnSummaries, Me.DescribeGeneralTabulation, Me.DescribeGeneralGraphics, Me.FrequencyTablesToolStripMenuItem}) Me.mnuDescribeGeneral.Name = "mnuDescribeGeneral" Me.mnuDescribeGeneral.Size = New System.Drawing.Size(172, 22) Me.mnuDescribeGeneral.Tag = "General" @@ -2574,12 +2575,6 @@ Partial Class frmMain Me.ExportDataSetToolStripMenuItem.Size = New System.Drawing.Size(197, 22) Me.ExportDataSetToolStripMenuItem.Text = "Export Dataset..." ' - 'ExportRWorkspaceToolStripMenuItem - ' - Me.ExportRWorkspaceToolStripMenuItem.Name = "ExportRWorkspaceToolStripMenuItem" - Me.ExportRWorkspaceToolStripMenuItem.Size = New System.Drawing.Size(197, 22) - Me.ExportRWorkspaceToolStripMenuItem.Text = "Export R Workspace..." - ' 'ExportGraphAsImageToolStripMenuItem ' Me.ExportGraphAsImageToolStripMenuItem.Name = "ExportGraphAsImageToolStripMenuItem" @@ -2592,6 +2587,12 @@ Partial Class frmMain Me.ExportRObjectsToolStripMenuItem.Size = New System.Drawing.Size(197, 22) Me.ExportRObjectsToolStripMenuItem.Text = "Export R Objects..." ' + 'ExportRWorkspaceToolStripMenuItem + ' + Me.ExportRWorkspaceToolStripMenuItem.Name = "ExportRWorkspaceToolStripMenuItem" + Me.ExportRWorkspaceToolStripMenuItem.Size = New System.Drawing.Size(197, 22) + Me.ExportRWorkspaceToolStripMenuItem.Text = "Export R Workspace..." + ' 'mnuFileCloseData ' Me.mnuFileCloseData.Enabled = False @@ -3677,6 +3678,12 @@ Partial Class frmMain Me.ucrOutput.Size = New System.Drawing.Size(295, 113) Me.ucrOutput.TabIndex = 0 ' + 'FrequencyTablesToolStripMenuItem + ' + Me.FrequencyTablesToolStripMenuItem.Name = "FrequencyTablesToolStripMenuItem" + Me.FrequencyTablesToolStripMenuItem.Size = New System.Drawing.Size(188, 22) + Me.FrequencyTablesToolStripMenuItem.Text = "Frequency Tables..." + ' 'frmMain ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -4169,4 +4176,5 @@ Partial Class frmMain Friend WithEvents ExportRWorkspaceToolStripMenuItem As ToolStripMenuItem Friend WithEvents ExportGraphAsImageToolStripMenuItem As ToolStripMenuItem Friend WithEvents ExportRObjectsToolStripMenuItem As ToolStripMenuItem + Friend WithEvents FrequencyTablesToolStripMenuItem As ToolStripMenuItem End Class diff --git a/instat/frmMain.vb b/instat/frmMain.vb index 2c8c7fca75e..65fe1f07eb9 100644 --- a/instat/frmMain.vb +++ b/instat/frmMain.vb @@ -1397,6 +1397,10 @@ Public Class frmMain dlgExportRObjects.ShowDialog() End Sub + Private Sub FrequencyTablesToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles FrequencyTablesToolStripMenuItem.Click + dlgFlatFrequencyTable.ShowDialog() + End Sub + From 68a3f64377dc497f2cdf0c20dd76ce34c7ec4719 Mon Sep 17 00:00:00 2001 From: Alex Sananka Date: Wed, 10 May 2017 10:20:05 +0300 Subject: [PATCH 42/52] edits on frmmain --- instat/frmMain.Designer.vb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/instat/frmMain.Designer.vb b/instat/frmMain.Designer.vb index 2df76025a1d..3597620e8e0 100644 --- a/instat/frmMain.Designer.vb +++ b/instat/frmMain.Designer.vb @@ -2564,10 +2564,10 @@ Partial Class frmMain ' 'mnuExport ' - Me.mnuExport.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ExportDataSetToolStripMenuItem, Me.ExportGraphAsImageToolStripMenuItem, Me.ExportRObjectsToolStripMenuItem, Me.ExportRWorkspaceToolStripMenuItem}) + Me.mnuExport.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ExportDataSetToolStripMenuItem, Me.ExportRObjectsToolStripMenuItem, Me.ExportRWorkspaceToolStripMenuItem, Me.ExportGraphAsImageToolStripMenuItem}) Me.mnuExport.Name = "mnuExport" Me.mnuExport.Size = New System.Drawing.Size(204, 22) - Me.mnuExport.Text = "Export Data" + Me.mnuExport.Text = "Export" ' 'ExportDataSetToolStripMenuItem ' @@ -2578,8 +2578,8 @@ Partial Class frmMain 'ExportGraphAsImageToolStripMenuItem ' Me.ExportGraphAsImageToolStripMenuItem.Name = "ExportGraphAsImageToolStripMenuItem" - Me.ExportGraphAsImageToolStripMenuItem.Size = New System.Drawing.Size(197, 22) - Me.ExportGraphAsImageToolStripMenuItem.Text = "Export GraphAsImage..." + Me.ExportGraphAsImageToolStripMenuItem.Size = New System.Drawing.Size(203, 22) + Me.ExportGraphAsImageToolStripMenuItem.Text = "Export Graph As Image..." ' 'ExportRObjectsToolStripMenuItem ' From 0d0446f2a3de7ff542b04c5c1b54ef5e2b573f6a Mon Sep 17 00:00:00 2001 From: maxwell fundi Date: Wed, 10 May 2017 10:23:52 +0300 Subject: [PATCH 43/52] Changing position for frmSetup loading --- instat/frmSetupLoading.Designer.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/frmSetupLoading.Designer.vb b/instat/frmSetupLoading.Designer.vb index 8a42778ede2..17965af167c 100644 --- a/instat/frmSetupLoading.Designer.vb +++ b/instat/frmSetupLoading.Designer.vb @@ -82,7 +82,7 @@ Partial Class frmSetupLoading Me.MaximizeBox = False Me.MinimizeBox = False Me.Name = "frmSetupLoading" - Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual Me.Text = "Setup Loading" Me.TopMost = True Me.UseWaitCursor = True From 62d187dc0f6d893a6073be739aa4a9174af5c240 Mon Sep 17 00:00:00 2001 From: maxwell fundi Date: Wed, 10 May 2017 10:27:09 +0300 Subject: [PATCH 44/52] Moving the frmsetup loading a bit more --- instat/frmSetupLoading.Designer.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/frmSetupLoading.Designer.vb b/instat/frmSetupLoading.Designer.vb index 17965af167c..e0141084769 100644 --- a/instat/frmSetupLoading.Designer.vb +++ b/instat/frmSetupLoading.Designer.vb @@ -78,7 +78,7 @@ Partial Class frmSetupLoading Me.Controls.Add(Me.lblLoading) Me.Cursor = System.Windows.Forms.Cursors.WaitCursor Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow - Me.Location = New System.Drawing.Point(540, 50) + Me.Location = New System.Drawing.Point(540, 49) Me.MaximizeBox = False Me.MinimizeBox = False Me.Name = "frmSetupLoading" From 09d9ad2c03e537af9e150345a333cb71ab57d02b Mon Sep 17 00:00:00 2001 From: Danny Parsons Date: Wed, 10 May 2017 10:28:41 +0300 Subject: [PATCH 45/52] fixed bug in export workspace --- instat/static/InstatObject/R/instat_object_R6.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/instat/static/InstatObject/R/instat_object_R6.R b/instat/static/InstatObject/R/instat_object_R6.R index 259410b102f..66a140d1cb1 100644 --- a/instat/static/InstatObject/R/instat_object_R6.R +++ b/instat/static/InstatObject/R/instat_object_R6.R @@ -1355,14 +1355,14 @@ instat_object$set("public", "export_workspace", function(data_names, file, inclu graphs <- self$get_graphs(temp_name) graph_names <- names(graphs) for(i in seq_along(graphs)) { - e[[paste(temp_name, graph_names[i], sep = "_")]] <- graphs[i] + e[[paste(temp_name, graph_names[i], sep = "_")]] <- graphs[[i]] } } if(include_models) { models <- self$get_models(temp_name) model_names <- names(models) for(i in seq_along(models)) { - e[[paste(temp_name, model_names[i], sep = "_")]] <- models[i] + e[[paste(temp_name, model_names[i], sep = "_")]] <- models[[i]] } } if(include_metadata) { From eb18d882630e681332457e00a151a27043bd01ef Mon Sep 17 00:00:00 2001 From: Alex Sananka Date: Wed, 10 May 2017 10:33:56 +0300 Subject: [PATCH 46/52] edits on Export dialogs --- instat/dlgExportGraphAsImage.Designer.vb | 54 +++++++++++++++++------- instat/dlgExportGraphAsImage.vb | 2 +- instat/dlgExportRObjects.Designer.vb | 22 +++++----- instat/dlgExportRWorkspace.Designer.vb | 2 +- instat/dlgExportRWorkspace.vb | 12 +++--- 5 files changed, 58 insertions(+), 34 deletions(-) diff --git a/instat/dlgExportGraphAsImage.Designer.vb b/instat/dlgExportGraphAsImage.Designer.vb index fe47eb4f19e..5120b7ba923 100644 --- a/instat/dlgExportGraphAsImage.Designer.vb +++ b/instat/dlgExportGraphAsImage.Designer.vb @@ -24,10 +24,12 @@ Partial Class dlgExportGraphAsImage Private Sub InitializeComponent() Me.lblSelectedGraph = New System.Windows.Forms.Label() Me.cmdBrowse = New System.Windows.Forms.Button() - Me.ucrInputFile = New instat.ucrInputTextBox() Me.ucrSelectedGraphReceiver = New instat.ucrReceiverSingle() Me.ucrSelectorGraphAsImage = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() + Me.lblExportFile = New System.Windows.Forms.Label() + Me.lblExport = New System.Windows.Forms.Label() + Me.ucrInputExportFile = New instat.ucrInputTextBox() Me.SuspendLayout() ' 'lblSelectedGraph @@ -41,23 +43,13 @@ Partial Class dlgExportGraphAsImage ' 'cmdBrowse ' - Me.cmdBrowse.Location = New System.Drawing.Point(310, 194) + Me.cmdBrowse.Location = New System.Drawing.Point(326, 194) Me.cmdBrowse.Name = "cmdBrowse" Me.cmdBrowse.Size = New System.Drawing.Size(75, 23) Me.cmdBrowse.TabIndex = 4 Me.cmdBrowse.Text = "Browse..." Me.cmdBrowse.UseVisualStyleBackColor = True ' - 'ucrInputFile - ' - Me.ucrInputFile.AddQuotesIfUnrecognised = True - Me.ucrInputFile.IsMultiline = False - Me.ucrInputFile.IsReadOnly = False - Me.ucrInputFile.Location = New System.Drawing.Point(10, 196) - Me.ucrInputFile.Name = "ucrInputFile" - Me.ucrInputFile.Size = New System.Drawing.Size(294, 21) - Me.ucrInputFile.TabIndex = 3 - ' 'ucrSelectedGraphReceiver ' Me.ucrSelectedGraphReceiver.frmParent = Me @@ -86,13 +78,43 @@ Partial Class dlgExportGraphAsImage Me.ucrBase.Size = New System.Drawing.Size(404, 52) Me.ucrBase.TabIndex = 5 ' + 'lblExportFile + ' + Me.lblExportFile.AutoSize = True + Me.lblExportFile.Location = New System.Drawing.Point(179, 132) + Me.lblExportFile.Name = "lblExportFile" + Me.lblExportFile.Size = New System.Drawing.Size(59, 13) + Me.lblExportFile.TabIndex = 6 + Me.lblExportFile.Text = "Export File:" + ' + 'lblExport + ' + Me.lblExport.AutoSize = True + Me.lblExport.Location = New System.Drawing.Point(10, 199) + Me.lblExport.Name = "lblExport" + Me.lblExport.Size = New System.Drawing.Size(59, 13) + Me.lblExport.TabIndex = 6 + Me.lblExport.Text = "Export File:" + ' + 'ucrInputExportFile + ' + Me.ucrInputExportFile.AddQuotesIfUnrecognised = True + Me.ucrInputExportFile.IsMultiline = False + Me.ucrInputExportFile.IsReadOnly = False + Me.ucrInputExportFile.Location = New System.Drawing.Point(70, 196) + Me.ucrInputExportFile.Name = "ucrInputExportFile" + Me.ucrInputExportFile.Size = New System.Drawing.Size(251, 21) + Me.ucrInputExportFile.TabIndex = 7 + ' 'dlgExportGraphAsImage ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(416, 277) + Me.ClientSize = New System.Drawing.Size(418, 288) + Me.Controls.Add(Me.ucrInputExportFile) + Me.Controls.Add(Me.lblExport) + Me.Controls.Add(Me.lblExportFile) Me.Controls.Add(Me.cmdBrowse) - Me.Controls.Add(Me.ucrInputFile) Me.Controls.Add(Me.lblSelectedGraph) Me.Controls.Add(Me.ucrSelectedGraphReceiver) Me.Controls.Add(Me.ucrSelectorGraphAsImage) @@ -112,6 +134,8 @@ Partial Class dlgExportGraphAsImage Friend WithEvents ucrSelectorGraphAsImage As ucrSelectorByDataFrameAddRemove Friend WithEvents ucrSelectedGraphReceiver As ucrReceiverSingle Friend WithEvents cmdBrowse As Button - Friend WithEvents ucrInputFile As ucrInputTextBox Friend WithEvents lblSelectedGraph As Label + Friend WithEvents lblExportFile As Label + Friend WithEvents lblExport As Label + Friend WithEvents ucrInputExportFile As ucrInputTextBox End Class diff --git a/instat/dlgExportGraphAsImage.vb b/instat/dlgExportGraphAsImage.vb index d0d3fa08dc7..a3df6517359 100644 --- a/instat/dlgExportGraphAsImage.vb +++ b/instat/dlgExportGraphAsImage.vb @@ -85,7 +85,7 @@ Public Class dlgExportGraphAsImage End If End Sub - Private Sub ucrCoreControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrSelectedGraphReceiver.ControlContentsChanged, ucrInputFile.ControlContentsChanged + Private Sub ucrCoreControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrSelectedGraphReceiver.ControlContentsChanged TestOkEnabled() End Sub End Class \ No newline at end of file diff --git a/instat/dlgExportRObjects.Designer.vb b/instat/dlgExportRObjects.Designer.vb index ecc3df90c69..2d5c10ff7cc 100644 --- a/instat/dlgExportRObjects.Designer.vb +++ b/instat/dlgExportRObjects.Designer.vb @@ -27,8 +27,8 @@ Partial Class dlgExportRObjects Me.ucrSelectorObjects = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() Me.ucrInputExportFile = New instat.ucrInputTextBox() - Me.cmdBrowse = New System.Windows.Forms.Button() Me.lblExportFile = New System.Windows.Forms.Label() + Me.cmdBrowse = New System.Windows.Forms.Button() Me.SuspendLayout() ' 'lblObjects @@ -78,15 +78,6 @@ Partial Class dlgExportRObjects Me.ucrInputExportFile.Size = New System.Drawing.Size(251, 21) Me.ucrInputExportFile.TabIndex = 4 ' - 'cmdBrowse - ' - Me.cmdBrowse.Location = New System.Drawing.Point(346, 203) - Me.cmdBrowse.Name = "cmdBrowse" - Me.cmdBrowse.Size = New System.Drawing.Size(62, 23) - Me.cmdBrowse.TabIndex = 5 - Me.cmdBrowse.Text = "Browse" - Me.cmdBrowse.UseVisualStyleBackColor = True - ' 'lblExportFile ' Me.lblExportFile.AutoSize = True @@ -96,6 +87,15 @@ Partial Class dlgExportRObjects Me.lblExportFile.TabIndex = 3 Me.lblExportFile.Text = "Export File:" ' + 'cmdBrowse + ' + Me.cmdBrowse.Location = New System.Drawing.Point(346, 203) + Me.cmdBrowse.Name = "cmdBrowse" + Me.cmdBrowse.Size = New System.Drawing.Size(62, 23) + Me.cmdBrowse.TabIndex = 5 + Me.cmdBrowse.Text = "Browse..." + Me.cmdBrowse.UseVisualStyleBackColor = True + ' 'dlgExportRObjects ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -123,6 +123,6 @@ Partial Class dlgExportRObjects Friend WithEvents ucrReceiverObjects As ucrReceiverMultiple Friend WithEvents lblObjects As Label Friend WithEvents ucrInputExportFile As ucrInputTextBox - Friend WithEvents cmdBrowse As Button Friend WithEvents lblExportFile As Label + Friend WithEvents cmdBrowse As Button End Class diff --git a/instat/dlgExportRWorkspace.Designer.vb b/instat/dlgExportRWorkspace.Designer.vb index d1f4d1ac740..be264400d07 100644 --- a/instat/dlgExportRWorkspace.Designer.vb +++ b/instat/dlgExportRWorkspace.Designer.vb @@ -41,7 +41,7 @@ Partial Class dlgExportRWorkspace Me.cmdBrowse.Name = "cmdBrowse" Me.cmdBrowse.Size = New System.Drawing.Size(62, 23) Me.cmdBrowse.TabIndex = 9 - Me.cmdBrowse.Text = "Browse" + Me.cmdBrowse.Text = "Browse..." Me.cmdBrowse.UseVisualStyleBackColor = True ' 'lblExport diff --git a/instat/dlgExportRWorkspace.vb b/instat/dlgExportRWorkspace.vb index a98260b2dda..a4b9cf903ca 100644 --- a/instat/dlgExportRWorkspace.vb +++ b/instat/dlgExportRWorkspace.vb @@ -44,19 +44,19 @@ Public Class dlgExportRWorkspace ucrInputExportFile.SetParameter(New RParameter("file", 1)) ucrChkMetadata.SetParameter(New RParameter("include_metadata", 2)) - ucrChkMetadata.SetText("Metadata") + ucrChkMetadata.SetText("Include Metadata") ucrChkMetadata.SetValuesCheckedAndUnchecked("TRUE", "FALSE") - ucrChkMetadata.SetRDefault("FALSE") + ucrChkMetadata.SetRDefault("TRUE") ucrChkGraphs.SetParameter(New RParameter("include_graphs", 3)) - ucrChkGraphs.SetText("Graphs") + ucrChkGraphs.SetText("Include Graphs") ucrChkGraphs.SetValuesCheckedAndUnchecked("TRUE", "FALSE") - ucrChkGraphs.SetRDefault("FALSE") + ucrChkGraphs.SetRDefault("TRUE") ucrChkModels.SetParameter(New RParameter("include_models", 4)) - ucrChkModels.SetText("Models") + ucrChkModels.SetText("Include Models") ucrChkModels.SetValuesCheckedAndUnchecked("TRUE", "FALSE") - ucrChkModels.SetRDefault("FALSE") + ucrChkModels.SetRDefault("TRUE") End Sub Private Sub SetDefaults() From 0ac1366a380e814342fb0d3422693ed2b7f66d1e Mon Sep 17 00:00:00 2001 From: Alex Sananka Date: Wed, 10 May 2017 10:37:38 +0300 Subject: [PATCH 47/52] edits --- instat/dlgExportGraphAsImage.Designer.vb | 34 ++++++++---------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/instat/dlgExportGraphAsImage.Designer.vb b/instat/dlgExportGraphAsImage.Designer.vb index 5120b7ba923..2d42ca06ed2 100644 --- a/instat/dlgExportGraphAsImage.Designer.vb +++ b/instat/dlgExportGraphAsImage.Designer.vb @@ -27,9 +27,8 @@ Partial Class dlgExportGraphAsImage Me.ucrSelectedGraphReceiver = New instat.ucrReceiverSingle() Me.ucrSelectorGraphAsImage = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() - Me.lblExportFile = New System.Windows.Forms.Label() Me.lblExport = New System.Windows.Forms.Label() - Me.ucrInputExportFile = New instat.ucrInputTextBox() + Me.ucrInputFile = New instat.ucrInputTextBox() Me.SuspendLayout() ' 'lblSelectedGraph @@ -78,15 +77,6 @@ Partial Class dlgExportGraphAsImage Me.ucrBase.Size = New System.Drawing.Size(404, 52) Me.ucrBase.TabIndex = 5 ' - 'lblExportFile - ' - Me.lblExportFile.AutoSize = True - Me.lblExportFile.Location = New System.Drawing.Point(179, 132) - Me.lblExportFile.Name = "lblExportFile" - Me.lblExportFile.Size = New System.Drawing.Size(59, 13) - Me.lblExportFile.TabIndex = 6 - Me.lblExportFile.Text = "Export File:" - ' 'lblExport ' Me.lblExport.AutoSize = True @@ -96,24 +86,23 @@ Partial Class dlgExportGraphAsImage Me.lblExport.TabIndex = 6 Me.lblExport.Text = "Export File:" ' - 'ucrInputExportFile + 'ucrInputFile ' - Me.ucrInputExportFile.AddQuotesIfUnrecognised = True - Me.ucrInputExportFile.IsMultiline = False - Me.ucrInputExportFile.IsReadOnly = False - Me.ucrInputExportFile.Location = New System.Drawing.Point(70, 196) - Me.ucrInputExportFile.Name = "ucrInputExportFile" - Me.ucrInputExportFile.Size = New System.Drawing.Size(251, 21) - Me.ucrInputExportFile.TabIndex = 7 + Me.ucrInputFile.AddQuotesIfUnrecognised = True + Me.ucrInputFile.IsMultiline = False + Me.ucrInputFile.IsReadOnly = False + Me.ucrInputFile.Location = New System.Drawing.Point(70, 196) + Me.ucrInputFile.Name = "ucrInputFile" + Me.ucrInputFile.Size = New System.Drawing.Size(251, 21) + Me.ucrInputFile.TabIndex = 7 ' 'dlgExportGraphAsImage ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(418, 288) - Me.Controls.Add(Me.ucrInputExportFile) + Me.Controls.Add(Me.ucrInputFile) Me.Controls.Add(Me.lblExport) - Me.Controls.Add(Me.lblExportFile) Me.Controls.Add(Me.cmdBrowse) Me.Controls.Add(Me.lblSelectedGraph) Me.Controls.Add(Me.ucrSelectedGraphReceiver) @@ -135,7 +124,6 @@ Partial Class dlgExportGraphAsImage Friend WithEvents ucrSelectedGraphReceiver As ucrReceiverSingle Friend WithEvents cmdBrowse As Button Friend WithEvents lblSelectedGraph As Label - Friend WithEvents lblExportFile As Label Friend WithEvents lblExport As Label - Friend WithEvents ucrInputExportFile As ucrInputTextBox + Friend WithEvents ucrInputFile As ucrInputTextBox End Class From d22484cdfc2b366f80eea6f538ab512bff861884 Mon Sep 17 00:00:00 2001 From: Alex Sananka Date: Wed, 10 May 2017 10:41:02 +0300 Subject: [PATCH 48/52] tiny edit --- instat/dlgExportRWorkspace.Designer.vb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/instat/dlgExportRWorkspace.Designer.vb b/instat/dlgExportRWorkspace.Designer.vb index be264400d07..bbfefa71982 100644 --- a/instat/dlgExportRWorkspace.Designer.vb +++ b/instat/dlgExportRWorkspace.Designer.vb @@ -95,7 +95,7 @@ Partial Class dlgExportRWorkspace Me.ucrChkGraphs.Checked = False Me.ucrChkGraphs.Location = New System.Drawing.Point(10, 199) Me.ucrChkGraphs.Name = "ucrChkGraphs" - Me.ucrChkGraphs.Size = New System.Drawing.Size(100, 20) + Me.ucrChkGraphs.Size = New System.Drawing.Size(119, 20) Me.ucrChkGraphs.TabIndex = 5 ' 'ucrChkModels @@ -103,7 +103,7 @@ Partial Class dlgExportRWorkspace Me.ucrChkModels.Checked = False Me.ucrChkModels.Location = New System.Drawing.Point(10, 225) Me.ucrChkModels.Name = "ucrChkModels" - Me.ucrChkModels.Size = New System.Drawing.Size(100, 20) + Me.ucrChkModels.Size = New System.Drawing.Size(128, 20) Me.ucrChkModels.TabIndex = 6 ' 'ucrChkMetadata @@ -111,7 +111,7 @@ Partial Class dlgExportRWorkspace Me.ucrChkMetadata.Checked = False Me.ucrChkMetadata.Location = New System.Drawing.Point(10, 173) Me.ucrChkMetadata.Name = "ucrChkMetadata" - Me.ucrChkMetadata.Size = New System.Drawing.Size(100, 20) + Me.ucrChkMetadata.Size = New System.Drawing.Size(145, 20) Me.ucrChkMetadata.TabIndex = 4 ' 'ucrReceiverMultiple From cb3ca47b2cdbfa45ba40fd9f4fb7dbbf4b016f23 Mon Sep 17 00:00:00 2001 From: Alex Sananka Date: Wed, 10 May 2017 12:18:16 +0300 Subject: [PATCH 49/52] three way minor edits --- instat/dlgThreeVariableFrequencies.vb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/instat/dlgThreeVariableFrequencies.vb b/instat/dlgThreeVariableFrequencies.vb index 0dbb76648b7..d96dca1a013 100644 --- a/instat/dlgThreeVariableFrequencies.vb +++ b/instat/dlgThreeVariableFrequencies.vb @@ -130,12 +130,12 @@ Public Class dlgThreeVariableFrequencies ucrPnlFreqType.AddParameterValuesCondition(rdoColumn, "margin", Chr(34) & "col" & Chr(34)) ucrSaveGraph.Enabled = False 'temporary for now - ucrSaveGraph.SetPrefix("three_way_freq") - ucrSaveGraph.SetSaveTypeAsGraph() - ucrSaveGraph.SetDataFrameSelector(ucrSelectorThreeVariableFrequencies.ucrAvailableDataFrames) - ucrSaveGraph.SetCheckBoxText("Save Graph") - ucrSaveGraph.SetIsComboBox() - ucrSaveGraph.SetAssignToIfUncheckedValue("last_graph") + 'ucrSaveGraph.SetPrefix("three_way_freq") + 'ucrSaveGraph.SetSaveTypeAsGraph() + 'ucrSaveGraph.SetDataFrameSelector(ucrSelectorThreeVariableFrequencies.ucrAvailableDataFrames) + 'ucrSaveGraph.SetCheckBoxText("Save Graph") + 'ucrSaveGraph.SetIsComboBox() + 'ucrSaveGraph.SetAssignToIfUncheckedValue("last_graph") ucrChkColumn.SetLinkedDisplayControl(grpFreqTypeTable) End Sub @@ -179,7 +179,7 @@ Public Class dlgThreeVariableFrequencies clsSjPlot.AddParameter("fun", Chr(34) & "grpfrq" & Chr(34)) clsSjPlot.AddParameter("show.prc", "TRUE") clsSjPlot.AddParameter("show.n", "TRUE") - clsGraphBaseOperator.SetAssignTo("last_graph", strTempDataframe:=ucrSelectorThreeVariableFrequencies.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph") + 'clsGraphBaseOperator.SetAssignTo("last_graph", strTempDataframe:=ucrSelectorThreeVariableFrequencies.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph") ucrBase.clsRsyntax.SetBaseROperator(clsTableBaseOperator) bResetSubdialog = True End Sub From 7364b70789bf0a7c753ab525b82d7e13d440b08d Mon Sep 17 00:00:00 2001 From: Danny Parsons Date: Wed, 10 May 2017 12:19:10 +0300 Subject: [PATCH 50/52] fixed bug with export graph --- instat/dlgExportGraphAsImage.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/dlgExportGraphAsImage.vb b/instat/dlgExportGraphAsImage.vb index a3df6517359..d0d3fa08dc7 100644 --- a/instat/dlgExportGraphAsImage.vb +++ b/instat/dlgExportGraphAsImage.vb @@ -85,7 +85,7 @@ Public Class dlgExportGraphAsImage End If End Sub - Private Sub ucrCoreControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrSelectedGraphReceiver.ControlContentsChanged + Private Sub ucrCoreControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrSelectedGraphReceiver.ControlContentsChanged, ucrInputFile.ControlContentsChanged TestOkEnabled() End Sub End Class \ No newline at end of file From 55b4b99e2c026a79b84adbb3989f742e71ff79a0 Mon Sep 17 00:00:00 2001 From: Lily Date: Wed, 10 May 2017 10:45:11 +0100 Subject: [PATCH 51/52] bug fix --- instat/dlgSummaryBarOrPieChart.vb | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/instat/dlgSummaryBarOrPieChart.vb b/instat/dlgSummaryBarOrPieChart.vb index 6900420053f..c162a882551 100644 --- a/instat/dlgSummaryBarOrPieChart.vb +++ b/instat/dlgSummaryBarOrPieChart.vb @@ -175,19 +175,21 @@ Public Class dlgSummaryBarOrPieChart End Sub Private Sub SetDialogOptions() - If ucrSaveSummaryBar.bUserTyped = False Then - If rdoBarChart.Checked Then - ucrSaveSummaryBar.SetPrefix("Bar") - cmdPieChartOptions.Visible = False - cmdBarChartOptions.Visible = True - clsRgeomBarFunction.RemoveParameterByName("width") - clsBaseOperator.RemoveParameter(clsRCoordPolarParam) - ElseIf rdoPieChart.Checked Then - ucrSaveSummaryBar.SetPrefix("Pie") - cmdPieChartOptions.Visible = True - cmdBarChartOptions.Visible = False - clsRgeomBarFunction.AddParameter("width", "1") - clsBaseOperator.AddParameter(clsRCoordPolarParam) + If rdoBarChart.Checked Then + cmdPieChartOptions.Visible = False + cmdBarChartOptions.Visible = True + clsRgeomBarFunction.RemoveParameterByName("width") + clsBaseOperator.RemoveParameter(clsRCoordPolarParam) + If ucrSaveSummaryBar.bUserTyped = False Then + ucrSaveSummaryBar.SetPrefix("bar") + End If + ElseIf rdoPieChart.Checked Then + cmdPieChartOptions.Visible = True + cmdBarChartOptions.Visible = False + clsRgeomBarFunction.AddParameter("width", "1") + clsBaseOperator.AddParameter(clsRCoordPolarParam) + If ucrSaveSummaryBar.bUserTyped = False Then + ucrSaveSummaryBar.SetPrefix("pie") End If End If End Sub From b43d7db6addc73b74b586e7352896a2d51f820d5 Mon Sep 17 00:00:00 2001 From: Lily Date: Wed, 10 May 2017 11:02:57 +0100 Subject: [PATCH 52/52] bUserTyped amendment --- instat/dlgSummaryBarOrPieChart.vb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/instat/dlgSummaryBarOrPieChart.vb b/instat/dlgSummaryBarOrPieChart.vb index c162a882551..5c29ed3e606 100644 --- a/instat/dlgSummaryBarOrPieChart.vb +++ b/instat/dlgSummaryBarOrPieChart.vb @@ -180,7 +180,7 @@ Public Class dlgSummaryBarOrPieChart cmdBarChartOptions.Visible = True clsRgeomBarFunction.RemoveParameterByName("width") clsBaseOperator.RemoveParameter(clsRCoordPolarParam) - If ucrSaveSummaryBar.bUserTyped = False Then + If Not ucrSaveSummaryBar.bUserTyped Then ucrSaveSummaryBar.SetPrefix("bar") End If ElseIf rdoPieChart.Checked Then @@ -188,7 +188,7 @@ Public Class dlgSummaryBarOrPieChart cmdBarChartOptions.Visible = False clsRgeomBarFunction.AddParameter("width", "1") clsBaseOperator.AddParameter(clsRCoordPolarParam) - If ucrSaveSummaryBar.bUserTyped = False Then + If Not ucrSaveSummaryBar.bUserTyped Then ucrSaveSummaryBar.SetPrefix("pie") End If End If