AddChild() public method

public AddChild ( DomNode childNode ) : void
childNode DomNode
return void
Exemplo n.º 1
0
        public DomElement GetPresentationDomNode(DomElement hostNode)
        {
            if (pnode != null) return pnode;
            //-----------------------------------
            var doc = hostNode.OwnerDocument;
            this.pnode = doc.CreateElement("div");
            pnode.AddChild("img", item_icon =>
            {
                menuIcon = item_icon;
                menuIcon.AttachMouseDownEvent(e =>
                {
                    //****
                    this.MaintenanceParentOpenState();
                    if (this.IsOpened)
                    {
                        this.Close();
                    }
                    else
                    {
                        this.Open();
                    }
                    e.StopPropagation();
                });
                menuIcon.AttachMouseUpEvent(e =>
                {
                    this.UnmaintenanceParentOpenState();
                    e.StopPropagation();
                });
                menuIcon.AttachEventOnMouseLostFocus(e =>
                {
                    if (!this.MaintenaceOpenState)
                    {
                        this.CloseRecursiveUp();
                    }
                });
            });
            pnode.AddChild("span", content =>
            {
                if (menuItemText != null)
                {
                    pnode.AddTextContent(this.menuItemText);
                }
            });
            //--------------------------------------------------------
            //create simple menu item box 

            if (childItems != null)
            {
                floatPart = new MenuBox(400, 200);
                int j = childItems.Count;
                for (int i = 0; i < j; ++i)
                {
                    floatPart.AddChildBox(childItems[i]);
                }
            }
            return pnode;
        }
Exemplo n.º 2
0
        public DomElement GetTitleNode(DomElement hostNode)
        {
            //-------------------------------------
            if (titleNode != null) return titleNode;
            //create dom node
            var ownerdoc = hostNode.OwnerDocument;
            this.titleNode = ownerdoc.CreateElement("div");
            titleNode.SetAttribute("style", "display:inline");
            titleNode.AddChild("span", span =>
            {
                if (PageTitle == null)
                {
                    span.AddTextContent("");
                }
                else
                {
                    span.AddTextContent(this.PageTitle);
                }
                span.AttachMouseDownEvent(e =>
                {
                    if (this.OwnerContainer != null)
                    {
                        this.OwnerContainer.ChildNotifyTabMouseDown(this);
                    }
                });
            });
            ////mouse down on title
            //titleNode.AttachMouseDownEvent(e =>
            //{


            //});
            //-------------------------------------
            return titleNode;
        }
Exemplo n.º 3
0
        public override DomElement GetPresentationDomNode(WebDom.Impl.HtmlDocument htmldoc)
        {
            //TODO: use template engine, 
            //ideas:  AngularJS style ?

            //1. create body node             
            // and content   
            //style 2, lambda and adhoc attach event  
            if (pnode != null) return pnode;
            //---------------------------------------------------
            pnode = htmldoc.CreateElement("div");
            pnode.AddChild("img", img =>
            {
                //init 
                bool is_close = true;
                img.SetAttribute("src", "../../Demo/arrow_close.png");
                img.AttachMouseDownEvent(e =>
                {
                    img.SetAttribute("src", is_close ?
                        "../../Demo/arrow_open.png" :
                        "../../Demo/arrow_close.png");
                    is_close = !is_close;
                    e.StopPropagation();
                });
            });
            //pnode.AddChild("img", img =>
            //{

            //    //change style
            //    bool is_close = true;
            //    img.SetAttribute("src", "../../Demo/arrow_close.png");
            //    //3. attach event to specific span 
            //    img.AttachMouseDownEvent(e =>
            //    {
            //        img.SetAttribute("src", is_close ?
            //            "../../Demo/arrow_open.png" :
            //            "../../Demo/arrow_close.png");

            //        is_close = !is_close;
            //        e.StopPropagation();

            //        this.InvalidateGraphics();
            //    });

            //});
            pnode.AddChild("span", span =>
            {
                span.AddTextContent(this.checkBoxText);
            });
            return pnode;
        }
Exemplo n.º 4
0
        public override DomElement GetPresentationDomNode(WebDom.Impl.HtmlDocument htmldoc)
        {
            if (pnode != null) return pnode;
            //create primary presentation node

            pnode = htmldoc.CreateElement("div");
            pnode.SetAttribute("style", "font:10pt tahoma");
            int j = treeNodes.Count;
            for (int i = 0; i < j; ++i)
            {
                pnode.AddChild(treeNodes[i].GetPrimaryPresentationNode(pnode));
            }
            return pnode;
        }
