public void removeAllNotTextFilters() { this.label1.Text = "thinking..."; CompositeAllFilter currentFilter = null; //de-activate any existing *non* text match filters if (fastDataListView1.ModelFilter != null) { currentFilter = (CompositeAllFilter)fastDataListView1.ModelFilter; foreach (IModelFilter m in currentFilter.Filters) { if (!(m is TextMatchFilter)) { currentFilter.Filters.Remove(m); break; } } if (currentFilter.Filters.Count == 0) { fastDataListView1.ModelFilter = null; } } fastDataListView1.ModelFilter = currentFilter; //GetColumnsFromlkpBigQueueColumnMetaData(); //buttonRestoreState_Click(this, new EventArgs()); updateStatusLine(fastDataListView1); }
public void DisplaySearchResults() { chatTable.SetObjects(SearchResults); chatTable.Invalidate(); var filters = new List <IModelFilter>(); TextMatchFilter highlightingFilter = null; if (!String.IsNullOrEmpty(searchBox.Text)) { char[] sep = { ',', '\"', ':' }; var words = searchBox.Text.Trim().Split(sep); highlightingFilter = TextMatchFilter.Contains(chatTable, words); foreach (var word in words) { var filter = TextMatchFilter.Contains(chatTable, word); filters.Add(filter); //filters.Add(tagFilter); } } var compositeFilter = new CompositeAllFilter(filters); chatTable.ModelFilter = highlightingFilter; chatTable.AdditionalFilter = compositeFilter; highlightTextRenderer1.Filter = highlightingFilter; }
public TextMatchFilterWithWhiteList(IEnumerable <object> whiteList, ObjectListView olv, string text, StringComparison comparison) : base(olv, text, comparison) { if (!string.IsNullOrWhiteSpace(text) && text.Contains(" ")) { List <IModelFilter> filters = new List <IModelFilter>(); _tokens = text.Split(' '); foreach (string token in _tokens) { filters.Add(new TextMatchFilter(olv, token, comparison)); } _compositeFilter = new CompositeAllFilter(filters); } foreach (object o in whiteList) { _whiteList.Add(o); } }
private void btnFind_Click(object sender, EventArgs e) { var all = olvAllObjects.ModelFilter as CompositeAllFilter; if (all == null) { olvAllObjects.ModelFilter = all = new CompositeAllFilter(new List <IModelFilter>()); } if (_textMatchFilter != null && all.Filters.Contains(_textMatchFilter)) { all.Filters.Remove(_textMatchFilter); } _textMatchFilter = new TextMatchFilter(olvAllObjects, tbFind.Text, cbMatchCase.Checked ? StringComparison.CurrentCulture : StringComparison.CurrentCultureIgnoreCase); all.Filters.Add(_textMatchFilter); olvAllObjects.ModelFilter = all; }
private void FileFilterTextBoxTextChanged(object sender, EventArgs e) { this.fileListView.ModelFilter = null; var text = textBox2.Text; var filters = new List <IModelFilter>(); TextMatchFilter highlightingFilter = null; var words = text.Split(';'); highlightingFilter = TextMatchFilter.Contains(fileListView, words); foreach (var word in words) { var filter = TextMatchFilter.Contains(fileListView, word); filters.Add(filter); } var compositeFilter = new CompositeAllFilter(filters); fileListView.ModelFilter = highlightingFilter; fileListView.AdditionalFilter = compositeFilter; fileListView.DefaultRenderer = new HighlightTextRenderer(highlightingFilter); }
private void ShowIssues() { // Create a new filter based on the searchbox var tmfilter = TextMatchFilter.Contains(objectListView1, TxtSearch.Text); ModelFilter prfilter; if (checkBoxShowPrs.Checked == true) { // Keep everything prfilter = new ModelFilter(delegate(object x) { return(true); }); } else { // Filter out pull requests prfilter = new ModelFilter(delegate(object x) { return(!((TurtleIssue)x).IsPullRequest); }); } var combfilter = new CompositeAllFilter(new List <IModelFilter> { tmfilter, prfilter }); objectListView1.ModelFilter = combfilter; objectListView1.DefaultRenderer = new HighlightTextRenderer(tmfilter); }
void TimedFilter(ObjectListView olv, string txt) { TextMatchFilter filter = null; if (!String.IsNullOrEmpty(txt)) { filter = TextMatchFilter.Contains(olv, txt); } // Setup a default renderer to draw the filter matches if (filter == null) { olv.DefaultRenderer = null; } else { HighlightTextRenderer htr = new HighlightTextRenderer(filter); htr.FillBrush = Brushes.AliceBlue; olv.DefaultRenderer = htr; //new HighlightTextRenderer(filter); // Uncomment this line to see how the GDI+ rendering looks //olv.DefaultRenderer = new HighlightTextRenderer { Filter = filter, UseGdiTextRendering = false }; } // Some lists have renderers already installed HighlightTextRenderer highlightingRenderer = olv.GetColumn(0).Renderer as HighlightTextRenderer; if (highlightingRenderer != null) { highlightingRenderer.Filter = filter; } CompositeAllFilter currentFilter = null; if (filter != null) { // Get the existing model filters, if any, remove any existing TextMatchFilters, // then add the new TextMatchFilter if (olv.ModelFilter == null) // easy, just add the new one { List <IModelFilter> listOfFilters = new List <IModelFilter>(); listOfFilters.Add(filter); //add the TextMatchFilter CompositeAllFilter compositeFilter = new CompositeAllFilter(listOfFilters); olv.ModelFilter = compositeFilter; } else //need to remove existing TextMatchFilters, if any, than add the new one { currentFilter = (CompositeAllFilter)olv.ModelFilter; //find the first existing TextMatchFilter (should be at most one) and remove it foreach (IModelFilter m in currentFilter.Filters) { if (m is TextMatchFilter) { currentFilter.Filters.Remove(m); break; } } //add the new TextMatchFilter if (olv.ModelFilter != null) { (olv.ModelFilter as CompositeAllFilter).Filters.Add(filter); } else { List <IModelFilter> listOfFilters = new List <IModelFilter>(); listOfFilters.Add(filter); //add the TextMatchFilter CompositeAllFilter compositeFilter = new CompositeAllFilter(listOfFilters); olv.ModelFilter = compositeFilter; } } } else //remove text filter { if (olv.ModelFilter != null) { currentFilter = (CompositeAllFilter)olv.ModelFilter; //find and remove the first existing TextMatchFilter if any foreach (IModelFilter m in currentFilter.Filters) { if (m is TextMatchFilter) { currentFilter.Filters.Remove(m); break; } } if (currentFilter.Filters.Count == 0) { fastDataListView1.ModelFilter = null; } } } if (currentFilter != null) { fastDataListView1.ModelFilter = currentFilter; } updateStatusLine(fastDataListView1); }