using System;
using System.Collections;
using System.ComponentModel;
using System.Linq;
using System.Windows.Forms;
using Core.Common.Controls;
using Core.Common.Controls.Swf.TreeViewControls;
using Core.Common.Gui;
using Core.Common.Utils.Collections;
using Ringtoets.Common.Forms.Properties;
namespace Ringtoets.Common.Forms.NodePresenters
{
///
/// Implements in a featureless way as possible,
/// to serve as a base class for all node presenters.
///
/// The data object class corresponding with the node.
public abstract class RingtoetsNodePresenterBase : ITreeNodePresenter
{
protected readonly IContextMenuBuilderProvider contextMenuBuilderProvider;
///
/// Creates a new instance of , which uses the
/// to create and bind its .
///
/// The
/// to use for building a .
/// Thrown when no was provided.
public RingtoetsNodePresenterBase(IContextMenuBuilderProvider contextMenuBuilderProvider)
{
if (contextMenuBuilderProvider == null)
{
throw new ArgumentNullException("contextMenuBuilderProvider", Core.Common.Gui.Properties.Resources.NodePresenter_ContextMenuBuilderProvider_required);
}
this.contextMenuBuilderProvider = contextMenuBuilderProvider;
}
public ITreeView TreeView { get; set; }
public Type NodeTagType
{
get
{
return typeof(T);
}
}
public void UpdateNode(ITreeNode parentNode, ITreeNode node, object nodeData)
{
UpdateNode(parentNode, node, (T)nodeData);
}
public IEnumerable GetChildNodeObjects(object parentNodeData)
{
return GetChildNodeObjects((T)parentNodeData).Cast