using System;
using Ironring.MMC.Nodes;
using Ironring.MMC.Core;
using System.Collections;
namespace MMCTest2{
public class TestNode : ReportNode
{
public static ResultViewColumn col1 = new ResultViewColumn("Name", (int)ColumnHeaderFormat.LEFT, 100);
BaseNode node1,node2;
public TestNode(SnapinBase snapin, String displayName, String closedIco, String openIco) : base(snapin, displayName, closedIco, openIco)
{
node1 = new BaseNode(Snapin,"test1","","");
node2 = new BaseNode(Snapin,"test2","","");
this.MultiSelectMode = true;
this.AddChild(node1);
this.AddChild(node2);
}
public override ArrayList Items
{
get
{
ArrayList items = new ArrayList();
for(int i=0;i<5;i++)
items.Add(new ResultViewItem(this.Snapin,this,i.ToString()));
return items;
}
}
public override ArrayList Columns
{
get
{
ArrayList a = new ArrayList();
a.Add(col1);
return a;
}
}
public override ArrayList Menus
{
get
{
ArrayList l = new ArrayList(1);
l.Add(new MenuItem("remove subnodes", "remove the child nodes", new MenuCommandHandler(deleteHandler)));
l.Add(new MenuItem("add subnodes", "add some child nodes", new MenuCommandHandler(addHandler)));
return l;
}
}
private void deleteHandler(object o, BaseNode node)
{
node1.Remove(false);
node2.Remove(false);
//m_ChildNodes.Clear();
Snapin.SelectScopeNode(this);
}
private void addHandler(object o, BaseNode node)
{
this.AddChild(new BaseNode(Snapin, "a", "", ""));
this.AddChild(new BaseNode(Snapin, "b", "", ""));
this.AddChild(new BaseNode(Snapin, "c", "", ""));
InsertChildren();
}
public override string GetResultViewType(ref int pViewOptions)
{
string returnValue = base.GetResultViewType(ref pViewOptions);
pViewOptions |= (int)MMC_VIEW_OPTIONS.EXCLUDE_SCOPE_ITEMS_FROM_LIST;
return returnValue;
}
public override string ResultViewSmallImage
{
get
{
return "MMCTest2.images.snapin.Ico";
}
}
public override string ResultViewLargeImage
{
get
{
return "MMCTest2.images.snapin.Ico";
}
}
}
}
|