Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs
===================================================================
diff -u -r0c64d8a6c718c0aa67403a16c94dd0c10f862455 -r2750ecd900b9e34ba54bb96d233c464b82d7684c
--- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision 0c64d8a6c718c0aa67403a16c94dd0c10f862455)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision 2750ecd900b9e34ba54bb96d233c464b82d7684c)
@@ -25,7 +25,6 @@
using System.Linq;
using System.Windows.Forms;
using Core.Common.Controls.TreeView;
-using Core.Common.Gui;
using Core.Common.Gui.ContextMenu;
using Core.Common.Gui.Forms;
using Core.Common.Gui.Forms.ProgressDialog;
@@ -784,17 +783,17 @@
return GetAsIPipingCalculationItem(sourceNode.Tag) != null && NodesHaveSameParentFailureMechanism(sourceNode, targetNode);
}
- private void PipingCalculationGroupContextOnDrop(TreeNode sourceNode, TreeNode targetNode, DragOperations operation, int position)
+ private void PipingCalculationGroupContextOnDrop(TreeNode sourceNode, TreeNode previousParentNode, DragOperations operation, int position)
{
IPipingCalculationItem pipingCalculationItem = GetAsIPipingCalculationItem(sourceNode.Tag);
- var originalOwnerContext = sourceNode.Parent.Tag as PipingCalculationGroupContext;
- var target = targetNode.Tag as PipingCalculationGroupContext;
+ var originalOwnerContext = previousParentNode.Tag as PipingCalculationGroupContext;
+ var target = sourceNode.Parent.Tag as PipingCalculationGroupContext;
if (pipingCalculationItem != null && originalOwnerContext != null && target != null)
{
- var isMoveWithinSameContainer = ReferenceEquals(targetNode.Tag, originalOwnerContext);
+ var isMoveWithinSameContainer = ReferenceEquals(originalOwnerContext, target);
- DroppingPipingCalculationInContainerStrategy dropHandler = GetDragDropStrategy(isMoveWithinSameContainer, originalOwnerContext, target, (TreeView) targetNode.TreeView);
+ DroppingPipingCalculationInContainerStrategy dropHandler = GetDragDropStrategy(isMoveWithinSameContainer, originalOwnerContext, target, (TreeView) previousParentNode.TreeView);
dropHandler.Execute(sourceNode.Tag, pipingCalculationItem, position);
}
}
@@ -846,14 +845,9 @@
/// The index of the new position within the new owner's collection.
public virtual void Execute(object draggedDataObject, IPipingCalculationItem pipingCalculationItem, int newPosition)
{
- var targetRecordedNodeState = new TreeNodeExpandCollapseState(treeView.TreeViewController.GetNodeByTag(target));
-
MoveCalculationItemToNewOwner(pipingCalculationItem, newPosition);
NotifyObservers();
-
- TreeNode draggedNode = treeView.TreeViewController.GetNodeByTag(draggedDataObject);
- UpdateTreeView(draggedNode, targetRecordedNodeState);
}
///
@@ -875,30 +869,6 @@
{
originalOwnerContext.NotifyObservers();
}
-
- ///
- /// Updates the where the drag & drop
- /// operation took place.
- ///
- /// The dragged node.
- /// Recorded state of the target node
- /// before the drag & drop operation.
- protected virtual void UpdateTreeView(TreeNode draggedNode, TreeNodeExpandCollapseState targetRecordedNodeState)
- {
- HandlePostDragExpandCollapseOfNewOwner(draggedNode.Parent, targetRecordedNodeState);
- treeView.SelectedNode = draggedNode;
- }
-
- private static void HandlePostDragExpandCollapseOfNewOwner(TreeNode parentOfDraggedNode, TreeNodeExpandCollapseState newOwnerRecordedNodeState)
- {
- newOwnerRecordedNodeState.Restore(parentOfDraggedNode);
-
- // Expand parent of 'draggedNode' to ensure 'draggedNode' is visible.
- if (!parentOfDraggedNode.IsExpanded)
- {
- parentOfDraggedNode.Expand();
- }
- }
}
///
@@ -925,8 +895,6 @@
///
private class DroppingPipingCalculationToNewContainer : DroppingPipingCalculationInContainerStrategy
{
- private TreeNodeExpandCollapseState recordedNodeState;
-
private bool renamed;
///
@@ -942,23 +910,14 @@
public override void Execute(object draggedDataObject, IPipingCalculationItem pipingCalculationItem, int newPosition)
{
- var targetRecordedNodeState = new TreeNodeExpandCollapseState(treeView.TreeViewController.GetNodeByTag(target));
-
- recordedNodeState = new TreeNodeExpandCollapseState(treeView.TreeViewController.GetNodeByTag(draggedDataObject));
EnsureDraggedNodeHasUniqueNameInNewOwner(pipingCalculationItem, target);
MoveCalculationItemToNewOwner(pipingCalculationItem, newPosition);
NotifyObservers();
TreeNode draggedNode = treeView.TreeViewController.GetNodeByTag(draggedDataObject);
- UpdateTreeView(draggedNode, targetRecordedNodeState);
- }
- protected override void UpdateTreeView(TreeNode draggedNode, TreeNodeExpandCollapseState targetRecordedNodeState)
- {
- base.UpdateTreeView(draggedNode, targetRecordedNodeState);
- recordedNodeState.Restore(draggedNode);
if (renamed)
{
draggedNode.BeginEdit();