Skip to content

Commit 09ee7a1

Browse files
author
samatrhea
committed
[Add] item detailsbox in a collapsable group
[Add] mouse click handler to show details of a column item in the RelationshipMatrix
1 parent 200a91d commit 09ee7a1

9 files changed

Lines changed: 375 additions & 218 deletions

File tree

CDP4IME/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,5 @@
4747
// You can specify all the values or you can default the Build and Revision Numbers
4848
// by using the '*' as shown below:
4949
// [assembly: AssemblyVersion("1.0.*")]
50-
[assembly: AssemblyVersion("4.0.2.0")]
51-
[assembly: AssemblyFileVersion("4.0.2.0")]
50+
[assembly: AssemblyVersion("4.0.3.0")]
51+
[assembly: AssemblyFileVersion("4.0.3.0")]

CDP4IMEInstaller/Product.wxs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
33

4-
<Product Id="*" Name="CDP4-CE" Language="1033" Version="4.0.2.0" Manufacturer="RHEA System S.A." UpgradeCode="83b3da1e-4a38-40f0-b2a6-5f58b32238a4">
4+
<Product Id="*" Name="CDP4-CE" Language="1033" Version="4.0.3.0" Manufacturer="RHEA System S.A." UpgradeCode="83b3da1e-4a38-40f0-b2a6-5f58b32238a4">
55

66
<?include variables.wxi ?>
77

