Ejemplo n.º 1
0
 public override string GetHTML(int deep = 0)
 {
     ////////////////////////////
     // Вложеные элементы не предусмотрены
     Childs.Clear();
     return(base.GetHTML(deep));
 }
Ejemplo n.º 2
0
        public override string GetHTML(int deep = 0)
        {
            Childs.Clear();
            AddCSS("alert alert-" + StyleAlert.ToString("g"), true);
            if (isDismissible)
            {
                AddCSS("alert-dismissible fade show", true);
            }

            css_style = "min-height: 50px;";
            SetAttribute("role", "alert");

            if (isDismissible)
            {
                button button_close = new button(null);
                button_close.AddCSS("close");

                button_close.SetAttribute("data-dismiss", "alert");
                button_close.SetAttribute("aria-label", "Close");
                span my_span = new span()
                {
                    InnerText = "×"
                };
                my_span.SetAttribute("aria-hidden", "true");
                button_close.AddDomNode(my_span);
                Childs.Add(button_close);
            }

            Childs.Add(new text(Message));

            return(base.GetHTML(deep));
        }
Ejemplo n.º 3
0
        public void UpdateChildren(NodeUpdatingSource mode, CancellationTokenSource cancellationSource)
        {
            if (IsDisabled)
            {
                mode = NodeUpdatingSource.LocallyOnly;
            }

            Debug.Assert(this.IsInstance);

            IStorageManager vault   = this._model.GetVaultProcessor(Connection.ConnectionGroup);
            bool            updated = false;

            if (mode == NodeUpdatingSource.FromServerIfNotSavedLocally || mode == NodeUpdatingSource.LocallyOnly)
            {
                updated = vault.CurrentStorage.NodeInstances.TryLoadChildren(this);
            }

            if (updated || mode == NodeUpdatingSource.LocallyOnly)
            {
                return;
            }

            Childs.Clear();
            Childs.AddRange(InstantiateStaticNodes(this.Template.Childs, Connection, this));

            vault.CurrentStorage.NodeInstances.SaveChildren(this);

            if (MayHaveDynamicChildren && Connection.IsLiveConnection)
            {
                UpdateDynamicChildren(cancellationSource.Token);
            }
        }
Ejemplo n.º 4
0
        public override string GetHTML(int deep = 0)
        {
            if (string.IsNullOrEmpty(Select.Id_DOM))
            {
                if (!string.IsNullOrEmpty(Select.Name))
                {
                    Select.Id_DOM = Select.Name;
                }
                else
                {
                    Select.Id_DOM   = Guid.NewGuid().ToString().Replace("-", "");
                    Select.Name_DOM = Select.Id_DOM;
                }
            }
            Childs.Clear();
            if (!(LabelSelectMenu is null))
            {
                LabelSelectMenu.@for = Select.Id_DOM;
                Childs.Add(LabelSelectMenu);
            }
            if (!(SizeSelect is null))
            {
                Select.AddCSS("form-control-" + SizeSelect?.ToString("g"));
            }

            if (isCustomBootstrapSelect)
            {
                Select.AddCSS("custom-select");
            }

            Childs.Add(Select);

            return(base.GetHTML(deep));
        }
Ejemplo n.º 5
0
        public override string GetHTML(int deep = 0)
        {
            if (autofocus)
            {
                SetAttribute("autofocus", null);
            }

            if (disabled)
            {
                SetAttribute("disabled", null);
            }

            if (multiple)
            {
                SetAttribute("multiple", null);
            }

            if (required)
            {
                SetAttribute("required", null);
            }

            if (size > 0)
            {
                SetAttribute("size", size);
            }

            Childs.Clear();
            Childs.AddRange(Options);

            return(base.GetHTML(deep));
        }
Ejemplo n.º 6
0
 public override string GetHTML(int deep = 0)
 {
     Childs.Clear();
     Childs.Add(Thead);
     Childs.Add(Tbody);
     return(base.GetHTML(deep));
 }
Ejemplo n.º 7
0
        public override string GetHTML(int deep = 0)
        {
            Childs.Clear();
            tr my_tr = new tr();

            Columns.ForEach(x => my_tr.Columns.Add(x));
            Childs.Add(my_tr);
            return(base.GetHTML(deep));
        }
