public static void BootstrapNavbarRender(AppJson appJson) { int buttonId = 0; // BootstrapNavbarButton.Id foreach (BootstrapNavbar bootstrapNavbar in appJson.ComponentListAll().OfType <BootstrapNavbar>()) { bootstrapNavbar.ButtonList = new List <BootstrapNavbarButton>(); // Clear foreach (var item in bootstrapNavbar.GridList) { if (item.Grid?.TypeRow != null) { var propertyInfoList = UtilDalType.TypeRowToPropertyInfoList(item.Grid.TypeRow); PropertyInfo propertyInfoId = propertyInfoList.Where(item => item.Name == "Id" && item.PropertyType == typeof(int)).SingleOrDefault(); PropertyInfo propertyInfoParentId = propertyInfoList.Where(item => item.Name == "ParentId" && item.PropertyType == typeof(int?)).SingleOrDefault(); PropertyInfo propertyInfoTextHtml = propertyInfoList.Where(item => item.Name == "TextHtml" && item.PropertyType == typeof(string)).SingleOrDefault(); if (propertyInfoParentId != null) { UtilFramework.Assert(propertyInfoId != null, "Row needs a column 'Id'!"); } UtilFramework.Assert(propertyInfoTextHtml != null, string.Format("Row needs a column 'TextHtml' ({0})!", UtilDalType.TypeRowToTableNameCSharp(item.Grid.TypeRow))); // Add for example language switch if (item.IsSelectMode) { if (item.Grid.RowSelect != null) { string textHtml = (string)propertyInfoTextHtml.GetValue(item.Grid.RowSelect); var args = new BootstrapNavbarButtonArgs { BootstrapNavbar = bootstrapNavbar, Grid = item.Grid, Row = item.Grid.RowSelect }; var result = new BootstrapNavbarButtonResult { TextHtml = textHtml }; bootstrapNavbar.ButtonTextHtml(args, result); buttonId += 1; var button = new BootstrapNavbarButton { Id = buttonId, Grid = item.Grid, RowStateId = item.Grid.RowSelectRowStateId.Value, TextHtml = result.TextHtml }; bootstrapNavbar.ButtonList.Add(button); BootstrapNavbarRender(bootstrapNavbar, item, button, ref button.ButtonList, findParentId: null, propertyInfoId, propertyInfoParentId, propertyInfoTextHtml, ref buttonId); } } else { BootstrapNavbarRender(bootstrapNavbar, item, null, ref bootstrapNavbar.ButtonList, findParentId: null, propertyInfoId, propertyInfoParentId, propertyInfoTextHtml, ref buttonId); } } } } }
/// <summary> /// Process bootstrap modal dialog window. /// </summary> public static void ProcessBootstrapModal(AppJson appJson) { appJson.IsBootstrapModal = false; BootstrapModal.DivModalBackdropRemove(appJson); bool isExist = false; foreach (var item in appJson.ComponentListAll().OfType <BootstrapModal>()) { item.ButtonClose?.ComponentMoveLast(); isExist = true; } if (isExist) { appJson.IsBootstrapModal = true; BootstrapModal.DivModalBackdropCreate(appJson); } }
/// <summary> /// Remove non Div components from DivContainer. /// </summary> public static void DivContainerRender(AppJson appJson) { foreach (var divContainer in appJson.ComponentListAll().OfType <DivContainer>()) { List <ComponentJson> listRemove = new List <ComponentJson>(); // Collect items to remove. foreach (var item in divContainer.List) { if (!(item is Div)) // ComponentJson.Type is not evalueted on DivComponent children! { listRemove.Add(item); } } foreach (var item in listRemove) { item.ComponentRemove(); } } }
internal static void Render(AppJson appJson) { int navbarItemId = 0; foreach (BulmaNavbar navbar in appJson.ComponentListAll().OfType <BulmaNavbar>()) { // ItemList clear navbar.ItemStartList.Clear(); navbar.ItemEndList.Clear(); // Add level 0 and level 1 to navbar foreach (var navbarGrid in navbar.GridList) { Render(navbar, navbarGrid, ref navbarItemId); } // Add data grid filter (input text) to navbar if (navbar.Filter != null) { var filter = navbar.Filter; var grid = filter.Grid; // Get filter text from value store. new GridFilter(grid).FilterValueList().TryGetValue(filter.FieldNameCSharp, out var gridFilterValue); string filterText = gridFilterValue?.Text; int rowSateId = grid.RowStateList.Single(item => item.RowEnum == GridRowEnum.Filter).Id; // Filter input text box var navbarItem = new BulmaNavbarItem { Id = navbarItemId += 1, ItemEnum = BulmaNavbarItemEnum.Filter, Grid = grid, FilterFieldNameCSharp = filter.FieldNameCSharp, RowStateId = rowSateId, FilterText = filterText, FilterPlaceholder = "Search" }; if (filter.IsNavbarEnd == false) { navbar.ItemStartList.Add(navbarItem); } else { navbar.ItemEndList.Add(navbarItem); } } } }