moel@345: using System;
moel@345: using System.Collections.Generic;
moel@345: using System.Text;
moel@345: using System.Collections.ObjectModel;
moel@345:
moel@345: namespace Aga.Controls.Tree
moel@345: {
moel@345: ///
moel@345: /// Provides a simple ready to use implementation of . Warning: this class is not optimized
moel@345: /// to work with big amount of data. In this case create you own implementation of ITreeModel, and pay attention
moel@345: /// on GetChildren and IsLeaf methods.
moel@345: ///
moel@345: public class TreeModel : ITreeModel
moel@345: {
moel@345: private Node _root;
moel@345: public Node Root
moel@345: {
moel@345: get { return _root; }
moel@345: }
moel@345:
moel@345: public Collection Nodes
moel@345: {
moel@345: get { return _root.Nodes; }
moel@345: }
moel@345:
moel@345: public TreeModel()
moel@345: {
moel@345: _root = new Node();
moel@345: _root.Model = this;
moel@345: }
moel@345:
moel@345: public TreePath GetPath(Node node)
moel@345: {
moel@345: if (node == _root)
moel@345: return TreePath.Empty;
moel@345: else
moel@345: {
moel@345: Stack