Example #1
0
        /// <summary>
        /// 创建树的节点
        /// </summary>
        /// <param name="node">节点</param>
        /// <param name="control">控件</param>
        /// <param name="treeNode">树节点</param>
        protected virtual void createTreeNode(XmlNode node, FCView control, FCTreeNode treeNode)
        {
            FCTree tree = control as FCTree;

            if (tree != null)
            {
                FCTreeNode appendNode = new FCTreeNode();
                if (treeNode == null)
                {
                    tree.appendNode(appendNode);
                }
                else
                {
                    treeNode.appendNode(appendNode);
                }
                setAttributesBefore(node, appendNode);
                foreach (XmlNode subNode in node.ChildNodes)
                {
                    if (subNode.Name.ToLower() == "node")
                    {
                        createTreeNode(subNode, control, appendNode);
                    }
                }
                setAttributesAfter(node, appendNode);
            }
        }
Example #2
0
        /// <summary>
        /// 加载树的模板
        /// </summary>
        /// <param name="tree">树</param>
        /// <param name="node">节点</param>
        public static void TreeTemplate(FCTree tree, UIXmlEx xml, XmlNode node)
        {
            XmlDocument xmlDoc = node.OwnerDocument;

            tree.Size = new FCSize(200, 200);
            FCGridColumn column = new FCGridColumn("Column1");

            column.AllowSort = false;
            tree.addColumn(column);
            FCGridColumn column2 = new FCGridColumn("Column2");

            column2.AllowSort = false;
            tree.addColumn(column2);
            tree.update();
            FCTreeNode treeNode = new FCTreeNode();

            treeNode.Text = "Node1";
            tree.appendNode(treeNode);
            FCTreeNode subTreeNode = new FCTreeNode();

            subTreeNode.Text = "Node2";
            treeNode.appendNode(subTreeNode);
            tree.update();
            XmlNode columnsNode = xmlDoc.CreateNode(XmlNodeType.Element, "tr", "");

            node.AppendChild(columnsNode);
            XmlNode column1Node = xmlDoc.CreateNode(XmlNodeType.Element, "th", "");

            columnsNode.AppendChild(column1Node);
            XmlAttribute xmlAtr1 = xmlDoc.CreateAttribute("text");

            xmlAtr1.Value = "Column1";
            column1Node.Attributes.Append(xmlAtr1);
            XmlNode column2Node = xmlDoc.CreateNode(XmlNodeType.Element, "th", "");

            columnsNode.AppendChild(column2Node);
            XmlAttribute xmlAtr2 = xmlDoc.CreateAttribute("text");

            xmlAtr2.Value = "Column2";
            column2Node.Attributes.Append(xmlAtr2);
            XmlNode nodesNode = xmlDoc.CreateNode(XmlNodeType.Element, "nodes", "");

            node.AppendChild(nodesNode);
            XmlNode nodeNode = xmlDoc.CreateNode(XmlNodeType.Element, "node", "");

            nodesNode.AppendChild(nodeNode);
            XmlAttribute xmlAtr3 = xmlDoc.CreateAttribute("text");

            xmlAtr3.Value = "Node1";
            nodeNode.Attributes.Append(xmlAtr3);
            XmlNode subNodeNode = xmlDoc.CreateNode(XmlNodeType.Element, "node", "");

            nodeNode.AppendChild(subNodeNode);
            XmlAttribute xmlAtr4 = xmlDoc.CreateAttribute("text");

            xmlAtr4.Value = "Node2";
            subNodeNode.Attributes.Append(xmlAtr4);
        }
Example #3
0
 /// <summary>
 /// 销毁方法
 /// </summary>
 public override void delete()
 {
     if (!IsDeleted)
     {
         if (m_tvTypes != null)
         {
             m_tvTypes.removeEvent(m_gridSelectedRowsChangedEvent, FCEventID.GRIDSELECTEDROWSCHANGED);
             m_gridSelectedRowsChangedEvent = null;
             m_tvTypes = null;
         }
         base.delete();
     }
 }