473,401 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

Can I use an array of Delagates for generic inheritence ?

I have a tree view object that I am trying to load via database calls. I'm
trying to make it generic so that I can extend and re-use it. One of the
things I want to be able to do is to load the child nodes on demand based on
the parent data (basically grouping sets of data objects by types and status
for clearer navigation).

When a user expands a node I want to call the appropriate method to get the
data. I have create a TreeViewLogic object to do all the node maintenance.
In my base class I don't know how many levels deep (it could be limitless
recursion) the tree will be so I was going to try and implement the
following approach for getting the node data.

1) base class declares a delegate called GetNodeData( node, args )
2) base class has an array of delegates GetNodeDatap[] _GetDataByLevel;
3) base class has method to point the level to a GetNodeData method
SetNodeLevelGetData(int level, GetNodeData getData)
{
_getDataMethods[level]+= new GetNodeData(getData);
}
4) the descendant class (say has three levels) can create three separate
GetNodeData methods for each level

GetNodeData1 (node, args) retrive using SP_1;
GetNodeData2 (node, args) retrive using SP_2 using parmsX, Y, Z;
GetNodeData3 (node, args) retrive using SP_3;

5) the descendant class registers its level retrieve method
SetNodeLevelGetData(1, GetNodeData1 );
SetNodeLevelGetData(2, GetNodeData2 );
SetNodeLevelGetData(3, GetNodeData3 );

6) when the node expands it calls the base class
public void GetNodeLevelData(UltraTreeNode parentNode)
{
// need logic if last level is recursive to call
_getDataMethods[UpperBound] or something.
_getDataMethods[parentNode.Level](parentNode,parentNode.GetArgs());
}

Is this methodolgy going to work? Is there a better mechanism for doing
this sort of thing?

thx

jack
Nov 16 '05 #1
0 1058

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

29
by: shmartonak | last post by:
For maximum portability what should the type of an array index be? Can any integer type be used safely? Or should I only use an unsigned type? Or what? If I'm using pointers to access array...
2
by: John B | last post by:
If I have the following classes: public abstract class Base { public abstract T CreateItem<T>() where T : Base; } public class Derived : Base { public override T CreateItem<T>()
7
by: Ido Samuelson | last post by:
Hello, What do you think about the following features: public class GenericDecorator<T: T { } can leverage to a few things:
2
by: Fred Mellender | last post by:
I am trying to use reflection to output the fields (names and values) of an arbitrary object -- an object dump to a TreeView. It works pretty well, but I am having trouble with generic lists,...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.