Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Member Functions | Protected Attributes | Properties
Silverstone.Manticore.Toolkit.BaseTreeBuilder Class Reference
Inheritance diagram for Silverstone.Manticore.Toolkit.BaseTreeBuilder:
Inheritance graph
[legend]
Collaboration diagram for Silverstone.Manticore.Toolkit.BaseTreeBuilder:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 BaseTreeBuilder (ManticoreTreeView aTreeView, TreeNode aParent)
 BaseTreeBuilder (ManticoreTreeView aTreeView, TreeNode aParent, TreeNode aBefore, TreeNode aAfter)
void OnNodeChanging (Object aOldNode, Object aNewNode)
void OnNodeChanged (Object aOldNode, Object aNewNode)
void OnNodeAdding (Object aNewNode, Object aParentNode, int aIndex)
void OnNodeAdded (Object aChildNode, Object aParentNode, int aIndex)
void OnNodeRemoving (Object aNodeRemoving)
void OnNodeRemoved (Object aNodeRemoved)
override void Build ()
 Build content. Builds all content if |LazyState| is set to false.
void Recurse (String aRoot, TreeNodeCollection aNodes)

Protected Member Functions

override void InitializeComponent ()
virtual void OnBeforeExpand (Object sender, TreeViewCancelEventArgs e)
 Overridden by clients to provide command handling for built menus.

Protected Attributes

TreeNode mParent = null
 The |TreeNode| that is the parent of the content builder.
TreeNodeCollection mParentNodes = null
TreeNode mBefore = null
 |mBefore| and |mAfter| define the static boundaries within which the DynamicTreeBuilder operates. Used if the builder builds items which are siblings to static |TreeNode|s.
TreeNode mAfter = null
ManticoreTreeView mTreeView = null
 The containing |TreeView|.
Hashtable mNodes = null
 All of this builder's |TreeNode|s, keyed by DataStore id.
int mInsertionPoint = 0
 This is the default point of insertion of new nodes. Initially, this is the index of |mBefore|, or 0 if |mBefore| is null. As items are added, it is incremented.
IDataStore mDataStore = null
String mRoot = null

Properties

TreeNode Parent [get, set]
TreeNode Before [get, set]
TreeNode After [get, set]
IDataStore DataStore [get, set]
String Root [get, set]

Detailed Description

Definition at line 347 of file TreeBuilder.cs.


Constructor & Destructor Documentation

Definition at line 349 of file TreeBuilder.cs.

                                                                          : base(aTreeView, aParent)
    {
      InitializeComponent();
    }

Definition at line 354 of file TreeBuilder.cs.

                                            : base(aTreeView, aParent, aBefore, aAfter)
    {
      InitializeComponent();
    }

Member Function Documentation

override void Silverstone.Manticore.Toolkit.DynamicTreeBuilder.Build ( ) [inline, virtual, inherited]

Build content. Builds all content if |LazyState| is set to false.

Reimplemented from Silverstone.Manticore.Toolkit.ContentBuilder.

Definition at line 251 of file TreeBuilder.cs.

    {
      if (mDataStore == null || mRoot == null) 
        throw new Exception();

      // XXX implement acknowledgement of |LazyState|
      Recurse(mRoot, mParentNodes);
    }

Here is the call graph for this function:

Reimplemented from Silverstone.Manticore.Toolkit.DynamicTreeBuilder.

Definition at line 362 of file TreeBuilder.cs.

    {
      base.InitializeComponent();

      mDataStore = new SampleDataStore();
      mDataStore.AddObserver(this as IDataStoreObserver);
    }
virtual void Silverstone.Manticore.Toolkit.DynamicTreeBuilder.OnBeforeExpand ( Object  sender,
TreeViewCancelEventArgs  e 
) [inline, protected, virtual, inherited]

Overridden by clients to provide command handling for built menus.

Parameters:
sender
e

Definition at line 140 of file TreeBuilder.cs.

    {
      // XXX make this smarter. 
      Build();
    }
void Silverstone.Manticore.Toolkit.DynamicTreeBuilder.OnNodeAdded ( Object  aChildNode,
Object  aParentNode,
int  aIndex 
) [inline, inherited]

Implements Silverstone.Manticore.Core.IDataStoreObserver.

Definition at line 180 of file TreeBuilder.cs.

    {
      // A new Element has been added somewhere. We must find the 
      // parent menu and append it. To interoperate with the Content Builder,
      // the DataStore must provide |CommandTarget|s to this method. 
      CommandTarget childTarget = aChildNode as CommandTarget;
      CommandTarget parentTarget = aParentNode as CommandTarget;
      if (childTarget == null && parentTarget == null)
        return;

      // Determine based on conditions defined by the |TreeView|
      // whether or not this node should be built. 
      if (!mTreeView.ShouldBuild(childTarget))
        return;

      int childKey = childTarget.Data.GetHashCode();
      if (!mNodes.ContainsKey(childKey)) 
      {
        int parentKey = parentTarget.Data.GetHashCode();

        ManticoreTreeNode parentNode;
        if (mNodes.ContainsKey(parentKey))
          parentNode = mNodes[parentKey] as ManticoreTreeNode;
        else
          parentNode = mParent as ManticoreTreeNode;
        
        if (parentNode != null) 
        {
          ManticoreTreeNode childNode = new ManticoreTreeNode(childTarget.Label,
            childTarget.Data);
          if (parentNode != null) 
          {
            int imageIndex = mTreeView.GetIconIndex(childTarget);
            if (imageIndex > -1) 
              childNode.ImageIndex = imageIndex;

            parentNode.Nodes.Insert(aIndex, childNode);
            if (childTarget.IsContainer && childTarget.IsOpen)
              childNode.Expand();
            mNodes.Add(childKey, childNode);
          }
        }
      }
    }