Ejemplo n.º 8
0
        public void Add(string key, int value)
        {
            var i = 0;

            while (i < key.Length && i < Key.Length && Key[i] == key[i])
            {
                i++;
            }

            if (i == key.Length && i == Key.Length)//Equals
            {
                Value = value;
            }
            else if (i == key.Length)//Key contains key
            {
                var oldChilds = new Dictionary <char, PatriciaTrieNode>(Childs);

                Childs.Clear();
                Childs.Add(Key[i], new PatriciaTrieNode(Key.Substring(i), Value, oldChilds));
                Key   = key.Substring(0, i);
                Value = value;
            }
            else if (i == Key.Length)//key contains Key
            {
                PatriciaTrieNode child;
                if (Childs.TryGetValue(key[i], out child))
                {
                    child.Add(key.Substring(i), value);
                }
                else
                {
                    Childs.Add(key[i], new PatriciaTrieNode(key.Substring(i), value));
                }
            }
            else//find a char not equals
            {
                PatriciaTrieNode child;
                if (Childs.TryGetValue(key[i], out child))
                {
                    child.Add(key.Substring(i), value);
                }
                else
                {
                    var oldChilds = new Dictionary <char, PatriciaTrieNode>(Childs);

                    Childs.Clear();
                    Childs.Add(Key[i], new PatriciaTrieNode(Key.Substring(i), Value, oldChilds));
                    Childs.Add(key[i], new PatriciaTrieNode(key.Substring(i), value));

                    Key   = Key.Substring(0, i);
                    Value = null;
                }
            }
        }
Ejemplo n.º 9
0
        public override string GetHTML(int deep = 0)
        {
            Childs.Clear();
            SetAttribute("aria-label", aria_label is null ? "Toolbar with button groups" : aria_label);
            Groups.ForEach(x => Childs.Add(x));

            if (!(Justifying is null))
            {
                AddCSS(Justifying?.ToString("g").Replace("_", "-"));
            }

            return(base.GetHTML(deep));
        }
Ejemplo n.º 10
0
        public override string GetHTML(int deep = 0)
        {
            Childs.Clear();

            if (!string.IsNullOrEmpty(href))
            {
                SetAttribute("href", href);
            }

            if (!(target is null))
            {
                SetAttribute("target", target?.ToString("g"));
            }

            return(base.GetHTML(deep));
        }
Ejemplo n.º 11
0
        public async void GetChild()
        {
            try
            {
                Childs.Clear();
                var pagechild = await _businessPage.GetAllByIdParent(Fichier.ID);

                foreach (Page page in pagechild.OrderBy(x => x.Ordre))
                {
                    Childs.Add(new PageViewModel(page));
                }
            }
            catch (Exception ex)
            {
                //throw ex;
            }
        }
Ejemplo n.º 12
0
        public override string GetHTML(int deep = 0)
        {
            Childs.Clear();
            AddCSS("btn " + "btn" + (isOutlineStyle ? "-outline" : "") + "-" + StyleButton.ToString("g"), true);

            tag_custom_name = TypeButton.ToString("g");

            switch (TypeButton)
            {
            case TypesBootstrapButton.a:
                base.TypeButton = null;
                SetAttribute("role", "button");
                if (disabled)
                {
                    AddCSS("disabled");
                    SetAttribute("aria-disabled", "true");
                    SetAttribute("tabindex", "-1");
                }
                break;

            case TypesBootstrapButton.button:
                if (ToggleState)
                {
                    SetAttribute("data-toggle", "button");
                    SetAttribute("aria-pressed", "false");
                }
                break;

            case TypesBootstrapButton.input:
                SetAttribute("value", InnerText);
                InnerText = null;
                break;

            default:
                // какая-то ошибка
                break;
            }

            if (!(SizeButton is null))
            {
                AddCSS("btn-" + SizeButton?.ToString("g"));
            }

            return(base.GetHTML(deep));
        }