Exemplo n.º 5
0
        public override DomElement GetPresentationDomNode(WebDom.Impl.HtmlDocument htmldoc)
        {
            if (presentationNode != null)
            {
                return presentationNode;
            }
            //-------------------
            presentationNode = htmldoc.CreateElement("div");
            presentationNode.AddChild("div", div =>
            {
                div.SetAttribute("style", "font:10pt tahoma;");
                div.AddChild("img", img =>
                {
                    //init 
                    img.SetAttribute("src", "../../Demo/arrow_close.png");
                    img.AttachMouseDownEvent(e =>
                    {
                        //img.SetAttribute("src", this.IsOpen ?
                        //    "../../Demo/arrow_open.png" :
                        //    "../../Demo/arrow_close.png");
                        ////------------------------------

                        if (this.IsOpen)
                        {
                            img.SetAttribute("src", "../../Demo/arrow_close.png");
                            this.CloseHinge();
                        }
                        else
                        {
                            img.SetAttribute("src", "../../Demo/arrow_open.png");
                            this.OpenHinge();
                        }

                        //----------------------------- 
                        e.StopPropagation();
                    });
                });
            });
            //-------------------

            this.floatPartDomElement = this.CreateFloatPartDom(htmldoc);
            return presentationNode;
        }
Exemplo n.º 6
0
        public override DomElement GetPresentationDomNode(WebDom.Impl.HtmlDocument htmldoc)
        {
            if (pnode != null) return pnode;
            //----------------------------------
            pnode = htmldoc.CreateElement("div");
            pnode.SetAttribute("style", "display:inline-block;width:" + Width + "px;height:" + this.Height + "px;");
            pnode.AddChild("div", div2 =>
            {
                //init
                div2.SetAttribute("style", "padding:5px;background-color:#dddddd;");
                div2.AddChild("span", span =>
                {
                    span.AddTextContent(this.buttonText);
                });
                //------------------------------

                div2.AttachMouseDownEvent(e =>
                {
#if DEBUG
                    div2.dbugMark = 1;
#endif
                    // div2.SetAttribute("style", "padding:5px;background-color:#aaaaaa;");
                    EaseScriptElement ee = new EaseScriptElement(div2);
                    ee.ChangeBackgroundColor(Color.FromArgb(0xaa, 0xaa, 0xaa));
                    //div2.SetAttribute("style", "padding:5px;background-color:#aaaaaa;");
                    e.StopPropagation();
                });
                div2.AttachMouseUpEvent(e =>
                {
#if DEBUG
                    div2.dbugMark = 2;
#endif
                    //div2.SetAttribute("style", "padding:5px;background-color:#dddddd;");

                    EaseScriptElement ee = new EaseScriptElement(div2);
                    ee.ChangeBackgroundColor(Color.FromArgb(0xdd, 0xdd, 0xdd));
                    e.StopPropagation();
                });
            });
            return pnode;
        }
Exemplo n.º 7
0
        public override DomElement GetPresentationDomNode(WebDom.Impl.HtmlDocument htmldoc)
        {
            if (pnode != null) return pnode;
            this.htmldoc = htmldoc;
            pnode = htmldoc.CreateElement("div");
            //TODO: review IsLandPart again, this is temp fixed 
            if (!this.IsLandPart)
            {
                pnode.SetAttribute("style", "position:absolute;width:100px;height:200px");
            }

            if (menuItems != null)
            {
                int j = menuItems.Count;
                for (int i = 0; i < j; ++i)
                {
                    pnode.AddChild(menuItems[i].GetPresentationDomNode(pnode));
                }
            }
            return pnode;
        }