void Silverstone.Manticore.Toolkit.DynamicTreeBuilder.OnNodeAdding ( Object  aNewNode,
Object  aParentNode,
int  aIndex 
) [inline, inherited]

Implements Silverstone.Manticore.Core.IDataStoreObserver.

Definition at line 176 of file TreeBuilder.cs.

    {
      // Not Implemented. 
    }
void Silverstone.Manticore.Toolkit.DynamicTreeBuilder.OnNodeChanged ( Object  aOldNode,
Object  aNewNode 
) [inline, inherited]

Implements Silverstone.Manticore.Core.IDataStoreObserver.

Definition at line 153 of file TreeBuilder.cs.

    {
      // Enumerate each of the properties that affect FE presentation, test
      // for difference, and update the FE if necessary.
      
      CommandTarget oldTarget = aOldNode as CommandTarget;
      CommandTarget newTarget = aNewNode as CommandTarget;
      
      if (oldTarget == null && newTarget == null)
        return;
      
      int itemKey = newTarget.Data.GetHashCode();
      if (mNodes.ContainsKey(itemKey)) 
      {
        ManticoreTreeNode item = mNodes[itemKey] as ManticoreTreeNode;
        // Check for Label/AccessKey change. 
        if (newTarget.Label != oldTarget.Label) 
          item.Text = newTarget.Label;
        if (newTarget.IsContainer) 
          item.ImageIndex = mTreeView.GetIconIndex(newTarget);
      }
    }
void Silverstone.Manticore.Toolkit.DynamicTreeBuilder.OnNodeChanging ( Object  aOldNode,
Object  aNewNode 
) [inline, inherited]

Implements Silverstone.Manticore.Core.IDataStoreObserver.

Definition at line 149 of file TreeBuilder.cs.

    {
      // Not Implemented.
    }

Implements Silverstone.Manticore.Core.IDataStoreObserver.

Definition at line 229 of file TreeBuilder.cs.

    {
      CommandTarget childTarget = aNodeRemoved as CommandTarget;

      // Remove |MenuItem| representation of |aChildNode|.
      int childKey = childTarget.Data.GetHashCode();
      if (mNodes.ContainsKey(childKey)) 
      {
        ManticoreTreeNode childNode = mNodes[childKey] as ManticoreTreeNode;
        ManticoreTreeNode parentNode = childNode.Parent as ManticoreTreeNode;
        if (parentNode != null)
          parentNode.Nodes.Remove(childNode);
        else
          mTreeView.Nodes.Remove(childNode);
        
        mNodes.Remove(childKey);
      }
    }

Implements Silverstone.Manticore.Core.IDataStoreObserver.

Definition at line 225 of file TreeBuilder.cs.

    {
      // Not Implemented.
    }
void Silverstone.Manticore.Toolkit.DynamicTreeBuilder.Recurse ( String  aRoot,
TreeNodeCollection  aNodes 
) [inline, inherited]

Definition at line 260 of file TreeBuilder.cs.

    {
      IEnumerator items;
      mDataStore.GetElements(aRoot, out items);
      items.Reset();
      
      ManticoreTreeNode node;
      
      while (items.MoveNext()) 
      {
        // |id| is the item's unique identifier within the DataStore. 
        // The handling code can use this to probe for more information
        // about the selected item. 
        CommandTarget current = items.Current as CommandTarget;
        if (current != null) 
        {
          // Determine based on conditions defined by the |TreeView|
          // whether or not this node should be built. 
          if (!mTreeView.ShouldBuild(current))
            continue;

          String id = current.Data as String; 
         
          int idKey = id.GetHashCode();
          
          if (!mNodes.ContainsKey(idKey)) 
          {
            node = new ManticoreTreeNode(current.Label, id);

            int imageIndex = mTreeView.GetIconIndex(current);
            if (imageIndex > -1) 
              node.ImageIndex = imageIndex;
            aNodes.Insert(mInsertionPoint++, node);
            if (current.IsContainer && current.IsOpen)
              node.Expand();
            mNodes.Add(id.GetHashCode(), node);

            // If we're a container, recurse 
            if (current.IsContainer)
              Recurse(id, node.Nodes);
          }
        }
      }
      
      ResetInsertionPoint();
    }

Here is the call graph for this function:


Member Data Documentation

Definition at line 63 of file TreeBuilder.cs.

|mBefore| and |mAfter| define the static boundaries within which the DynamicTreeBuilder operates. Used if the builder builds items which are siblings to static |TreeNode|s.

Definition at line 62 of file TreeBuilder.cs.

Definition at line 53 of file ContentBuilder.cs.

This is the default point of insertion of new nodes. Initially, this is the index of |mBefore|, or 0 if |mBefore| is null. As items are added, it is incremented.

Definition at line 81 of file TreeBuilder.cs.

All of this builder's |TreeNode|s, keyed by DataStore id.

Definition at line 73 of file TreeBuilder.cs.

The |TreeNode| that is the parent of the content builder.

Definition at line 53 of file TreeBuilder.cs.

TreeNodeCollection Silverstone.Manticore.Toolkit.DynamicTreeBuilder.mParentNodes = null [protected, inherited]

Definition at line 55 of file TreeBuilder.cs.

Definition at line 54 of file ContentBuilder.cs.

The containing |TreeView|.

Definition at line 68 of file TreeBuilder.cs.


Property Documentation

Definition at line 335 of file TreeBuilder.cs.

Definition at line 323 of file TreeBuilder.cs.

Definition at line 65 of file ContentBuilder.cs.

Definition at line 311 of file TreeBuilder.cs.

Definition at line 75 of file ContentBuilder.cs.


The documentation for this class was generated from the following file: