public ElementInfoPanel(ElementInfo info)
        {
            if (info == null)
                throw new ArgumentNullException("info");

            InitializeComponent();

            mInfo = info;
            classNameTextBox.Text = info.ClassName;
            textCheckBox.Checked = info.Text.Include;
            CDATACheckBox.Checked = info.CDATA.Include;

            foreach (AttributeInfo attrib in info.Attributes)
                attributeListBox.Items.Add(attrib.Info.Name);
            foreach (ElementInfo child in info.Children)
                elementListBox.Items.Add(child.Name);
        }
Beispiel #2
0
        /// <summary>
        ///   Updates the tree view.
        /// </summary>
        private void UpdateTreeView()
        {
            mainTreeView.Nodes.Clear();
            UpdateGUIAccess(false);

            if (mInfo != null)
            {
                ElementInfo[] roots;
                if (mInfo.HierarchyMaintained)
                {
                    roots = new ElementInfo[1] { mInfo.RootNode };
                }
                else
                {
                    roots = mInfo.GetAllNodes();
                }

                foreach (ElementInfo info in roots)
                {
                    int index = mainTreeView.Nodes.Add(new TreeNode(info.Name));
                    mainTreeView.Nodes[index].Tag = info;
                    AddParentLevelTreeNode(mainTreeView.Nodes[index], info);
                }

                mainClassTextBox.Text = mInfo.MainClassName;

                UpdateDetailView();
                UpdateGUIAccess(true);
            }
        }
Beispiel #3
0
 /// <summary>
 ///   Adds a leaf node.
 /// </summary>
 /// <param name="node">Node to be added.</param>
 /// <param name="element"><see cref="ElementInfo"/> corresponding to the node.</param>
 private void AddLeafNode(TreeNode node, ElementInfo element)
 {
     int index = node.Nodes.Add(new TreeNode(element.Name));
     node.Nodes[index].Tag = element;
 }
Beispiel #4
0
        /// <summary>
        ///   Adds the parent level tree node.
        /// </summary>
        /// <param name="node">Node to be added.</param>
        /// <param name="info"><see cref="ElementInfo"/> object corresponding to the node.</param>
        private void AddParentLevelTreeNode(TreeNode node, ElementInfo info)
        {
            // Text
            int index = node.Nodes.Add(new TreeNode("Text"));
            node.Nodes[index].Tag = info.Text;

            // CDATA
            index = node.Nodes.Add(new TreeNode("CDATA"));
            node.Nodes[index].Tag = info.CDATA;

            // Attributes
            index = node.Nodes.Add(new TreeNode("Attributes"));
            node.Nodes[index].Tag = info.Attributes;
            foreach (AttributeInfo attrib in info.Attributes)
                AddLeafNode(node.Nodes[index], attrib);

            // Child Elements
            index = node.Nodes.Add(new TreeNode("Elements"));
            node.Nodes[index].Tag = info.Children;
            foreach (ElementInfo element in info.Children)
                AddLeafNode(node.Nodes[index], element);
        }