Skip to content

Commit

Permalink
Merge branch 'master' into regular_sequence_bug_with_menu
Browse files Browse the repository at this point in the history
  • Loading branch information
conlooptechnologies authored Mar 30, 2022
2 parents e4c0cce + b412756 commit 4cd396c
Show file tree
Hide file tree
Showing 104 changed files with 3,910 additions and 1,445 deletions.
2 changes: 2 additions & 0 deletions instat/Interface/IColumnMetaDataGrid.vb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Public Interface IColumnMetaDataGrid

Event EditValue(iRow As Integer, strColumnName As String, strPreviousValue As String, newValue As Object)

Event DeleteLabels(strColumnName As String)

Sub AddColumns(columnMetaData As clsColumnMetaData)

Sub AddRowData(columnMetaData As clsColumnMetaData)
Expand Down
2 changes: 2 additions & 0 deletions instat/Interface/IDataViewGrid.vb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Public Interface IDataViewGrid

Event ReplaceValueInData(strNewValue As String, strColumnName As String, strRowText As String)

Event DeleteValuesToDataframe()

Event WorksheetChanged()

Event WorksheetRemoved(worksheet As clsWorksheetAdapter)
Expand Down
2 changes: 2 additions & 0 deletions instat/Interface/IDataframeMetaDataGrid.vb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Public Interface IDataframeMetaDataGrid

Event EditValue(iRow As Integer, strColumnName As String, strPreviousValue As String, newValue As Object)

Event DeleteLabels(strColumnName As String)

Sub AddColumns()

Sub AddRowData()
Expand Down
2 changes: 2 additions & 0 deletions instat/Interface/IGrid.vb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ Public Interface IGrid

Function GetSelectedRows() As List(Of String)

Function GetSelectedColumnIndexes() As List(Of String)

Function GetWorksheet(strName As String) As clsWorksheetAdapter

Sub RemoveOldWorksheets()
Expand Down
18 changes: 9 additions & 9 deletions instat/Model/DataFrame/clsDataFrame.vb
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ Public Class clsDataFrame
Private _clsPrepareFunctions As clsPrepareFunctionsForGrids
Private _clsVisiblePage As clsDataFramePage
Private _clsColumnMetaData As clsColumnMetaData
Private _clsFilter As clsDataFrameFilter
Private _clsFilterOrColumnSelection As clsDataFrameFilterOrColumnSelection
Private _strName As String
Private _RLink As RLink
Private _iTotalRowCount As Integer
Private _iTotalColumnCount As Integer

''' <summary>
''' Filter information
''' Filter or column selection information
''' </summary>
''' <returns></returns>
Public ReadOnly Property clsFilter() As clsDataFrameFilter
Public ReadOnly Property clsFilterOrColumnSelection() As clsDataFrameFilterOrColumnSelection
Get
Return _clsFilter
Return _clsFilterOrColumnSelection
End Get
End Property

Expand All @@ -51,7 +51,7 @@ Public Class clsDataFrame
End Property

''' <summary>
''' Column meta data for the dataframe
''' Column metadata for the dataframe
''' </summary>
''' <returns></returns>
Public ReadOnly Property clsColumnMetaData As clsColumnMetaData
Expand Down Expand Up @@ -142,7 +142,7 @@ Public Class clsDataFrame
_strName = strName
_clsPrepareFunctions = New clsPrepareFunctionsForGrids(rLink, strName)
_clsVisiblePage = New clsDataFramePage(rLink, strName)
_clsFilter = New clsDataFrameFilter(rLink, strName)
_clsFilterOrColumnSelection = New clsDataFrameFilterOrColumnSelection(rLink, strName)
_clsColumnMetaData = New clsColumnMetaData(rLink, strName)
End Sub