Ejemplo n.º 13
0
        public bool Delete(string key)
        {
            PatriciaTrieNode child;

            if (!Childs.TryGetValue(key[Key.Length], out child))
            {
                return(false);
            }

            key = key.Substring(Key.Length);

            if (!key.StartsWith(child.Key))
            {
                return(false);
            }

            if (key.Length != child.Key.Length)
            {
                return(child.Delete(key));
            }

            if (!child.Value.HasValue)
            {
                return(false);
            }

            if (child.Childs.Count > 1)
            {
                child.Value = null;
            }
            else if (child.Childs.Count == 0)
            {
                Childs.Remove(key[0]);
            }
            else if (child.Childs.Count == 1)
            {
                var k = child.Childs.First().Key;
                child.Childs[k].Key = child.Key + child.Childs[k].Key;
                Childs.Clear();
                Childs.Add(child.Key[0], child.Childs[k]);
            }

            return(true);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 当ディレクトリの子孫を検索します。
        /// </summary>
        public override async Task <IEnumerable <FileSystemModel> > SearchChildDirectoryTaskAsync()
        {
            if (IsSearched)
            {
                return(Childs);
            }

            var dirs = await FileSystemService.GetDirectoriesAsync(FullPath);

            Childs.Clear();

            foreach (var path in dirs.OrderBy(f => f))
            {
                Childs.Add(new DirectoryModel(path, this));
            }

            IsSearched = true;

            return(Childs);
        }
Ejemplo n.º 15
0
        public override string GetHTML(int deep = 0)
        {
            /// <summary>
            /// Вложеные элементы тут не допустимы
            /// </summary>
            Childs.Clear();

            SetAttribute("media", media, ", ");

            if (!string.IsNullOrEmpty(src))
            {
                SetAttribute("src", src);
                if (!string.IsNullOrEmpty(mimetype))
                {
                    SetAttribute("type", mimetype);
                }
            }

            return(base.GetHTML(deep));
        }
Ejemplo n.º 16
0
        public async void GetChild()
        {
            try
            {
                Childs.Clear();
                var seriechild = await _businessSerie.GetAllByIdParent(Serie.ID);

                foreach (var enfant in seriechild.OrderBy(x => x.Name))
                {
                    var enf = new SerieViewModel();
                    await enf.Initialize(enfant);

                    Childs.Add(enf);
                }
                this.NumberOfChildSerie = string.Format("{0} élément(s)", seriechild.Count());
                if (Childs.Count == 0)
                {
                    var filechild = await _businessFichier.GetAllByIdParent(Serie.ID);

                    foreach (var enfant in filechild.OrderBy(x => x.Order))
                    {
                        var enf = new FichierViewModel();
                        await enf.Initialize(enfant);

                        Childs.Add(enf);
                    }
                    this.NumberOfChild = string.Format("{0} élément(s)", filechild.Count());
                }
                if (Childs.Count == 0)
                {
                    var defaultchild = new SerieViewModel();
                    defaultchild.Name = "Pas de sous éléments";
                    Childs.Add(defaultchild);
                }
                Haschanged = false;
            }
            catch (Exception ex)
            {
                //throw ex;
            }
        }
Ejemplo n.º 17
0
        public override string GetHTML(int deep = 0)
        {
            Childs.Clear();

            Childs.Add(Input);
            if (!(LabelInput is null))
            {
                Childs.Add(LabelInput);
            }

            if (Input.required)
            {
                Childs.AddRange(GetValidationAlerts(Input.Id_DOM, valid_feedback_text, invalid_feedback_text));
            }

            ////////////////////////////////////////////////
            // Фиксим проблему кроссбраузерности отправок формой чекбокса.
            // Разные браузеры могут по разному отправлять чекбокс. Для стандартизации этой процедуры с чекбоксом в паре держим его "тень" в виде скрытого input-а и контролируем значение теневого значения синхронизируя с основным
            Childs.Add(new input()
            {
                type = InputTypesEnum.hidden, value = Input.@checked ? "on" : "off", Name = Id_DOM
            });
            //
            script my_script = new script();

            my_script.AddDomNode(new text("jQuery(document).ready(function () {"));
            my_script.AddDomNode(new text("  jQuery('#" + Input.Id_DOM + "').change(function () {"));
            my_script.AddDomNode(new text("    if (jQuery(this).prop('checked')) {"));
            my_script.AddDomNode(new text("      jQuery('input[name=" + Input.Id_DOM + "').val('on');"));
            my_script.AddDomNode(new text("    }"));
            my_script.AddDomNode(new text("    else {"));
            my_script.AddDomNode(new text("      jQuery('input[name=" + Input.Id_DOM + "').val('off');"));
            my_script.AddDomNode(new text("    }"));
            my_script.AddDomNode(new text("  });"));
            my_script.AddDomNode(new text("});"));
            Childs.Add(my_script);
            ///////////////////////////////////////////////
            ///
            return(base.GetHTML(deep));
        }
Ejemplo n.º 18
0
        public override string GetHTML(int deep = 0)
        {
            Childs.Clear();
            div input_group_prepend = new div();

            input_group_prepend.AddCSS("input-group-prepend");
            using (div input_group_text = new div()
            {
                InnerText = LabelText
            })
            {
                input_group_text.AddCSS("input-group-text");
                input_group_prepend.Childs.Add(input_group_text);
            }
            Childs.Add(input_group_prepend);
            Childs.Add(Input);

            if (Input.required)
            {
                Childs.AddRange(GetValidationAlerts(Input.Name));
            }

            return(base.GetHTML(deep));
        }
Ejemplo n.º 19
0
 public override string GetHTML(int deep = 0)
 {
     Childs.Clear();
     Rows.ForEach(x => Childs.Add(x));
     return(base.GetHTML(deep));
 }
Ejemplo n.º 20
0
        public override string GetHTML(int deep = 0)
        {
            Childs.Clear();

            tag_custom_name     = typeof(nav).Name;
            before_coment_block = "pagination";
            if (CountAllElements == 0)
            {
                goto end;
            }

            SetAttribute("aria-label", "Page navigation");
            ul ul_block = new ul();

            ul_block.AddCSS("pagination");

            #region Formatting pagination (aligment + sizing)
            if (SiziePagination == SizingBootstrap.Lg)
            {
                ul_block.AddCSS("pagination-lg");
            }
            else if (SiziePagination == SizingBootstrap.Sm)
            {
                ul_block.AddCSS("pagination-sm");
            }

            if (AlignmentPagination == AlignmentEnum.center)
            {
                ul_block.AddCSS("justify-content-center");
            }
            else if (AlignmentPagination == AlignmentEnum.right)
            {
                ul_block.AddCSS("justify-content-end");
            }
            #endregion

            ul_block.Childs.Add(PaginationItem(0));

            for (int i = 1; CountPages >= i; i++)
            {
                if (CountPages > 7)
                {
                    if (PageNum < 5)
                    {
                        if (i == CountPages - 1)
                        {
                            ul_block.Childs.Add(PaginationItem(-1));
                        }
                        else if (i <= 5 || i == CountPages)
                        {
                            ul_block.Childs.Add(PaginationItem(i));
                        }
                        else
                        {
                            continue;
                        }
                    }
                    else if (PageNum > (CountPages - 4))
                    {
                        if (i == 2)
                        {
                            ul_block.Childs.Add(PaginationItem(-1));
                        }
                        else if (i == 1 || i >= (CountPages - 4))
                        {
                            ul_block.Childs.Add(PaginationItem(i));
                        }
                        else
                        {
                            continue;
                        }
                    }
                    else
                    {
                        if (i == 2 || i == CountPages - 1)
                        {
                            ul_block.Childs.Add(PaginationItem(-1));
                        }
                        else if ((i == 1 || i == CountPages) || (i == PageNum - 1 || i == PageNum || i == PageNum + 1))
                        {
                            ul_block.Childs.Add(PaginationItem(i));
                        }
                        else
                        {
                            continue;
                        }
                    }
                }
                else
                {
                    ul_block.Childs.Add(PaginationItem(i));
                }
            }
            ul_block.Childs.Add(PaginationItem(CountPages + 1));
            Childs.Add(ul_block);

end:
            return(base.GetHTML(deep));
        }
Ejemplo n.º 21
0
 public void Clear()
 {
     Childs?.Clear();
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Vide les propriétés de navigation.
 /// </summary>
 protected virtual void ClearNavigationProperties()
 {
     Childs.Clear();
     Parent = null;
     Processes.Clear();
 }
        internal void Parse()
        {
            if (ParentCount > 30)
            {
                return;
            }
            config.SkipEmpty();
            if (config.Peek() == '(')
            {
                config.Next();
                Name = config.NextString();
                config.Next();
                Value = config.NextString();
                config.Next();
                return;
            }

            Name = config.NextString();
            config.SkipEmpty();
            if (config.Peek() == '=')
            {
                config.Next();
                config.SkipEmpty();
                Value = config.NextString();
            }
            else if (config.Peek() == ',')
            {
                config.Next();
                Childs.Add(new ADLElement {
                    Name = this.Name, Parent = this
                });
                Name = null;

                while (config.HasChar)
                {
                    config.SkipEmpty();
                    Childs.Add(new ADLElement {
                        Value = config.NextString(), Parent = this
                    });
                    config.SkipEmpty();
                    if (config.Peek() == ',')
                    {
                        config.Next();
                        config.SkipEmpty();
                    }
                    if (config.Peek() == '}')
                    {
                        break;
                    }
                }
                //config.Next();
            }
            else if (config.Peek() == '{')
            {
                config.Next();
                while (config.HasChar)
                {
                    config.SkipEmpty();
                    Childs.Add(new ADLElement(config, this));
                    config.SkipEmpty();
                    if (config.Peek() == '}')
                    {
                        break;
                    }
                }
                config.Next();
                if (Childs.Count() == 1 && Childs[0].Name == null)
                {
                    var c = Childs[0];
                    Childs.Clear();
                    Childs.AddRange(c.Childs);
                }
            }
        }