I'm designing a web site navigation hierarchy. It's a tree of nodes.
Most nodes are pages. Some nodes are links (think shortcuts in Windows).
Most pages hold HTML content. Some execute code.
I'd like to represent these as this collection of classes and abstract (MustInherit) classes…
This is the database table where I'm going to store all this…
database table http://img178.imageshack.us/img178/8573/nodetablefm8.gif
Here's where I'm stumped. PageNodes may or may not be roots.
How should I handle the root class?
I don't want to have to have all four of…
- HtmlPageNode
- CodePageNode
- HtmlRootPageNode
- CodeRootPageNode
I want the HtmlPageNode and CodePageNode classes to inherit either from PageNode or else from RootPageNode. Is that possible?
Clarification: There are multiple root nodes and roots may have parent nodes. Each is the root of only a sub-tree that has distinct styling. Think of different, color-coded departments. (Perhaps root is a poor name choice. Suggestions?)
Update: Regarding the "Root" name...
I've asked: Is there a specific name for the node that coresponds to a subtree?