Expand All @@ -168,9 +168,9 @@ Public Class clsDataFrame
If _clsVisiblePage.RefreshData() Then
_iTotalRowCount = _RLink.GetDataFrameLength(_strName, False)
_iTotalColumnCount = _RLink.GetDataFrameColumnCount(_strName)
_clsFilter.RefreshData()
If _clsFilter.bFilterApplied Then
_clsVisiblePage.SetTotalRowAndColumnCounts(_iTotalColumnCount, _clsFilter.iFilteredRowCount)
_clsFilterOrColumnSelection.RefreshData()
If _clsFilterOrColumnSelection.bFilterApplied Then
_clsVisiblePage.SetTotalRowAndColumnCounts(_iTotalColumnCount, _clsFilterOrColumnSelection.iFilteredRowCount)
Else
_clsVisiblePage.SetTotalRowAndColumnCounts(_iTotalColumnCount, _iTotalRowCount)
End If
Expand Down
25 changes: 24 additions & 1 deletion instat/Model/DataFrame/clsDataFrameFilter.vb
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,41 @@ Imports RDotNet
''' <summary>
''' Holds filter information for the dataframe
''' </summary>
Public Class clsDataFrameFilter
Public Class clsDataFrameFilterOrColumnSelection
Protected _strDataFrameName As String
Protected _RLink As RLink

Protected _bFilterApplied As Boolean
Protected _bColumnSelectionApplied As Boolean
Protected _iFilteredRowCount As Integer
Protected _iSelectedColumnCount As Integer
Protected _strFilterName As String
Protected _strSelectionName As String

Public ReadOnly Property iFilteredRowCount As Integer
Get
Return _iFilteredRowCount
End Get
End Property

Public ReadOnly Property iSelectedColumnCount As Integer
Get
Return _iSelectedColumnCount
End Get
End Property

Public ReadOnly Property strName As String
Get
Return _strFilterName
End Get
End Property

Public ReadOnly Property strSelectionName As String
Get
Return _strSelectionName
End Get
End Property

Public ReadOnly Property bFilterApplied() As Boolean
Get
Return _bFilterApplied
Expand All @@ -64,6 +78,13 @@ Public Class clsDataFrameFilter
Return _RLink.RunInternalScriptGetValue(clsGetCurrentFilterName.ToScript(), bSilent:=True).AsCharacter(0)
End Function

Private Function GetSelectionNameFromRCommand() As String
Dim clsGetCurrentFilterName As New RFunction
clsGetCurrentFilterName.SetRCommand(_RLink.strInstatDataObject & "$get_current_column_selection")
clsGetCurrentFilterName.AddParameter("data_name", Chr(34) & _strDataFrameName & Chr(34), iPosition:=0)
Return _RLink.RunInternalScriptGetValue(clsGetCurrentFilterName.ToScript(), bSilent:=True).AsCharacter(0)
End Function

Private Function GetFilterAppliedFromRCommand() As Boolean
Dim clsFilterApplied As New RFunction
clsFilterApplied.SetRCommand(_RLink.strInstatDataObject & "$filter_applied")
Expand All @@ -80,9 +101,11 @@ Public Class clsDataFrameFilter

Public Sub RefreshData()
_iFilteredRowCount = _RLink.GetDataFrameLength(_strDataFrameName, True)
_iSelectedColumnCount = _RLink.GetDataFrameColumnCount(_strDataFrameName)
_bFilterApplied = GetFilterAppliedFromRCommand()
_bColumnSelectionApplied = GetColumnSelectionAppliedFromRCommand()
_strFilterName = GetFilterNameFromRCommand()
_strSelectionName = GetSelectionNameFromRCommand()
End Sub

End Class
22 changes: 11 additions & 11 deletions instat/Model/DataFrame/clsDataFramePage.vb
Original file line number Diff line number Diff line change
Expand Up @@ -191,19 +191,19 @@ Public Class clsDataFramePage
End Function

Private Function GetDataFrameFromRCommand() As DataFrame
Dim clsRFunction As New RFunction
Dim clsGetDataFrameRFunction As New RFunction
Dim expTemp As SymbolicExpression
_hasChanged = True
clsRFunction.SetRCommand(_clsRLink.strInstatDataObject & "$get_data_frame")
clsRFunction.AddParameter("convert_to_character", "TRUE")
clsRFunction.AddParameter("include_hidden_columns", "FALSE")
clsRFunction.AddParameter("use_current_filter", "TRUE")
clsRFunction.AddParameter("max_cols", iColumnIncrements)
clsRFunction.AddParameter("max_rows", intRowIncrements)
clsRFunction.AddParameter("start_row", _iRowStart)
clsRFunction.AddParameter("start_col", _iColumnStart)
clsRFunction.AddParameter("data_name", Chr(34) & _strDataFrameName & Chr(34))
expTemp = _clsRLink.RunInternalScriptGetValue(clsRFunction.ToScript(), bSilent:=True)
clsGetDataFrameRFunction.SetRCommand(_clsRLink.strInstatDataObject & "$get_data_frame")
clsGetDataFrameRFunction.AddParameter("convert_to_character", "TRUE")
clsGetDataFrameRFunction.AddParameter("use_current_filter", "TRUE")
clsGetDataFrameRFunction.AddParameter("use_column_selection", "TRUE")
clsGetDataFrameRFunction.AddParameter("max_cols", iColumnIncrements)
clsGetDataFrameRFunction.AddParameter("max_rows", intRowIncrements)
clsGetDataFrameRFunction.AddParameter("start_row", _iRowStart)
clsGetDataFrameRFunction.AddParameter("start_col", _iColumnStart)
clsGetDataFrameRFunction.AddParameter("data_name", Chr(34) & _strDataFrameName & Chr(34))
expTemp = _clsRLink.RunInternalScriptGetValue(clsGetDataFrameRFunction.ToScript(), bSilent:=True)
If expTemp IsNot Nothing AndAlso expTemp.Type <> Internals.SymbolicExpressionType.Null Then
Return expTemp.AsDataFrame
Else
Expand Down
36 changes: 36 additions & 0 deletions instat/Model/RCommand/clsPrepareFunctionsForGrids.vb
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,26 @@ Public Class clsPrepareFunctionsForGrids
End If
_RLink.RunScript(clsConvertToNumeric.ToScript(), strComment:="Right click menu: Convert Column(s) To Numeric")
End Sub

''' <summary>
''' Check if the column factor contains labels.
''' </summary>
Public Function CheckHasLabels(strColumnName As String) As Boolean
Dim clsColmnLabelsRFunction = New RFunction
Dim clsGetColumnsFromData As New RFunction

