Changeset 10813
- Timestamp:
- 05/07/14 13:24:56 (11 years ago)
- Location:
- branches/DataPreprocessing
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/CheckedFilterCollectionView.cs
r10785 r10813 27 27 protected override void addButton_Click(object sender, EventArgs e) 28 28 { 29 Content.Add(new ComparisonFilter()); 29 IFilter filter = new ComparisonFilter(); 30 Content.Add(filter); 31 Content.SetItemCheckedState(filter, false); 30 32 } 33 31 34 } 32 35 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/FilterView.cs
r10785 r10813 14 14 [Content(typeof(FilterContent), true)] 15 15 public partial class FilterView : ItemView { 16 //private CheckedItemCollectionView<IFilter> filterView;17 16 18 17 public FilterView() { … … 22 21 tbPercentage.Text = "0%"; 23 22 checkedFilterView.Content = new CheckedItemCollection<IFilter>(); 24 //filterView = new CheckedItemCollectionView<IFilter>();25 //filterView = new CheckedFilterCollectionView();26 /*filterView.Dock = DockStyle.Fill;27 filterView.Content = new CheckedItemCollection<IFilter>();28 * */29 23 checkedFilterView.Content.ItemsAdded += Content_ItemsAdded; 30 24 checkedFilterView.Content.ItemsRemoved += Content_ItemsRemoved; 31 25 checkedFilterView.Content.CheckedItemsChanged += Content_CheckedItemsChanged; 32 //groupBoxFilter.Controls.Add(filterView);*/33 26 } 34 27 35 28 public new FilterContent Content { 36 29 get { return (FilterContent)base.Content; } 37 set { base.Content = value; UpdateFilterInfo(); } 30 set { base.Content = value; } 31 } 32 33 protected override void OnContentChanged() 34 { 35 base.OnContentChanged(); 36 if (Content != null) 37 { 38 ImportFiltersFromContent(); 39 UpdateFilterInfo(); 40 } 38 41 } 39 42 … … 42 45 foreach (IFilter filter in e.Items) 43 46 { 44 filter.Active = !filter.Active;47 filter.Active = checkedFilterView.Content.ItemChecked(filter); 45 48 } 46 49 UpdateFilterInfo(); 50 ExportFiltersToContent(); 47 51 Refresh(); 48 52 ResumeRepaint(true); … … 64 68 65 69 tbFiltered.Text = filteredCnt.ToString(); 66 double percentage = filteredCnt * 100 / result.Length;70 double percentage = result.Length == 0 ? 0.0 : filteredCnt * 100 / result.Length; 67 71 tbPercentage.Text = percentage.ToString() + "%"; 68 72 tbTotal.Text = result.Length.ToString(); … … 78 82 foreach (IFilter filter in e.Items) { 79 83 filter.ConstrainedValue = Content.FilterLogic.PreprocessingData; 80 filter.Active = true;81 checkedFilterView.Content.SetItemCheckedState(filter, false);82 84 } 83 85 UpdateFilterInfo(); 86 ExportFiltersToContent(); 84 87 } 85 88 86 89 private void Content_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IFilter> e) { 87 90 UpdateFilterInfo(); 91 ExportFiltersToContent(); 88 92 } 89 93 … … 91 95 { 92 96 UpdateFilterInfo(); 97 ExportFiltersToContent(); 93 98 } 94 99 … … 98 103 } 99 104 105 private void ImportFiltersFromContent() 106 { 107 checkedFilterView.ItemCollection.AddRange(Content.Filters); 108 109 foreach (IFilter filter in checkedFilterView.ItemCollection) { 110 if (filter.Active) 111 { 112 checkedFilterView.Content.SetItemCheckedState(filter, true); 113 } 114 else 115 { 116 checkedFilterView.Content.SetItemCheckedState(filter, false); 117 } 118 119 } 120 } 121 122 private void ExportFiltersToContent() 123 { 124 Content.Filters = checkedFilterView.ItemCollection.ToList<IFilter>(); 125 } 100 126 } 101 127 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/FilterContent.cs
r10614 r10813 23 23 using HeuristicLab.Common; 24 24 using HeuristicLab.Core; 25 using System.Collections.Generic; 26 using HeuristicLab.DataPreprocessing.Filter; 25 27 26 28 namespace HeuristicLab.DataPreprocessing { 27 29 [Item("Filter", "Represents the filter grid.")] 28 30 public class FilterContent : Item, IViewShortcut { 31 32 private IList<IFilter> filters = new List<IFilter>(); 29 33 30 34 public static new Image StaticItemImage { … … 43 47 } 44 48 49 public IList<IFilter> Filters 50 { 51 get 52 { 53 return this.filters; 54 } 55 set 56 { 57 this.filters = value; 58 } 59 } 60 45 61 public FilterContent(FilterContent content, Cloner cloner) 46 62 : base(content, cloner) { … … 52 68 } 53 69 70 71 54 72 } 55 73 }
Note: See TracChangeset
for help on using the changeset viewer.