Skip to content

Commit

Permalink
Merge pull request #94 from africanmathsinitiative/master
Browse files Browse the repository at this point in the history
updating master
  • Loading branch information
stevenndungu authored Jan 31, 2017
2 parents d420ad8 + 33273ca commit b93b464
Show file tree
Hide file tree
Showing 7 changed files with 223 additions and 214 deletions.
32 changes: 32 additions & 0 deletions instat/clsCondition.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Public Class Condition
Private strType As String = "ParameterValue"
Private strParameterName As String = ""
Private lstValues As List(Of String) = New List(Of String)

Public Sub SetParameterPresentName(strParamName As String)
strType = "ParameterPresent"
strParameterName = strParamName
End Sub

Public Sub SetParameterValues(strParamName As String, lstParamValues As List(Of String))
strType = "ParameterValue"
strParameterName = strParamName
lstValues = lstParamValues
End Sub

Public Sub SetParameterValues(strParamName As String, strParamValues As String)
strType = "ParameterValue"
strParameterName = strParamName
lstValues = New List(Of String)({strParamValues})
End Sub

Public Sub SetFunctionName(strFuncName As String)
strType = "FunctionName"
lstValues = New List(Of String)({strFuncName})
End Sub

Public Sub SetFunctionNamesMultiple(lstFuncNames As List(Of String))
strType = "FunctionName"
lstValues = lstFuncNames
End Sub
End Class
93 changes: 40 additions & 53 deletions instat/dlgAppend.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

99 changes: 47 additions & 52 deletions instat/dlgAppend.vb
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,70 @@
'
' You should have received a copy of the GNU General Public License k
' along with this program. If not, see <http://www.gnu.org/licenses/>.
Imports instat
Imports instat.Translations
Public Class dlgAppend
Public bFirstLoad As Boolean = True
Private clsBindRows, clsDefaultBindRows As New RFunction

Private Sub dlgAppend_Load(sender As Object, e As EventArgs) Handles MyBase.Load
autoTranslate(Me)

If bFirstLoad Then
InitialiseDialog()
SetDefaults()
SetDefaults()
bFirstLoad = False
Else
ReopenDialog()
End If
Else
ReopenDialog()
End If
TestOKEnabled()
End Sub
Private Sub InitialiseDialog()
ucrBase.iHelpTopicID = 465

' ucrReceiver
ucrReceiverAppendDataframe.SetParameter(New RParameter("x", 0))
ucrReceiverAppendDataframe.GetParameter().bIncludeArgumentName = False
ucrReceiverAppendDataframe.SetParameterIsRFunction()
ucrReceiverAppendDataframe.Selector = ucrSelectorDataframes
ucrReceiverAppendDataframe.SetMeAsReceiver()
ucrBase.clsRsyntax.SetFunction("bind_rows")
ucrReceiverAppendDataframe.SetItemType("dataframe")
ucrInputIDColName.SetValidationTypeAsRVariable()
ucrInputNewDataframeName.SetValidationTypeAsRVariable()

'clsRFunctionParameter:=ucrReceiverAppendDataframe.GetVariables, bIncludeArgumentName:=False)

' ucrSave
ucrSaveGraph.SetIsTextBox()
ucrSaveGraph.SetSaveTypeAsDataFrame()
ucrSaveGraph.SetLabelText("New Data Frame Name:")


'chkID
SetParameter({ucrChkIncludeIDColumn, ucrInputIDColName}, New RParameter(".id", 1))
ucrChkIncludeIDColumn.SetText("Include ID Column")
ucrChkIncludeIDColumn.bChangeParameterValue = False
ucrChkIncludeIDColumn.AddToLinkedControls(ucrLinked:=ucrInputIDColName, objValues:={True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True)
ucrInputIDColName.bAddRemoveParameter = False
ucrInputIDColName.SetLabel(lblIDColName)


'Default Function
clsDefaultBindRows.SetRCommand("bind_rows")
clsDefaultBindRows.AddParameter(".id", Chr(34) & "id" & Chr(34))
clsDefaultBindRows.SetAssignTo(strTemp:="Append", strTempDataframe:="Append")
End Sub

Private Sub SetDefaults()
clsBindRows = clsDefaultBindRows.Clone()
ucrBase.clsRsyntax.SetBaseRFunction(clsBindRows)
ucrSelectorDataframes.Reset()
ucrSaveGraph.Reset()
SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, True)
TestOKEnabled()
End Sub

Private Sub TestOKEnabled()
If Not ucrReceiverAppendDataframe.IsEmpty AndAlso Not ucrInputNewDataframeName.IsEmpty Then
If chkIncludeIDColumn.Checked AndAlso ucrInputIDColName.IsEmpty Then
If Not ucrReceiverAppendDataframe.IsEmpty AndAlso ucrSaveGraph.IsComplete() Then
If ucrChkIncludeIDColumn.Checked AndAlso ucrInputIDColName.IsEmpty Then
ucrBase.OKEnabled(False)
Else
ucrBase.OKEnabled(True)
Expand All @@ -51,54 +86,14 @@ Public Class dlgAppend
End If
End Sub

Private Sub SetDefaults()
ucrSelectorDataframes.Reset()
ucrInputIDColName.SetName("id")
ucrInputNewDataframeName.SetName("Append")
chkIncludeIDColumn.Checked = False
TestOKEnabled()
End Sub


Private Sub ReopenDialog()
End Sub

Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset
SetDefaults()
End Sub

Private Sub ucrReceiverAppendDataframe_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverAppendDataframe.SelectionChanged
If ucrReceiverAppendDataframe.IsEmpty = False Then
ucrBase.clsRsyntax.AddParameter("x", clsRFunctionParameter:=ucrReceiverAppendDataframe.GetVariables, bIncludeArgumentName:=False)
Else
ucrBase.clsRsyntax.RemoveParameter("x")
End If
TestOKEnabled()
End Sub

Private Sub chkIncludeIDColumn_CheckedChanged(sender As Object, e As EventArgs) Handles chkIncludeIDColumn.CheckedChanged
IncludeIDColumn()
End Sub

Private Sub ucrInputIDColName_NameChanged() Handles ucrInputIDColName.NameChanged
IncludeIDColumn()
End Sub

Private Sub IncludeIDColumn()
If chkIncludeIDColumn.Checked Then
ucrBase.clsRsyntax.AddParameter(".id", Chr(34) & ucrInputIDColName.GetText & Chr(34))
ucrInputIDColName.Visible = True
lblIDColNAme.Visible = True
Else
ucrBase.clsRsyntax.RemoveParameter(".id")
ucrInputIDColName.Visible = False
lblIDColNAme.Visible = False
End If
TestOKEnabled()
Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset
SetDefaults()
End Sub

Private Sub ucrInputNewDataframeName_NameChanged() Handles ucrInputNewDataframeName.NameChanged
ucrBase.clsRsyntax.SetAssignTo(ucrInputNewDataframeName.GetText(), strTempDataframe:=ucrInputNewDataframeName.GetText())
Private Sub ucrReceiverAppendDataframe_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverAppendDataframe.ControlContentsChanged, ucrSaveGraph.ControlContentsChanged, ucrChkIncludeIDColumn.ControlContentsChanged, ucrInputIDColName.ControlContentsChanged
TestOKEnabled()
End Sub

Expand Down
Loading

0 comments on commit b93b464

Please sign in to comment.