Skip to content

Commit

Permalink
Merge pull request #37 from africanmathsinitiative/master
Browse files Browse the repository at this point in the history
updating master
  • Loading branch information
Vitalis95 authored Mar 7, 2022
2 parents ee90053 + a40534b commit 35092bf
Show file tree
Hide file tree
Showing 48 changed files with 1,596 additions and 452 deletions.
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
2 changes: 1 addition & 1 deletion instat/Model/DataFrame/clsDataFrameFilter.vb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Imports RDotNet
''' <summary>
''' Holds filter information for the dataframe
''' </summary>
Public Class clsDataFrameFilter
Public Class clsDataFrameFilterOrColumnSelection
Protected _strDataFrameName As String
Protected _RLink As RLink

Expand Down
4 changes: 2 additions & 2 deletions instat/Model/RCommand/clsPrepareFunctionsForGrids.vb
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,11 @@ Public Class clsPrepareFunctionsForGrids
Return _RLink.GetColumnType(_strDataFrame, strColumnName)
End Function

'' <summary>
''' <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>
'''</summary>
''' <param name="lstColumnNames"></param>
''' <param name="lstRowNames"></param>
Public Sub DeleteCells(lstRowNames As List(Of String), lstColumnNames As List(Of String))
Expand Down
11 changes: 4 additions & 7 deletions instat/UserControls/DataGrid/Linux/ucrDataViewLinuxGrid.vb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Public Class ucrDataViewLinuxGrid
Public Sub AddRowData(dataFrame As clsDataFrame) Implements IDataViewGrid.AddRowData
Dim dataGrid = GetDataGridFromSelectedTab()

If dataFrame.clsFilter.bFilterApplied Then
If dataFrame.clsFilterOrColumnSelection.bFilterApplied Then
dataGrid.RowHeadersDefaultCellStyle.ForeColor = Color.Red
Else
dataGrid.RowHeadersDefaultCellStyle.ForeColor = Color.DarkBlue
Expand Down Expand Up @@ -114,6 +114,9 @@ Public Class ucrDataViewLinuxGrid
If ctrlV Or shiftIns Then
RaiseEvent PasteValuesToDataframe()
End If
If e.KeyCode = Keys.Delete OrElse e.KeyCode = Keys.Back Then
RaiseEvent DeleteValueToDataframe()
End If
End Sub

Private Function GetCurrentDataFrameFocus() As clsDataFrame
Expand Down Expand Up @@ -143,10 +146,4 @@ Public Class ucrDataViewLinuxGrid
Private Sub tcTabs_SelectedIndexChanged(sender As Object, e As EventArgs) Handles tcTabs.SelectedIndexChanged
RaiseEvent WorksheetChanged()
End Sub
Private Sub DataGridView_BeforeCellKeyDown(sender As Object, e As KeyEventArgs)
If e.KeyCode = unvell.ReoGrid.Interaction.KeyCode.Delete OrElse e.KeyCode = unvell.ReoGrid.Interaction.KeyCode.Back Then
RaiseEvent DeleteValueToDataframe()
End If
End Sub

End Class
16 changes: 12 additions & 4 deletions instat/UserControls/DataGrid/Linux/ucrLinuxGrid.vb
Original file line number Diff line number Diff line change
Expand Up @@ -112,19 +112,27 @@ Public MustInherit Class ucrLinuxGrid
Public Function GetSelectedRows() As List(Of String) Implements IGrid.GetSelectedRows
Dim lstSelectedRows As New List(Of String)
Dim dataGrid = GetGrid(tcTabs.SelectedTab)
For Each row As DataGridViewRow In dataGrid.SelectedRows
lstSelectedRows.Add(row.HeaderCell.Value)
'For Each row As DataGridViewRow In dataGrid.SelectedRows
' lstSelectedRows.Add(row.HeaderCell.Value)
'Next
For i As Integer = 0 To dataGrid.GetCellCount(DataGridViewElementStates.Selected) - 1
lstSelectedRows.Add(dataGrid.SelectedCells(i).RowIndex.ToString + 1)
Next
lstSelectedRows = lstSelectedRows.Distinct.ToList
Return lstSelectedRows
End Function


Public Function GetSelectedColumnIndexes() As List(Of String) Implements IGrid.GetSelectedColumnIndexes
Dim lstSelectedColumnIndexes As New List(Of String)
Dim dataGrid = GetGrid(tcTabs.SelectedTab)
For Each column As DataGridViewColumn In dataGrid.SelectedColumns
lstSelectedColumnIndexes.Add(Column.HeaderCell.Value)
'For Each column As DataGridViewColumn In dataGrid.SelectedColumns
' lstSelectedColumnIndexes.Add(column.HeaderCell.Value)
'Next
For i As Integer = 0 To dataGrid.GetCellCount(DataGridViewElementStates.Selected) - 1
lstSelectedColumnIndexes.Add(dataGrid.SelectedCells(i).ColumnIndex.ToString + 1)
Next
lstSelectedColumnIndexes = lstSelectedColumnIndexes.Distinct.ToList
Return lstSelectedColumnIndexes
End Function

Expand Down
13 changes: 11 additions & 2 deletions instat/UserControls/DataGrid/ReoGrid/ucrDataViewReoGrid.vb
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,22 @@ Public Class ucrDataViewReoGrid
Public Event WorksheetChanged() Implements IDataViewGrid.WorksheetChanged

Public Event WorksheetRemoved(worksheet As clsWorksheetAdapter) Implements IDataViewGrid.WorksheetRemoved

Public Sub AddColumns(visiblePage As clsDataFramePage) Implements IDataViewGrid.AddColumns
Dim workSheetColumnHeader As ColumnHeader
Dim variableTextColour As Color

grdData.CurrentWorksheet.Columns = visiblePage.lstColumns.Count

If GetCurrentDataFrameFocus.clsFilterOrColumnSelection.bColumnSelectionApplied Then
variableTextColour = Color.Red
Else
variableTextColour = Color.DarkBlue
End If
For i = 0 To visiblePage.lstColumns.Count - 1
workSheetColumnHeader = grdData.CurrentWorksheet.ColumnHeaders(i)
workSheetColumnHeader.Text = visiblePage.lstColumns(i).strDisplayName
workSheetColumnHeader.TextColor = visiblePage.lstColumns(i).clsColour
workSheetColumnHeader.TextColor = variableTextColour
workSheetColumnHeader.Style.BackColor = visiblePage.lstColumns(i).clsBackGroundColour
Next
End Sub
Expand All @@ -53,7 +62,7 @@ Public Class ucrDataViewReoGrid
grdData.CurrentWorksheet.Rows = dataFrame.iDisplayedRowCount
UpdateWorksheetSettings(grdData.CurrentWorksheet)

If dataFrame.clsFilter.bFilterApplied Then
If dataFrame.clsFilterOrColumnSelection.bFilterApplied Then
textColour = Color.Red
Else
textColour = Color.DarkBlue
Expand Down
6 changes: 2 additions & 4 deletions instat/dlgCalculateTreatmentDifferences.Designer.vb

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

5 changes: 2 additions & 3 deletions instat/dlgClimaticDataEntry.Designer.vb

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

10 changes: 4 additions & 6 deletions instat/dlgCompareTreatmentLines.Designer.vb

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

44 changes: 22 additions & 22 deletions instat/dlgDeleteObjects.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/dlgDeleteObjects.vb
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ Public Class dlgDeleteObjects
ucrInputComboType.SetParameter(New RParameter("object_type", 2))
dctTypes.Add("Objects", Chr(34) & "object" & Chr(34))
dctTypes.Add("Filters", Chr(34) & "filter" & Chr(34))
dctTypes.Add("Column selections", Chr(34) & "column_selection" & Chr(34))
dctTypes.Add("Calculations", Chr(34) & "calculation" & Chr(34))
dctTypes.Add("Tables", Chr(34) & "table" & Chr(34))
dctTypes.Add("Graphs", Chr(34) & "graph" & Chr(34))
dctTypes.Add("Models", Chr(34) & "model" & Chr(34))
ucrInputComboType.SetItems(dctTypes)
ucrInputComboType.SetDropDownStyleAsNonEditable()

End Sub

Private Sub SetDefaults()
Expand Down
Loading

0 comments on commit 35092bf

Please sign in to comment.