Index: Core/Common/src/Core.Common.Controls.TreeView/TreeNodeInfo.cs
===================================================================
diff -u -rf5fba362fd622350af428420089c20f80f218b78 -r20f311390d1e8daa85500e8f031d11e9f0f5d9f4
--- Core/Common/src/Core.Common.Controls.TreeView/TreeNodeInfo.cs (.../TreeNodeInfo.cs) (revision f5fba362fd622350af428420089c20f80f218b78)
+++ Core/Common/src/Core.Common.Controls.TreeView/TreeNodeInfo.cs (.../TreeNodeInfo.cs) (revision 20f311390d1e8daa85500e8f031d11e9f0f5d9f4)
@@ -137,20 +137,20 @@
///
/// Gets or sets a function for checking whether or not the tree node can be dropped to another location.
- /// The first parameter represents the tree node which is dragged.
- /// The second parameter represents the tree node being considered as drop target.
+ /// The first object parameter represents the data of the tree node which is dragged.
+ /// The second object parameter represents the data of the tree node being considered as drop target.
/// The parameter represents the supported drop operations for the tree node which is dragged.
/// The return value indicates what operation is valid when the tree node is dropped onto the drop target.
///
/// When dragging a node, the function of the of the drop target should be called.
- public Func CanDrop { get; set; }
+ public Func CanDrop { get; set; }
///
/// Gets or sets a function for checking whether or not the tree node can be inserted into the drop target at a specific index.
- /// The first parameter represents the tree node which is dragged.
- /// The second parameter represents the tree node being considered as drop target.
+ /// The first object parameter represents the data of the tree node which is dragged.
+ /// The second object parameter represents the data of the tree node being considered as drop target.
///
- public Func CanInsert { get; set; }
+ public Func CanInsert { get; set; }
///
/// Gets or sets an action for obtaining the logic to perform after dropping a tree node.
@@ -282,20 +282,20 @@
///
/// Gets or sets a function for checking whether or not the tree node can be dropped to another location.
- /// The first parameter represents the tree node which is dragged.
- /// The second parameter represents the tree node being considered as drop target.
+ /// The first object parameter represents the data of the tree node which is dragged.
+ /// The second object parameter represents the data of the tree node being considered as drop target.
/// The parameter represents the supported drop operations for the tree node which is dragged.
/// The return value indicates what operation is valid when the tree node is dropped onto the drop target.
///
/// When dragging a node, the function of the of the drop target should be called.
- public Func CanDrop { get; set; }
+ public Func CanDrop { get; set; }
///
/// Gets or sets a function for checking whether or not the tree node can be inserted into the drop target at a specific index.
- /// The first parameter represents the tree node which is dragged.
- /// The second parameter represents the tree node being considered as drop target.
+ /// The first object parameter represents the data of the tree node which is dragged.
+ /// The second object parameter represents the data of the tree node being considered as drop target.
///
- public Func CanInsert { get; set; }
+ public Func CanInsert { get; set; }
///
/// Gets or sets an action for obtaining the logic to perform after dropping a tree node.
@@ -360,11 +360,11 @@
? (tag, parentTag) => treeNodeInfo.CanDrag((TData) tag, parentTag)
: (Func) null,
CanDrop = treeNodeInfo.CanDrop != null
- ? (sourceNode, targetNode, dragOperations) => treeNodeInfo.CanDrop(sourceNode, targetNode, dragOperations)
- : (Func) null,
+ ? (draggedTag, targetTag, dragOperations) => treeNodeInfo.CanDrop(draggedTag, targetTag, dragOperations)
+ : (Func) null,
CanInsert = treeNodeInfo.CanInsert != null
- ? (sourceNode, targetNode) => treeNodeInfo.CanInsert(sourceNode, targetNode)
- : (Func) null,
+ ? (draggedTag, targetTag) => treeNodeInfo.CanInsert(draggedTag, targetTag)
+ : (Func) null,
OnDrop = treeNodeInfo.OnDrop != null
? (sourceNode, targetNode, dragOperations, index) => treeNodeInfo.OnDrop(sourceNode, targetNode, dragOperations, index)
: (Action) null,
Index: Core/Common/src/Core.Common.Controls.TreeView/TreeViewControl.cs
===================================================================
diff -u -rf5fba362fd622350af428420089c20f80f218b78 -r20f311390d1e8daa85500e8f031d11e9f0f5d9f4
--- Core/Common/src/Core.Common.Controls.TreeView/TreeViewControl.cs (.../TreeViewControl.cs) (revision f5fba362fd622350af428420089c20f80f218b78)
+++ Core/Common/src/Core.Common.Controls.TreeView/TreeViewControl.cs (.../TreeViewControl.cs) (revision 20f311390d1e8daa85500e8f031d11e9f0f5d9f4)
@@ -805,7 +805,7 @@
var treeNodeInfo = GetTreeNodeInfoForData(nodeDropTarget.Tag);
DragOperations allowedOperations = treeNodeInfo.CanDrop != null
- ? treeNodeInfo.CanDrop(nodeDragging, nodeDropTarget, ToDragOperation(e.AllowedEffect))
+ ? treeNodeInfo.CanDrop(nodeDragging.Tag, nodeDropTarget.Tag, ToDragOperation(e.AllowedEffect))
: DragOperations.None;
e.Effect = ToDragDropEffects(allowedOperations);
@@ -818,7 +818,7 @@
// Determine whether ot not the node can be dropped based on the allowed operations.
// A node can also be a valid drop traget if it is the root item (nodeDragging.Parent == null).
var dragOperations = treeNodeInfo.CanDrop != null
- ? treeNodeInfo.CanDrop(nodeDragging, nodeDropTarget, allowedOperations)
+ ? treeNodeInfo.CanDrop(nodeDragging.Tag, nodeDropTarget.Tag, allowedOperations)
: DragOperations.None;
if (DragOperations.None != dragOperations)
@@ -961,7 +961,7 @@
if (nodeOver.Parent != null)
{
var treeNodeInfo = GetTreeNodeInfoForData(nodeOver.Parent.Tag);
- if (treeNodeInfo.CanInsert != null && treeNodeInfo.CanInsert(nodeDragging, nodeOver))
+ if (treeNodeInfo.CanInsert != null && treeNodeInfo.CanInsert(nodeDragging.Tag, nodeOver.Tag))
{
nodeDropTarget = nodeOver.Parent;
dropAtLocation = nodeOver.Parent == null ? 0 : nodeOver.Parent.Nodes.IndexOf(nodeOver);
@@ -985,7 +985,7 @@
nodeDragging.PrevNode != nodeOver)
{
var treeNodeInfo = GetTreeNodeInfoForData(nodeOver.Parent.Tag);
- if (treeNodeInfo.CanInsert != null && treeNodeInfo.CanInsert(nodeDragging, nodeOver))
+ if (treeNodeInfo.CanInsert != null && treeNodeInfo.CanInsert(nodeDragging.Tag, nodeOver.Tag))
{
nodeDropTarget = nodeOver.Parent;
dropAtLocation = nodeOver.Parent == null
Index: Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendView.cs
===================================================================
diff -u -rf5fba362fd622350af428420089c20f80f218b78 -r20f311390d1e8daa85500e8f031d11e9f0f5d9f4
--- Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendView.cs (.../LegendView.cs) (revision f5fba362fd622350af428420089c20f80f218b78)
+++ Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendView.cs (.../LegendView.cs) (revision 20f311390d1e8daa85500e8f031d11e9f0f5d9f4)
@@ -149,19 +149,19 @@
# region ChartDataCollection
- private DragOperations BaseChartCanDrop(TreeNode sourceNode, TreeNode targetNode, DragOperations validOperations)
+ private DragOperations BaseChartCanDrop(object draggedData, object targetData, DragOperations validOperations)
{
- if (sourceNode.Tag is ChartData)
+ if (draggedData is ChartData)
{
return validOperations;
}
return DragOperations.None;
}
- private bool BaseChartCanInsert(TreeNode sourceNode, TreeNode targetNode)
+ private bool BaseChartCanInsert(object draggedData, object targetData)
{
- return sourceNode.Tag is ChartData;
+ return draggedData is ChartData;
}
private void BaseChartOnDrop(TreeNode sourceNode, TreeNode previousParentNode, DragOperations operation, int position)
Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartDataCollectionTreeNodeInfoTest.cs
===================================================================
diff -u -rd8ca552454f8c1bf36269890b70f104c810fbf7f -r20f311390d1e8daa85500e8f031d11e9f0f5d9f4
--- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartDataCollectionTreeNodeInfoTest.cs (.../ChartDataCollectionTreeNodeInfoTest.cs) (revision d8ca552454f8c1bf36269890b70f104c810fbf7f)
+++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartDataCollectionTreeNodeInfoTest.cs (.../ChartDataCollectionTreeNodeInfoTest.cs) (revision 20f311390d1e8daa85500e8f031d11e9f0f5d9f4)
@@ -118,16 +118,11 @@
{
// Setup
var chartDataCollection = mocks.StrictMock(new List());
- var targetNode = new TreeNode
- {
- Tag = chartDataCollection
- };
- var sourceNode = new TreeNode { Tag = new object() };
mocks.ReplayAll();
// Call
- var validOperations = info.CanDrop(sourceNode, targetNode, validDragOperations);
+ var validOperations = info.CanDrop(new object(), chartDataCollection, validDragOperations);
// Assert
Assert.AreEqual(DragOperations.None, validOperations);
@@ -143,16 +138,11 @@
// Setup
var chartData = mocks.StrictMock();
var chartDataCollection = mocks.StrictMock(new List());
- var targetNode = new TreeNode
- {
- Tag = chartDataCollection
- };
- var sourceNode = new TreeNode { Tag = chartData };
mocks.ReplayAll();
// Call
- var validOperations = info.CanDrop(sourceNode, targetNode, validDragOperations);
+ var validOperations = info.CanDrop(chartData, chartDataCollection, validDragOperations);
// Assert
Assert.AreEqual(validDragOperations, validOperations);
@@ -165,16 +155,11 @@
{
// Setup
var chartDataCollection = mocks.StrictMock(new List());
- var targetNode = new TreeNode
- {
- Tag = chartDataCollection
- };
- var sourceNode = new TreeNode { Tag = new object() };
mocks.ReplayAll();
// Call
- var canInsert = info.CanInsert(sourceNode, targetNode);
+ var canInsert = info.CanInsert(new object(), chartDataCollection);
// Assert
Assert.IsFalse(canInsert);
@@ -188,16 +173,11 @@
// Setup
var chartData = mocks.StrictMock();
var chartDataCollection = mocks.StrictMock(new List());
- var targetNode = new TreeNode
- {
- Tag = chartDataCollection
- };
- var sourceNode = new TreeNode { Tag = chartData };
mocks.ReplayAll();
// Call
- var canInsert = info.CanInsert(sourceNode, targetNode);
+ var canInsert = info.CanInsert(chartData, chartDataCollection);
// Assert
Assert.IsTrue(canInsert);
Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs
===================================================================
diff -u -r95487d39e17289b2a656e34d85b808186222c0ee -r20f311390d1e8daa85500e8f031d11e9f0f5d9f4
--- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision 95487d39e17289b2a656e34d85b808186222c0ee)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision 20f311390d1e8daa85500e8f031d11e9f0f5d9f4)
@@ -701,9 +701,9 @@
return DragOperations.Move;
}
- private DragOperations PipingCalculationGroupContextCanDrop(TreeNode sourceNode, TreeNode targetNode, DragOperations validOperations)
+ private DragOperations PipingCalculationGroupContextCanDrop(object draggedData, object targetData, DragOperations validOperations)
{
- if (GetAsIPipingCalculationItem(sourceNode.Tag) != null && NodesHaveSameParentFailureMechanism(sourceNode, targetNode))
+ if (GetAsIPipingCalculationItem(draggedData) != null && NodesHaveSameParentFailureMechanism(draggedData, targetData))
{
return validOperations;
}
@@ -728,23 +728,23 @@
return null;
}
- private bool NodesHaveSameParentFailureMechanism(TreeNode sourceNode, TreeNode targetNode)
+ private bool NodesHaveSameParentFailureMechanism(object draggedData, object targetData)
{
- var sourceFailureMechanism = GetParentFailureMechanism(sourceNode);
- var targetFailureMechanism = GetParentFailureMechanism(targetNode);
+ var sourceFailureMechanism = GetParentFailureMechanism(draggedData);
+ var targetFailureMechanism = GetParentFailureMechanism(targetData);
return ReferenceEquals(sourceFailureMechanism, targetFailureMechanism);
}
- private static PipingFailureMechanism GetParentFailureMechanism(TreeNode sourceNode)
+ private static PipingFailureMechanism GetParentFailureMechanism(object data)
{
- var calculationContext = sourceNode.Tag as PipingCalculationContext;
+ var calculationContext = data as PipingCalculationContext;
if (calculationContext != null)
{
return calculationContext.PipingFailureMechanism;
}
- var groupContext = sourceNode.Tag as PipingCalculationGroupContext;
+ var groupContext = data as PipingCalculationGroupContext;
if (groupContext != null)
{
return groupContext.PipingFailureMechanism;
@@ -753,9 +753,9 @@
return null;
}
- private bool PipingCalculationGroupContextCanInsert(TreeNode sourceNode, TreeNode targetNode)
+ private bool PipingCalculationGroupContextCanInsert(object draggedData, object targetData)
{
- return GetAsIPipingCalculationItem(sourceNode.Tag) != null && NodesHaveSameParentFailureMechanism(sourceNode, targetNode);
+ return GetAsIPipingCalculationItem(draggedData) != null && NodesHaveSameParentFailureMechanism(draggedData, targetData);
}
private void PipingCalculationGroupContextOnDrop(TreeNode sourceNode, TreeNode previousParentNode, DragOperations operation, int position)
Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs
===================================================================
diff -u -r95487d39e17289b2a656e34d85b808186222c0ee -r20f311390d1e8daa85500e8f031d11e9f0f5d9f4
--- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs (.../PipingCalculationGroupContextTreeNodeInfoTest.cs) (revision 95487d39e17289b2a656e34d85b808186222c0ee)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs (.../PipingCalculationGroupContextTreeNodeInfoTest.cs) (revision 20f311390d1e8daa85500e8f031d11e9f0f5d9f4)
@@ -135,36 +135,18 @@
failureMechanism.CalculationsGroup.Children.Add(draggedItem);
failureMechanism.CalculationsGroup.Children.Add(targetGroup);
- #region Mock node tree for source and target in same failure mechanism
-
- var failureMechanismNode = mocks.Stub();
- failureMechanismNode.Tag = failureMechanism;
-
- var failureMechanismGroupNode = mocks.Stub();
- failureMechanismGroupNode.Tag = failureMechanism.CalculationsGroup;
-
- var calculationNode = mocks.Stub();
- calculationNode.Tag = draggedItemContext;
-
- var targetGroupNode = mocks.Stub();
- targetGroupNode.Tag = targetGroupContext;
-
- #endregion
-
- mocks.ReplayAll();
-
switch (methodToTest)
{
case DragDropTestMethod.CanDrop:
// Call
- DragOperations supportedOperations = info.CanDrop(calculationNode, targetGroupNode, DragOperations.Move);
+ DragOperations supportedOperations = info.CanDrop(draggedItemContext, targetGroupContext, DragOperations.Move);
// Assert
Assert.AreEqual(DragOperations.Move, supportedOperations);
break;
case DragDropTestMethod.CanInsert:
// Call
- bool canInsert = info.CanInsert(calculationNode, targetGroupNode);
+ bool canInsert = info.CanInsert(draggedItemContext, targetGroupContext);
// Assert
Assert.IsTrue(canInsert);
@@ -199,46 +181,18 @@
targetFailureMechanism.CalculationsGroup.Children.Add(targetGroup);
- #region Mock node tree for source IPipingCalculationItem
-
- var sourceFailureMechanismNode = mocks.Stub();
- sourceFailureMechanismNode.Tag = sourceFailureMechanism;
-
- var sourceFailureMechanismGroupNode = mocks.Stub();
- sourceFailureMechanismGroupNode.Tag = sourceFailureMechanism.CalculationsGroup;
-
- var calculationNode = mocks.Stub();
- calculationNode.Tag = draggedItemContext;
-
- #endregion
-
- #region Mock node tree for target PipingCalculationGroup
-
- var targetFailureMechanismNode = mocks.Stub();
- targetFailureMechanismNode.Tag = targetFailureMechanism;
-
- var targetFailureMechanismGroupNode = mocks.Stub();
- targetFailureMechanismGroupNode.Tag = targetFailureMechanism.CalculationsGroup;
-
- var groupNode = mocks.Stub();
- groupNode.Tag = targetGroupContext;
-
- #endregion
-
- mocks.ReplayAll();
-
switch (methodToTest)
{
case DragDropTestMethod.CanDrop:
// Call
- DragOperations supportedOperations = info.CanDrop(calculationNode, groupNode, DragOperations.Move);
+ DragOperations supportedOperations = info.CanDrop(draggedItemContext, targetGroupContext, DragOperations.Move);
// Assert
Assert.AreEqual(DragOperations.None, supportedOperations);
break;
case DragDropTestMethod.CanInsert:
// Call
- bool canInsert = info.CanInsert(calculationNode, groupNode);
+ bool canInsert = info.CanInsert(draggedItemContext, targetGroupContext);
// Assert
Assert.IsFalse(canInsert);