Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,9 @@ private void updateChart()

private void updateChart(IReadOnlyCollection<Curve> curvesToUpdate, bool refreshCurveData)
{
// Make sure binders for curves that were removed are pruned so that their axes are not considered when calculating diagram size
pruneCurves();

var diagramSize = View.GetDiagramSize();
using (new BatchUpdate(View))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,12 @@ public void RemoveAllOutputMappings()

public void UpdateUsedStateForSelection(bool used)
{
SetUsedState(_view.SelectedDescendantColumns, used);
SetUsedState(_view.SelectedColumns, used);
}

public void SelectedDataColumnsChanged()
{
updateDataSelection(_view.SelectedDescendantColumns);
updateDataSelection(_view.SelectedColumns);
}

public IReadOnlyList<DataColumn> GetAllUsedDataColumns()
Expand Down
13 changes: 4 additions & 9 deletions src/OSPSuite.Presentation/Views/Charts/IDataBrowserView.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using OSPSuite.Core.Chart;
using OSPSuite.Presentation.Presenters.Charts;

Expand All @@ -10,17 +9,13 @@ public interface IDataBrowserView : IView<IDataBrowserPresenter>, IViewWithColum
void BindTo(IEnumerable<DataColumnDTO> dataColumnDTOs);

/// <summary>
/// Returns all selected <see cref="DataColumnDTO"/>
/// Returns all selected <see cref="DataColumnDTO" />.
/// All DTOs from a group are returned when the group is selected
/// </summary>
IReadOnlyList<DataColumnDTO> SelectedColumns { get; }

/// <summary>
/// Returns all selected <see cref="DataColumnDTO"/> and their descendants.
/// </summary>
IReadOnlyList<DataColumnDTO> SelectedDescendantColumns { get; }
Comment on lines -18 to -20
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this option because I think we want the group rows to function as a multi select. In other words, if I select the 'Simulation' group and then I set the Used checkbox, all simulation outputs should be added. Selecting the group is the same as selecting all the rows of the group.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if you have multiple grouping? Does that work?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep. Group rows have negative row indexes. The extension method takes care of it all.


/// <summary>
/// sets the group row format of the gridView to the specified string.
/// sets the group row format of the gridView to the specified string.
/// </summary>
void SetGroupRowFormat(GridGroupRowFormats format);
}
Expand Down
8 changes: 2 additions & 6 deletions src/OSPSuite.UI/Views/Charts/DataBrowserView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,13 @@ private IGridViewColumn bind<T>(Expression<Func<DataColumnDTO, T>> propertyToBin
return column;
}

public IReadOnlyList<DataColumnDTO> SelectedColumns => dtoListFrom(gridView.GetSelectedRows());

public IReadOnlyList<DataColumnDTO> SelectedDescendantColumns => selectDescendentDataRows(gridView.GetSelectedRows());
public IReadOnlyList<DataColumnDTO> SelectedColumns => selectDescendantDataRows(gridView.GetSelectedRows());
public void SetGroupRowFormat(GridGroupRowFormats format)
{
gridView.GroupFormat = format.GetFormatString();
}

private IReadOnlyList<DataColumnDTO> dtoListFrom(IEnumerable<int> rowHandles) => rowHandles.Select(_gridViewBinder.ElementAt).ToList();

private IReadOnlyList<DataColumnDTO> selectDescendentDataRows(IEnumerable<int> selectedRowHandles)
private IReadOnlyList<DataColumnDTO> selectDescendantDataRows(IEnumerable<int> selectedRowHandles)
{
return selectedRowHandles.SelectMany(rowHandle => _gridViewBinder.SelectedItems(rowHandle)).ToList();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ protected override void Context()
base.Context();
sut.AddDataColumns(new[] {_column1, _column2,});
sut.UsedChanged += (o, e) => _usedStateChangedColumns = e.Columns;
A.CallTo(() => _view.SelectedDescendantColumns).Returns(new []{_allDataColumnDTOs[1]});
A.CallTo(() => _view.SelectedColumns).Returns(new []{_allDataColumnDTOs[1]});
}

protected override void Because()
Expand Down Expand Up @@ -278,7 +278,7 @@ protected override void Context()
base.Context();
sut.AddDataColumns(new[] {_column1, _column2,});
sut.SelectionChanged += (o,e) => _selectedColumns = e.Columns;
A.CallTo(() => _view.SelectedDescendantColumns).Returns(_allDataColumnDTOs);
A.CallTo(() => _view.SelectedColumns).Returns(_allDataColumnDTOs);
}

protected override void Because()
Expand Down
Loading