public void CheckContainerVisiblity(UIControlPackageTree container) { if (container.ChildItems.Any(x => x.UIItem != null && AgentUICoreMediator.GetAgentUICoreMediator.UIManager.ControlIsVisible(x.UIItem))) { AgentUICoreMediator.GetAgentUICoreMediator.UIManager.SetContaierVisiblity(container.UIItem, true); } else { AgentUICoreMediator.GetAgentUICoreMediator.UIManager.SetContaierVisiblity(container.UIItem, false); } if (container.ParentItem != null) { CheckContainerVisiblity(container.ParentItem); } }
public void GenerateUIComposition(List <EntityUICompositionDTO> UICompositions, object container, UIControlPackageTree parentUIControlPackage, List <UIControlPackageTree> parentList) { //I_View_GridContainer container; //if (parentUIControlPackage == null) //{ // container = SpecializedDataView; // parentList = UIControlPackageTree; //} //else //{ // parentList = parentUIControlPackage.ChildItems; // container = parentUIControlPackage.Item as I_View_GridContainer; //} foreach (var uiCompositionItem in UICompositions.OrderBy(x => x.Position)) { UIControlPackageTree item = new UIControlPackageTree(); item.ParentItem = parentUIControlPackage; item.Container = container; //if (parentUIControlPackage == null) //{ // item.UIComposition = uiCompositionItem; // item.Container = DataView; //}+ //if (uiCompositionItem.ObjectCategory == DatabaseObjectCategory.Entity) //{ // item.Item = DataView; // parentList.Add(item); // GenerateUIComposition(uiCompositionItem.ChildItems, DataView, item, item.ChildItems); //} if (uiCompositionItem.ObjectCategory == DatabaseObjectCategory.Group) { var groupSetting = uiCompositionItem.GroupUISetting; if (groupSetting == null) { groupSetting = new GroupUISettingDTO(); groupSetting.Expander = true; groupSetting.InternalColumnsCount = GetEntityUISetting().UIColumnsCount; groupSetting.UIColumnsType = Enum_UIColumnsType.Full; } var groupItem = AgentUICoreMediator.GetAgentUICoreMediator.UIManager.GenerateGroup(groupSetting); item.Item = groupItem; item.UIItem = groupItem.UIMainControl; groupItem.UIControlPackageTreeItem = item; GenerateUIComposition(uiCompositionItem.ChildItems, groupItem, item, item.ChildItems); if (item.ChildItems.Count != 0) { (container as I_View_GridContainer).AddGroup(groupItem, uiCompositionItem.Title, groupSetting); parentList.Add(item); } } else if (uiCompositionItem.ObjectCategory == DatabaseObjectCategory.TabControl) { var tabgroupSetting = uiCompositionItem.TabGroupUISetting; if (tabgroupSetting == null) { tabgroupSetting = new TabGroupUISettingDTO(); tabgroupSetting.Expander = true; tabgroupSetting.UIColumnsType = Enum_UIColumnsType.Full; } var tabGroupContainer = AgentUICoreMediator.GetAgentUICoreMediator.UIManager.GenerateTabGroup(tabgroupSetting); tabGroupContainer.UIControlPackageTreeItem = item; item.Item = tabGroupContainer; item.UIItem = tabGroupContainer.UIMainControl; GenerateUIComposition(uiCompositionItem.ChildItems, tabGroupContainer, item, item.ChildItems); if (item.ChildItems.Count != 0) { (container as I_View_GridContainer).AddTabGroup(tabGroupContainer, uiCompositionItem.Title, tabgroupSetting); parentList.Add(item); } } else if (uiCompositionItem.ObjectCategory == DatabaseObjectCategory.TabPage) { var tabpageSetting = uiCompositionItem.TabPageUISetting; if (tabpageSetting == null) { tabpageSetting = new TabPageUISettingDTO(); tabpageSetting.InternalColumnsCount = GetEntityUISetting().UIColumnsCount; } var tabPage = AgentUICoreMediator.GetAgentUICoreMediator.UIManager.GenerateTabPage(tabpageSetting); item.Item = tabPage; item.UIItem = tabPage.UIMainControl; tabPage.UIControlPackageTreeItem = item; GenerateUIComposition(uiCompositionItem.ChildItems, tabPage, item, item.ChildItems); if (item.ChildItems.Count != 0) { var parentTabGroupContainer = parentUIControlPackage.Item as I_TabGroupContainer; parentTabGroupContainer.AddTabPage(tabPage, uiCompositionItem.Title, tabpageSetting, tabPage.HasHeader); parentList.Add(item); } } else if (uiCompositionItem.ObjectCategory == DatabaseObjectCategory.Column) { var columnControl = SimpleColumnControls.FirstOrDefault(x => x.Column.ID == Convert.ToInt32(uiCompositionItem.ObjectIdentity)); if (columnControl != null) { columnControl.UIControlPackageTreeItem = item; item.Item = columnControl.ControlManager; item.UIItem = columnControl.ControlManager.GetUIControl(null); (container as I_View_GridContainer).AddUIControlPackage(columnControl.SimpleControlManager, columnControl.ControlManager.LabelControlManager); parentList.Add(item); columnControl.Visited = true; } } else if (uiCompositionItem.ObjectCategory == DatabaseObjectCategory.Relationship) { var columnControl = RelationshipColumnControls.FirstOrDefault(x => x.Relationship != null && x.Relationship.ID == Convert.ToInt32(uiCompositionItem.ObjectIdentity)); if (columnControl != null) { columnControl.UIControlPackageTreeItem = item; if (UICompositions.Count == 1 && parentUIControlPackage != null && parentUIControlPackage.Item is I_TabPageContainer) { (columnControl.ControlManager as I_RelationshipControlManager).TabPageContainer = parentUIControlPackage.Item as I_TabPageContainer; } item.Item = columnControl.ControlManager; item.UIItem = columnControl.ControlManager.GetUIControl(null); (container as I_View_GridContainer).AddView(columnControl.ControlManager, columnControl.ControlManager.LabelControlManager); parentList.Add(item); columnControl.Visited = true; } } else if (uiCompositionItem.ObjectCategory == DatabaseObjectCategory.EmptySpace) { var setting = uiCompositionItem.EmptySpaceUISetting; if (setting == null) { setting = new EmptySpaceUISettingDTO(); setting.ExpandToEnd = false; setting.UIColumnsType = Enum_UIColumnsType.Normal; } //var emptyItem = SpecializedDataView.GenerateEmptySpace(setting); //item.Item = emptyItem; (container as I_View_GridContainer).AddEmptySpace(setting); parentList.Add(item); } //حالت تب اضافه شود //uiControlPackageList.Add(item); //if (uiCompositionItem.ObjectCategory == DatabaseObjectCategory.Group) //{ //} } }