RelationshipMatrix/CDP4RelationshipMatrix.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,11 @@
207207
<Compile Include="Behaviour\CellSelectionBehavior.cs" />
208208
<Compile Include="Behaviour\TableViewMenuBehavior.cs" />
209209
<Compile Include="Converters\BooleanToHighlightConverter.cs" />
210+
<Compile Include="Converters\PreviewMouseDownArgsConverter.cs" />
210211
<Compile Include="Converters\TooltipConverter.cs" />
211212
<Compile Include="Converters\RowDoubleClickEventArgsConverter.cs" />
212213
<Compile Include="Converters\MarkupExtensionBase.cs" />
214+
<Compile Include="DataTypes\MatrixAddress.cs" />
213215
<Compile Include="Settings\CategoryBooleanOperatorKind.cs" />
214216
<Compile Include="Settings\SortOrder.cs" />
215217
<Compile Include="Settings\DisplayKind.cs" />
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// -------------------------------------------------------------------------------------------------
2+
// <copyright file="PreviewMouseDownArgsConverter.cs" company="RHEA System S.A.">
3+
// Copyright (c) 2015-2019 RHEA System S.A.
4+
// </copyright>
5+
// -------------------------------------------------------------------------------------------------
6+
7+
namespace CDP4RelationshipMatrix.Converters
8+
{
9+
using System.Windows;
10+
using System.Windows.Input;
11+
using CDP4RelationshipMatrix.DataTypes;
12+
using DevExpress.Mvvm.UI;
13+
using DevExpress.Xpf.Grid;
14+
15+
/// <summary>
16+
/// Converter for double click events in datagrid cells.
17+
/// </summary>
18+
public class PreviewMouseDownArgsConverter : MarkupExtensionBase, IEventArgsConverter
19+
{
20+
/// <summary>
21+
/// Converts the supplied arguments to an array of parameters describing the column.
22+
/// </summary>
23+
/// <param name="sender">The sender of the event</param>
24+
/// <param name="e">The event arguments.</param>
25+
/// <returns>An array of cell info objects.</returns>
26+
public object Convert(object sender, object e)
27+
{
28+
if (e is MouseButtonEventArgs args)
29+
{
30+
if (args.ChangedButton != MouseButton.Left)
31+
{
32+
return null;
33+
}
34+
35+
var tableView = (TableView)sender;
36+
var tableViewHitInfo = tableView.CalcHitInfo((DependencyObject)args.OriginalSource);
37+
38+
int? row = null;
39+
if (tableViewHitInfo.RowHandle != int.MinValue)
40+
{
41+
row = tableViewHitInfo.RowHandle;
42+
}
43+
44+
var matrixAddress = new MatrixAddress
45+
{
46+
Row = row,
47+
Column = tableViewHitInfo.Column != null ? tableViewHitInfo.Column.FieldName : string.Empty
48+
};
49+
50+
return matrixAddress;
51+
52+
}
53+
54+
return null;
55+
}
56+
}
57+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// -------------------------------------------------------------------------------------------------
2+
// <copyright file="MatrixAddress.cs" company="RHEA System S.A.">
3+
// Copyright (c) 2015-2019 RHEA System S.A.
4+
// </copyright>
5+
// -------------------------------------------------------------------------------------------------
6+
7+
namespace CDP4RelationshipMatrix.DataTypes
8+
{
9+
/// <summary>
10+
/// Represents a cell address of the matrix
11+
/// </summary>
12+
public class MatrixAddress
13+
{
14+
/// <summary>
15+
/// Represents the row identifier of an item in a matrix
16+
/// </summary>
17+
public int? Row;
18+
19+
/// <summary>
20+
/// Represents the column identifier if an item in a matrix
21+
/// </summary>
22+
public string Column;
23+
}
24+
}

RelationshipMatrix/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@
3838
// You can specify all the values or you can default the Build and Revision Numbers
3939
// by using the '*' as shown below:
4040
// [assembly: AssemblyVersion("1.0.*")]
41-
[assembly: AssemblyVersion("4.0.2.0")]
42-
[assembly: AssemblyFileVersion("4.0.2.0")]
41+
[assembly: AssemblyVersion("4.0.3.0")]
42+
[assembly: AssemblyFileVersion("4.0.3.0")]
4343
[assembly: InternalsVisibleTo("CDP4RelationshipMatrix.Tests")]

RelationshipMatrix/ViewModels/MatrixViewModel.cs

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ namespace CDP4RelationshipMatrix.ViewModels
1919
using CDP4Common.SiteDirectoryData;
2020
using CDP4Dal;
2121
using CDP4Dal.Operations;
22+
using CDP4RelationshipMatrix.DataTypes;
2223
using DevExpress.Xpf.Grid;
2324
using NLog;
2425
using ReactiveUI;
@@ -69,6 +70,11 @@ public class MatrixViewModel : ReactiveObject, IDisposable
6970
/// </summary>
7071
private string title;
7172

73+
/// <summary>
74+
/// Backing field for <see cref="SelectedItemDetails"/>
75+
/// </summary>
76+
private string selectedItemDetails;
77+
7278
/// <summary>
7379
/// Backing field for <see cref="SelectedCell"/>
7480
/// </summary>
@@ -154,9 +160,11 @@ public MatrixViewModel(ISession session, Iteration iteration, RelationshipMatrix
154160
this.ProcessCellCommand = ReactiveCommand.CreateAsyncTask(x => this.ProcessCellCommandExecute((List<object>) x), RxApp.MainThreadScheduler);
155161
this.ProcessAltCellCommand = ReactiveCommand.CreateAsyncTask(x => this.ProcessAltCellCommandExecute((List<object>)x), RxApp.MainThreadScheduler);
156162
this.ProcessAltControlCellCommand = ReactiveCommand.CreateAsyncTask(x => this.ProcessAltControlCellCommandExecute((List<object>)x), RxApp.MainThreadScheduler);
157-
158163
this.ToggleColumnHighlightCommand = ReactiveCommand.CreateAsyncTask(x => this.ToggleColumnHighlightCommandExecute(x as GridColumn), RxApp.MainThreadScheduler);
159164

165+
this.MouseDownCommand = ReactiveCommand.Create();
166+
this.MouseDownCommand.Subscribe(x => this.MouseDownCommandExecute((MatrixAddress) x));
167+
160168
this.SubscribeCommandExceptions();
161169

162170
this.WhenAnyValue(x => x.SelectedCell).Subscribe(_ => this.ComputeCommandCanExecute());
@@ -271,6 +279,11 @@ public bool IsVisibleDeleteAll
271279
/// </summary>
272280
public ReactiveCommand<Unit> ProcessAltControlCellCommand { get; private set; }
273281

282+
/// <summary>
283+
/// Gets the command to process the mousedown click.
284+
/// </summary>
285+
public ReactiveCommand<object> MouseDownCommand { get; private set; }
286+
274287
/// <summary>
275288
/// Gets the command to process column highlight toggle.
276289
/// </summary>
@@ -294,6 +307,15 @@ public string Title
294307
private set { this.RaiseAndSetIfChanged(ref this.title, value); }
295308
}
296309

310+
/// <summary>
311+
/// Gets or sets the string that represents the details of the selected item
312+
/// </summary>
313+
public string SelectedItemDetails
314+
{
315+
get { return this.selectedItemDetails; }
316+
private set { this.RaiseAndSetIfChanged(ref this.selectedItemDetails, value); }
317+
}
318+
297319
/// <summary>
298320
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
299321
/// </summary>
@@ -502,7 +524,7 @@ private IList<ColumnDefinition> CreateColumns(IReadOnlyList<DefinedThing> source
502524
if (showRelatedOnly && !relationships.Any(x =>
503525
x.Source.Iid.Equals(definedThing.Iid) || x.Target.Iid.Equals(definedThing.Iid)))
504526
{
505-
// if thing is ont in any relationships, skip
527+
// if thing is not in any relationships, skip
506528
continue;
507529
}
508530

@@ -740,6 +762,11 @@ private void ComputeCommandCanExecute()
740762
/// <param name="cellInfo">The array of cell information.</param>
741763
private async Task ProcessCellCommandExecute(List<object> cellInfo)
742764
{
765+
if (cellInfo == null)
766+
{
767+
return;
768+
}
769+
743770
// if not a relationship cell do nothing
744771
if (cellInfo[1] == null || cellInfo[1].Equals(CDP4_NAME_HEADER))
745772
{
@@ -766,6 +793,11 @@ private async Task ProcessCellCommandExecute(List<object> cellInfo)
766793
/// <param name="cellInfo">The array of cell information.</param>
767794
private async Task ProcessAltCellCommandExecute(List<object> cellInfo)
768795
{
796+
if (cellInfo == null)
797+
{
798+
return;
799+
}
800+
769801
if (cellInfo[1] == null || cellInfo[1].Equals(CDP4_NAME_HEADER))
770802
{
771803
return;
@@ -791,6 +823,11 @@ private async Task ProcessAltCellCommandExecute(List<object> cellInfo)
791823
/// <param name="cellInfo">The array of cell information.</param>
792824
private async Task ProcessAltControlCellCommandExecute(List<object> cellInfo)
793825
{
826+
if (cellInfo == null)
827+
{
828+
return;
829+
}
830+
794831
if (cellInfo[1] == null || cellInfo[1].Equals(CDP4_NAME_HEADER))
795832
{
796833
return;
@@ -818,6 +855,24 @@ private async Task ProcessAltControlCellCommandExecute(List<object> cellInfo)
818855
}
819856
}
820857

858+
/// <summary>
859+
/// Executes the <see cref="ProcessColumnCommand"/>
860+
/// </summary>
861+
/// <param name="matrixAddress">
862+
/// the address of the selected column
863+
/// </param>
864+
private void MouseDownCommandExecute(MatrixAddress matrixAddress)
865+
{
866+
if (matrixAddress == null)
867+
{
868+
this.SelectedItemDetails = string.Empty;
869+
return;
870+
}
871+
872+
var columnDefinition = this.Columns.SingleOrDefault(c => c.FieldName == matrixAddress.Column);
873+
this.SelectedItemDetails = columnDefinition?.ToolTip;
874+
}
875+
821876
/// <summary>
822877
/// Executes a toggle of column highlight command
823878
/// </summary>

0 commit comments

Comments
 (0)