clsGetColumnsFromData.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_columns_from_data")
clsGetColumnsFromData.AddParameter("data_name", Chr(34) & _strDataFrame & Chr(34), iPosition:=0)
clsGetColumnsFromData.AddParameter("col_names", Chr(34) & strColumnName & Chr(34), iPosition:=1)
clsGetColumnsFromData.AddParameter("use_current_filter", "FALSE", iPosition:=2)

clsColmnLabelsRFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$has_labels")
clsColmnLabelsRFunction.AddParameter("data_name", Chr(34) & _strDataFrame & Chr(34), iPosition:=0)
clsColmnLabelsRFunction.AddParameter("col_names", clsRFunctionParameter:=clsGetColumnsFromData, iPosition:=1)

Return frmMain.clsRLink.RunInternalScriptGetValue(clsColmnLabelsRFunction.ToScript(), bSilent:=True).AsLogical(0)
End Function

''' <summary>
''' View dataframe the whole dataframe within a pop up
''' </summary>
Expand Down Expand Up @@ -312,6 +332,7 @@ Public Class clsPrepareFunctionsForGrids
End If
_RLink.RunScript(clsReplaceValue.ToScript(), strComment:="Replace Value In Data")
End Sub

''' <summary>
''' Get the column type for a given column
''' </summary>
Expand All @@ -321,5 +342,20 @@ Public Class clsPrepareFunctionsForGrids
Return _RLink.GetColumnType(_strDataFrame, strColumnName)
End Function

''' <summary>
''' Description: To Delete one or many cells
''' the delete cell function is to be used to Replace selected values with NA
''' in the dataframe.
'''</summary>
''' <param name="lstColumnNames"></param>
''' <param name="lstRowNames"></param>
Public Sub DeleteCells(lstRowNames As List(Of String), lstColumnNames As List(Of String))
Dim clsDeleteCells As New RFunction
clsDeleteCells.SetRCommand(_RLink.strInstatDataObject & "$replace_values_with_NA")
clsDeleteCells.AddParameter("data_name", Chr(34) & _strDataFrame & Chr(34))
clsDeleteCells.AddParameter("column_index", _RLink.GetListAsRString(lstColumnNames, bWithQuotes:=False))
clsDeleteCells.AddParameter("row_index", _RLink.GetListAsRString(lstRowNames, bWithQuotes:=False))
_RLink.RunScript(clsDeleteCells.ToScript(), strComment:="Right click menu: Delete Cell(s)")
End Sub
End Class

2 changes: 1 addition & 1 deletion instat/My Project/Application.Designer.vb

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

2 changes: 1 addition & 1 deletion instat/My Project/Application.myapp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MySubMain>true</MySubMain>
<MainForm>frmMain</MainForm>
<SingleInstance>true</SingleInstance>
<SingleInstance>false</SingleInstance>
<ShutdownMode>0</ShutdownMode>
<EnableVisualStyles>true</EnableVisualStyles>
<AuthenticationMode>0</AuthenticationMode>
Expand Down
Binary file added instat/Resources/upward-arrow1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 1 addition & 13 deletions instat/UcrGeomListWithAes.designer.vb

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

Loading

0 comments on commit 4cd396c

Please sign in to comment.