private void RefreshWhiteList(ICoreChildProvider childProvider,DescendancyList descendancy) { //get rid of all objects that are not the object to emphasise tree either as parents or as children (recursive) List<object> whitelist = new List<object>(); //add parents to whitelist if (descendancy != null && descendancy.Parents.Any()) whitelist.AddRange(descendancy.Parents); whitelist.Add(_toPin); whitelist.AddRange(childProvider.GetAllChildrenRecursively(_toPin)); _tree.UseFiltering = true; _tree.ModelFilter = new WhiteListOnlyFilter(whitelist); }
private void Pin(IMapsDirectlyToDatabaseTable objectToPin, DescendancyList descendancy) { if (_pinFilter != null) { _pinFilter.UnApplyToTree(); } _pinFilter = new CollectionPinFilterUI(); _pinFilter.ApplyToTree(_activator, Tree, objectToPin, descendancy); CurrentlyPinned = objectToPin; _pinFilter.UnApplied += (s, e) => { _pinFilter = null; CurrentlyPinned = null; }; }
private void Show(IMapsDirectlyToDatabaseTable selected) { var desc = _activator.CoreChildProvider.GetDescendancyListIfAnyFor(selected); // In main RDMP, Projects are root level items so have no descendancy. But in the console // gui we have a root category so give it a descendancy now so that expansion works properly if (selected is IProject) { desc = new DescendancyList(Projects); } if (desc == null) { return; } // In the main RDMP, we have a specific node for these but in console gui we have a text // category, fix the descendency for these objects if (desc.Parents.Length > 0 && desc.Parents[0] is AllCohortsNode) { desc.Parents[0] = BuiltCohorts; } if (desc.Parents.Any()) { var topLevelCategory = GetRootCategoryOf(desc.Parents[0]); if (topLevelCategory != null) { _treeView.Expand(topLevelCategory); } } foreach (var p in desc.Parents) { _treeView.Expand(p); } _treeView.SelectedObject = selected; _treeView.ScrollOffsetVertical = _treeView.GetScrollOffsetOf(selected) - 1; _treeView.SetNeedsDisplay(); }
public void ApplyToTree(IActivateItems activator, TreeListView tree, IMapsDirectlyToDatabaseTable objectToEmphasise, DescendancyList descendancy) { _activator = activator; if (_tree != null) { throw new Exception("Scope filter is already applied to a tree"); } _toPin = null; if (IsPinnableType(objectToEmphasise)) { _toPin = objectToEmphasise; } else if (descendancy != null) { _toPin = descendancy.Parents.FirstOrDefault(IsPinnableType); } if (_toPin == null) { return; } _tree = tree; lblFilter.Text = _toPin.ToString(); //add the filter to the tree Dock = DockStyle.Top; if (_tree.Dock != DockStyle.Fill) { //tree is not docked, make some room for us _tree.Height -= 19; _tree.Top += 19; } _tree.Parent.Controls.Add(this); _beforeModelFilter = _tree.ModelFilter; _beforeUseFiltering = _tree.UseFiltering; RefreshWhiteList(_activator.CoreChildProvider, descendancy); }
private void AddChildren(ExtractionConfiguration frozenExtractionConfigurationsNode, DescendancyList descendancy) { throw new NotImplementedException(); }
private void AddChildren(FrozenExtractionConfigurationsNode frozenExtractionConfigurationsNode, DescendancyList descendancy) { HashSet <object> children = new HashSet <object>(); //Add ExtractionConfigurations which are not released (frozen) var configs = ExtractionConfigurations.Where(c => c.Project_ID == frozenExtractionConfigurationsNode.Project.ID).ToArray(); foreach (ExtractionConfiguration config in configs.Where(c => c.IsReleased)) { AddChildren(config, descendancy.Add(config)); children.Add(config); } AddToDictionaries(children, descendancy); }
private void AddChildren(ExtractionConfigurationsNode extractionConfigurationsNode, DescendancyList descendancy) { HashSet <object> children = new HashSet <object>(); //Create a frozen extraction configurations folder as a subfolder of each ExtractionConfigurationsNode var frozenConfigurationsNode = new FrozenExtractionConfigurationsNode(extractionConfigurationsNode.Project); //Make the frozen folder appear under the extractionConfigurationsNode children.Add(frozenConfigurationsNode); //Add children to the frozen folder AddChildren(frozenConfigurationsNode, descendancy.Add(frozenConfigurationsNode)); //Add ExtractionConfigurations which are not released (frozen) var configs = ExtractionConfigurations.Where(c => c.Project_ID == extractionConfigurationsNode.Project.ID).ToArray(); foreach (ExtractionConfiguration config in configs.Where(c => !c.IsReleased)) { AddChildren(config, descendancy.Add(config)); children.Add(config); } AddToDictionaries(children, descendancy); }
private void AddChildren(ExtractionConfigurationsNode extractionConfigurationsNode, DescendancyList descendancy) { HashSet <object> children = new HashSet <object>(); var frozenConfigurationsNode = new FrozenExtractionConfigurationsNode(extractionConfigurationsNode.Project); children.Add(frozenConfigurationsNode); var configs = ExtractionConfigurations.Where(c => c.Project_ID == extractionConfigurationsNode.Project.ID).ToArray(); foreach (ExtractionConfiguration config in configs) { AddChildren(config, descendancy.Add(config)); children.Add(config); } AddToDictionaries(children, descendancy); }