Index: Ringtoets/Common/src/Ringtoets.Common.Forms/TreeNodeInfos/CalculationTreeNodeInfoFactory.cs
===================================================================
diff -u -reff17c44b14a8e6f3e6fb7ee123f967b552df6a2 -rc3031f6290e2975c6a136b4b9327ae7fbd64c6b1
--- Ringtoets/Common/src/Ringtoets.Common.Forms/TreeNodeInfos/CalculationTreeNodeInfoFactory.cs (.../CalculationTreeNodeInfoFactory.cs) (revision eff17c44b14a8e6f3e6fb7ee123f967b552df6a2)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/TreeNodeInfos/CalculationTreeNodeInfoFactory.cs (.../CalculationTreeNodeInfoFactory.cs) (revision c3031f6290e2975c6a136b4b9327ae7fbd64c6b1)
@@ -29,27 +29,25 @@
using Ringtoets.Common.Forms.Helpers;
using Ringtoets.Common.Forms.PresentationObjects;
using Ringtoets.Common.Forms.Properties;
-
using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources;
namespace Ringtoets.Common.Forms.TreeNodeInfos
{
///
- /// Factory for creating objects.
+ /// Factory for creating calculation related objects.
///
public static class CalculationTreeNodeInfoFactory
{
///
/// Creates a object for a calculation group context of the type .
///
/// The type of calculation group context to create a object for.
- /// The function for obtaining child node objects.
+ /// The function for obtaining the child node objects.
/// The function for obtaining the context menu strip.
/// The action to perform on removing a node.
/// A object.
public static TreeNodeInfo CreateCalculationGroupContextTreeNodeInfo(
- Func childNodeObjects,
+ Func childNodeObjects,
Func contextMenuStrip,
Action onNodeRemoved)
where TCalculationGroupContext : ICalculationContext
@@ -70,16 +68,16 @@
CanRemove = (context, parentData) => IsNestedGroup(parentData),
OnNodeRemoved = onNodeRemoved,
CanDrag = (context, parentData) => IsNestedGroup(parentData),
- CanInsert = CanDropOrInsert,
- CanDrop = CanDropOrInsert,
- OnDrop = OnDrop
+ CanInsert = CalculationGroupCanDropOrInsert,
+ CanDrop = CalculationGroupCanDropOrInsert,
+ OnDrop = CalculationGroupOnDrop
};
}
///
/// This method adds a context menu item for creating new calculation groups.
///
- /// The builder to add the context menu item too.
+ /// The builder to add the context menu item to.
/// The calculation group involved.
public static void AddCreateCalculationGroupItem(IContextMenuBuilder builder, CalculationGroup calculationGroup)
{
@@ -103,7 +101,7 @@
///
/// This method adds a context menu item for creating new calculations.
///
- /// The builder to add the context menu item too.
+ /// The builder to add the context menu item to.
/// The calculation group context involved.
/// The action for adding a calculation to the calculation group.
public static void AddCreateCalculationItem(IContextMenuBuilder builder, TCalculationGroupContext calculationGroupContext, Action addCalculation) where TCalculationGroupContext : ICalculationContext
@@ -117,18 +115,20 @@
builder.AddCustomItem(createCalculationItem);
}
+ # region Helper methods for CreateCalculationGroupContextTreeNodeInfo
+
private static bool IsNestedGroup(object parentData)
{
return parentData is ICalculationContext;
}
- private static bool CanDropOrInsert(object draggedData, object targetData)
+ private static bool CalculationGroupCanDropOrInsert(object draggedData, object targetData)
{
var calculationContext = draggedData as ICalculationContext;
- return calculationContext != null && ReferenceEquals(calculationContext.FailureMechanism, ((ICalculationContext)targetData).FailureMechanism);
+ return calculationContext != null && ReferenceEquals(calculationContext.FailureMechanism, ((ICalculationContext) targetData).FailureMechanism);
}
- private static void OnDrop(object droppedData, object newParentData, object oldParentData, int position, TreeViewControl treeViewControl)
+ private static void CalculationGroupOnDrop(object droppedData, object newParentData, object oldParentData, int position, TreeViewControl treeViewControl)
{
ICalculationBase calculationItem = ((ICalculationContext) droppedData).WrappedData;
var originalOwnerContext = oldParentData as ICalculationContext;
@@ -149,20 +149,20 @@
private static DroppingCalculationInContainerStrategy GetDragDropStrategy(bool isMoveWithinSameContainer, CalculationGroup sourceCalculationGroup, CalculationGroup targetCalculationGroup)
{
return isMoveWithinSameContainer
- ? (DroppingCalculationInContainerStrategy)new DroppingCalculationWithinSameContainer(sourceCalculationGroup, targetCalculationGroup)
- : new DroppingCalculationToNewContainer(sourceCalculationGroup, targetCalculationGroup);
+ ? (DroppingCalculationInContainerStrategy) new DroppingCalculationWithinSameContainer(sourceCalculationGroup, targetCalculationGroup)
+ : new DroppingCalculationToNewContainer(sourceCalculationGroup, targetCalculationGroup);
}
- #region Nested Types: DroppingPipingCalculationInContainerStrategy and implementations
+ # region Nested types: DroppingPipingCalculationInContainerStrategy and implementations
///
- /// Strategy pattern implementation for dealing with drag & dropping a
+ /// Strategy pattern implementation for dealing with drag and drop of a
/// onto data.
///
private abstract class DroppingCalculationInContainerStrategy
{
- private readonly CalculationGroup sourceCalculationGroup;
protected readonly CalculationGroup targetCalculationGroup;
+ private readonly CalculationGroup sourceCalculationGroup;
protected DroppingCalculationInContainerStrategy(CalculationGroup sourceCalculationGroup, CalculationGroup targetCalculationGroup)
{
@@ -171,7 +171,7 @@
}
///
- /// Perform the drag & drop operation.
+ /// Performs the drag and drop operation.
///
/// The dragged data.
/// The calculation item wrapped by .
@@ -207,32 +207,32 @@
///
/// Strategy implementation for rearranging the order of an
- /// within a through a drag & drop action.
+ /// within a through a drag and drop action.
///
private class DroppingCalculationWithinSameContainer : DroppingCalculationInContainerStrategy
{
///
/// Initializes a new instance of the class.
///
- /// The calculation group that is the target of the drag & drop operation.
+ /// The calculation group that is the target of the drag and drop operation.
/// The calculation group that is the original owner of the dragged item.
public DroppingCalculationWithinSameContainer(CalculationGroup sourceCalculationGroup, CalculationGroup targetCalculationGroup) :
- base(sourceCalculationGroup, targetCalculationGroup) { }
+ base(sourceCalculationGroup, targetCalculationGroup) {}
}
///
/// Strategy implementation for moving an from
- /// one to another using a drag & drop action.
+ /// one to another using a drag and drop action.
///
private class DroppingCalculationToNewContainer : DroppingCalculationInContainerStrategy
{
///
/// Initializes a new instance of the class.
///
/// The calculation group that is the original owner of the dragged item.
- /// The calculation group that is the target of the drag & drop operation.
+ /// The calculation group that is the target of the drag and drop operation.
public DroppingCalculationToNewContainer(CalculationGroup sourceCalculationGroup, CalculationGroup targetCalculationGroup) :
- base(sourceCalculationGroup, targetCalculationGroup) { }
+ base(sourceCalculationGroup, targetCalculationGroup) {}
public override void Execute(object draggedData, ICalculationBase calculationBase, int newPosition, TreeViewControl treeViewControl)
{
@@ -257,6 +257,8 @@
}
}
- #endregion
+ # endregion
+
+ # endregion
}
}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TreeNodeInfos/CalculationTreeNodeInfoFactoryTest.cs
===================================================================
diff -u -rab5256dd19a9824ee179ecce6d8561d1ab83e6e9 -rc3031f6290e2975c6a136b4b9327ae7fbd64c6b1
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TreeNodeInfos/CalculationTreeNodeInfoFactoryTest.cs (.../CalculationTreeNodeInfoFactoryTest.cs) (revision ab5256dd19a9824ee179ecce6d8561d1ab83e6e9)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TreeNodeInfos/CalculationTreeNodeInfoFactoryTest.cs (.../CalculationTreeNodeInfoFactoryTest.cs) (revision c3031f6290e2975c6a136b4b9327ae7fbd64c6b1)
@@ -38,6 +38,8 @@
[TestFixture]
public class CalculationTreeNodeInfoFactoryTest
{
+ # region CreateCalculationGroupContextTreeNodeInfo
+
[Test]
public void TextOfCalculationGroupContextTreeNodeInfo_Always_ReturnsWrappedDataName()
{
@@ -639,5 +641,7 @@
}
# endregion
+
+ # endregion
}
}
\ No newline at end of file