Exemplo n.º 8
0
 public DomElement GetPrimaryPresentationNode(DomElement hostNode)
 {
     if (this.pnode != null) return pnode;
     //---------------------------------
     var ownerdoc = hostNode.OwnerDocument;
     pnode = ownerdoc.CreateElement("div");
     //---------------------------------
     //bar part
     pnode.AddChild("div", node_bar =>
     {
         this.nodeBar = node_bar;
         node_bar.AddChild("img", node_icon =>
         {
             this.nodeIcon = node_icon;
             SetupNodeIconBehaviour(node_icon);
         });
         node_bar.AddChild("span", node_span =>
         {
             this.nodeSpan = node_span;
             if (this.nodeString != null)
             {
                 node_span.AddTextContent(this.nodeString);
             }
         });
     });
     //---------------------------------
     //content part
     //indent  
     pnode.AddChild("div", node_body =>
     {
         this.nodeBody = node_body;
         node_body.SetAttribute("style", "padding-left:17px");
         node_body.AddChild("div", node_content =>
         {
             this.nodeContent = node_content;
             if (childNodes != null)
             {
                 nodeContent.SetAttribute("style", "padding-left:0px");
                 int j = childNodes.Count;
                 for (int i = 0; i < j; ++i)
                 {
                     var childnode = childNodes[i].GetPrimaryPresentationNode(nodeContent);
                     node_content.AddChild(childnode);
                 }
             }
         });
     });
     return pnode;
 }
Exemplo n.º 9
0
        DomElement GetPrimaryPresentationNode2(DomElement hostNode)
        {
            //implement wth table

            if (this.pnode != null) return pnode;
            //---------------------------------
            var ownerdoc = hostNode.OwnerDocument;
            pnode = ownerdoc.CreateElement("div");
            //---------------------------------
            //bar part
            pnode.AddChild("div", node_bar =>
            {
                this.nodeBar = node_bar;
                node_bar.AddChild("img", node_icon =>
                {
                    this.nodeIcon = node_icon;
                    SetupNodeIconBehaviour(node_icon);
                });
                node_bar.AddChild("span", node_span =>
                {
                    this.nodeSpan = node_span;
                    if (this.nodeString != null)
                    {
                        node_span.AddTextContent(this.nodeString);
                    }
                });
            });
            //---------------------------------
            //content part
            //indent  
            pnode.AddChild("div", node_body =>
            {
                this.nodeBody = node_body;
                //implement with table
                //plan: => implement with inline div***

                node_body.AddChild("table", table =>
                {
                    table.AddChild("tr", tr =>
                    {
                        tr.AddChild("td", td1 =>
                        {
                            //indent
                            td1.SetAttribute("style", "width:20px");
                        });
                        tr.AddChild("td", td1 =>
                        {
                            this.nodeContent = td1;
                            if (childNodes != null)
                            {
                                int j = childNodes.Count;
                                for (int i = 0; i < j; ++i)
                                {
                                    var childnode = childNodes[i].GetPrimaryPresentationNode(nodeContent);
                                    nodeContent.AddChild(childnode);
                                }
                            }
                        });
                    });
                });
                //node_body.SetAttribute("style", "background-color:yellow");
                //node_body.AddChild("div", node_indent =>
                //{
                //    node_indent.SetAttribute("style", "width:32px;display:inline");
                //    node_indent.AddChild("img", img2 => { });

                //});
                //node_body.AddChild("div", node_content =>
                //{
                //    node_content.SetAttribute("style", "display:inline");
                //    //start with blank content
                //    this.nodeContent = node_content;
                //    if (childNodes != null)
                //    {
                //        int j = childNodes.Count;
                //        for (int i = 0; i < j; ++i)
                //        {
                //            var childnode = childNodes[i].GetPrimaryPresentationNode(node_content);
                //            node_content.AddChild(childnode);
                //        }
                //    }

                //});
            });
            //---------------------
            return pnode;
        }
Exemplo n.º 10
0
        public override WebDom.DomElement GetPresentationDomNode(WebDom.Impl.HtmlDocument htmldoc)
        {
            if (pnode != null) return pnode;
            //------------------------------

            pnode = htmldoc.CreateElement("div");
            pnode.SetAttribute("style", "font:10pt tahoma");
            //------------------------------ 
            titleBar = htmldoc.CreateElement("div");
            titleBar.AddTextContent("hello tabPage");
            pnode.AddChild(titleBar);
            //------------------------------ 
            tabTitleList = htmldoc.CreateElement("div");
            pnode.AddChild(tabTitleList);
            //------------------------------ 
            contentNode = htmldoc.CreateElement("div");
            pnode.AddChild(contentNode);
            //------------------------------
            return pnode;
        }