Ejemplo n.º 1
0
        public override void append(log4javascript.LoggingEvent loggingEvent)
        {
            string            messag = this.getFormatedMessage(loggingEvent);
            HtmlOptionElement opt    = new HtmlOptionElement(messag, "", false, true);

            this._el.options.add(opt);
        }
Ejemplo n.º 2
0
        public override DomElement CreateElement(string prefix, string localName)
        {
            //actual dom implementation ***

            HtmlElement htmlElement;

            switch (localName)
            {
            case "img":
            {
                htmlElement = new HtmlImageElement(
                    this,
                    AddStringIfNotExists(prefix),
                    AddStringIfNotExists(localName));
            }
            break;

            case "input":
            {
                //input type
                htmlElement = new HtmlInputElement(
                    this,
                    AddStringIfNotExists(prefix),
                    AddStringIfNotExists(localName));
            }
            break;

            case "textarea":
            {
                htmlElement = new HtmlTextAreaElement(
                    this,
                    AddStringIfNotExists(prefix),
                    AddStringIfNotExists(localName));
            }
            break;

            case "option":
            {
                htmlElement = new HtmlOptionElement(
                    this,
                    AddStringIfNotExists(prefix),
                    AddStringIfNotExists(localName));
            }
            break;

            default:
            {
                htmlElement = new HtmlElement(this,
                                              AddStringIfNotExists(prefix),
                                              AddStringIfNotExists(localName));
                htmlElement.WellknownElementName = WellKnownDomNodeMap.EvaluateTagName(htmlElement.LocalName);
            }
            break;
            }
            return(htmlElement);
        }
Ejemplo n.º 3
0
        public static HtmlOptionElement CreateHtmlOption(this HtmlDocument doc, Decorate <HtmlOptionElement> dec = null)
        {
            var elem = new HtmlOptionElement(
                doc,
                0,
                doc.AddStringIfNotExists("option"));

            dec?.Invoke(elem);
            return(elem);
        }
Ejemplo n.º 4
0
        public void NotifySelectedSetsSelected()
        {
            var option = new HtmlOptionElement();

            option.NotifyValue(new ElementEventValue
            {
                Checked = true,
            });
            Assert.True(option.Selected);
        }
Ejemplo n.º 5
0
        public void OptionWithValueGetsSelected()
        {
            var select = new HtmlSelectElement
            {
                Value = "lolo"
            };
            var option = new HtmlOptionElement
            {
                Value = "lolo"
            };

            select.AppendChild(option);
            Assert.True(option.Selected);
        }
Ejemplo n.º 6
0
        public void LoopSelectOptions()
        {
            var select  = new HtmlSelectElement();
            var option1 = new HtmlOptionElement();
            var group   = Element.Create("optgroup");
            var option2 = new HtmlOptionElement();

            group.AppendChild(option2);
            select.AppendChild(option1);
            select.AppendChild(group);
            Assert.Equal(new List <HtmlOptionElement> {
                option1, option2
            }, select.Options);
        }
Ejemplo n.º 7
0
        public void AddSelectedOptionInGroup()
        {
            var select = new HtmlSelectElement
            {
                Value = "lolo"
            };
            var option = new HtmlOptionElement
            {
                Value = "lolo"
            };
            var group = new HtmlOptionGroupElement();

            select.AppendChild(group);
            group.AppendChild(option);
            Assert.True(option.Selected);
        }
Ejemplo n.º 8
0
        public static HtmlElement CreateHtmlElement(this HtmlDocument doc, string prefix, string localName)
        {
            //wellknown name?
            HtmlElement htmlElement;

            switch (localName)
            {
            case "img":
            {
                htmlElement = new HtmlImageElement(
                    doc,
                    doc.AddStringIfNotExists(prefix),
                    doc.AddStringIfNotExists(localName));
            }
            break;

            case "input":
            {
                //input type
                htmlElement = new HtmlInputElement(
                    doc,
                    doc.AddStringIfNotExists(prefix),
                    doc.AddStringIfNotExists(localName));
            }
            break;

            case "option":
            {
                htmlElement = new HtmlOptionElement(
                    doc,
                    doc.AddStringIfNotExists(prefix),
                    doc.AddStringIfNotExists(localName));
            }
            break;

            default:
            {
                htmlElement = new HtmlElement(doc,
                                              doc.AddStringIfNotExists(prefix),
                                              doc.AddStringIfNotExists(localName));
                htmlElement.WellknownElementName = WellKnownDomNodeMap.EvaluateTagName(htmlElement.LocalName);
            }
            break;
            }
            return(htmlElement);
        }
Ejemplo n.º 9
0
        public void SelectValueChangeOnChildOptions()
        {
            var select = new HtmlSelectElement();
            var opt1   = new HtmlOptionElement
            {
                Value = "a"
            };
            var opt2 = new HtmlOptionElement
            {
                Value = "b"
            };
            var group = new HtmlOptionGroupElement();

            group.AppendChild(opt2);
            select.AppendChild(opt1);
            select.AppendChild(group);
            select.Value = "a";
            Assert.True(opt1.Selected);
            Assert.False(opt2.Selected);
            select.Multiple = true;
            select.Value    = "b";
            Assert.True(opt1.Selected);
            Assert.True(opt2.Selected);
        }
Ejemplo n.º 10
0
        public static void UpdateDropdown()
        {
            HtmlSelectElement select       = HtmlSelectElement.GetById("name");
            JsString          selectedText = null;

            if (select.selectedIndex != -1)
            {
                selectedText = select.options[select.selectedIndex].text;
            }
            //remove all options
            foreach (HtmlOptionElement option in select.options)
            {
                select.Remove(option);
            }
            //add all options
            JsArray <JsString> cookies = Xdk.cache.GetCookieList();

            for (int i = 0; i < cookies.length; i++)
            {
                HtmlOptionElement option = new HtmlOptionElement(cookies[i], Xdk.cache.GetCookie(cookies[i]), true, true);
                select.Add(option, null);
            }
            //set selected if it is still there
            if (selectedText != null)
            {
                foreach (HtmlOptionElement option in select.options)
                {
                    if (option.text == selectedText)
                    {
                        option.selected = true;
                        break;
                    }
                }
            }
            ShowCookie();
        }
Ejemplo n.º 11
0
 public void Add(HtmlOptionElement option, int index)
 {
 }
Ejemplo n.º 12
0
 public void Add(HtmlOptionElement option)
 {
 }
Ejemplo n.º 13
0
 public static void UpdateDropdown()
 {
     HtmlSelectElement select = HtmlSelectElement.GetById("name");
     JsString selectedText = null;
     if (select.selectedIndex != -1)
     {
         selectedText = select.options[select.selectedIndex].text;
     }
     //remove all options
     foreach (HtmlOptionElement option in select.options)
     {
         select.Remove(option);
     }
     //add all options
     JsArray<JsString> cookies = Xdk.cache.GetCookieList();
     for (int i = 0; i < cookies.length; i++)
     {
         HtmlOptionElement option = new HtmlOptionElement(cookies[i], Xdk.cache.GetCookie(cookies[i]), true, true);
         select.Add(option, null);
     }
     //set selected if it is still there
     if (selectedText != null)
     {
         foreach (HtmlOptionElement option in select.options)
         {
             if (option.text == selectedText)
             {
                 option.selected = true;
                 break;
             }
         }
     }
     ShowCookie();
 }
Ejemplo n.º 14
0
 public void Add(HtmlOptionElement option, int index) { }
Ejemplo n.º 15
0
 public void Add(HtmlOptionElement option) { }