Changeset 10693 for branches/DataPreprocessing
- Timestamp:
- 04/02/14 11:22:11 (11 years ago)
- Location:
- branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/ComparisonFilterView.Designer.cs
r10637 r10693 45 45 /// </summary> 46 46 private void InitializeComponent() { 47 this.components = new System.ComponentModel.Container(); 47 48 this.lblAttr = new System.Windows.Forms.Label(); 48 49 this.lblFilterOperation = new System.Windows.Forms.Label(); … … 51 52 this.cbFilterOperation = new System.Windows.Forms.ComboBox(); 52 53 this.tbFilterData = new System.Windows.Forms.TextBox(); 54 this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components); 55 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 53 56 this.SuspendLayout(); 54 57 // … … 112 115 this.tbFilterData.Size = new System.Drawing.Size(247, 20); 113 116 this.tbFilterData.TabIndex = 5; 117 this.tbFilterData.Validating += new System.ComponentModel.CancelEventHandler(this.tbFilterData_Validating); 118 this.tbFilterData.Validated += new System.EventHandler(this.tbFilterData_Validated); 119 // 120 // errorProvider 121 // 122 this.errorProvider.ContainerControl = this; 114 123 // 115 124 // ComparisonFilterView … … 125 134 this.Name = "ComparisonFilterView"; 126 135 this.Size = new System.Drawing.Size(348, 97); 136 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 127 137 this.ResumeLayout(false); 128 138 this.PerformLayout(); … … 138 148 private System.Windows.Forms.ComboBox cbFilterOperation; 139 149 private System.Windows.Forms.TextBox tbFilterData; 150 private System.Windows.Forms.ErrorProvider errorProvider; 140 151 141 152 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/ComparisonFilterView.cs
r10637 r10693 28 28 using System.Collections; 29 29 using System; 30 using System.Collections.Generic; 30 31 31 32 namespace HeuristicLab.DataPreprocessing.Views { … … 62 63 tbFilterData.Text = Content.ConstraintData.GetValue(); 63 64 } 65 else 66 { 67 this.Content_ConstraintColumnChanged(cbAttr, EventArgs.Empty); // TODO 68 } 69 } 70 if (Content == null || Content.ConstraintData == null) 71 { 72 tbFilterData.Text = string.Empty; 73 } 74 else 75 { 76 tbFilterData.Text = Content.ConstraintData.GetValue(); 64 77 } 65 78 } … … 72 85 this.cbAttr.Items.AddRange(Content.ConstrainedValue.VariableNames.ToArray<string>()); 73 86 //if (!string.IsNullOrEmpty(Content.ConstraintColumn)) 74 this.cbAttr.SelectedItem = Content.ConstraintColumn; 87 this.cbAttr.SelectedItem = this.cbAttr.Items[Content.ConstraintColumn]; 88 89 if (Content.ConstraintColumn != null) 90 { 91 cbAttr.SelectedItem = Content.ConstraintColumn; 92 if (Content.ConstraintData != null) 93 tbFilterData.Text = Content.ConstraintData.GetValue(); 94 else 95 this.Content_ConstraintColumnChanged(cbAttr, EventArgs.Empty); 96 } 75 97 } 76 98 } … … 83 105 this.Content.ConstraintColumnChanged += new EventHandler(Content_ConstraintColumnChanged); 84 106 this.Content.ConstrainedValueChanged += new EventHandler(Content_ConstrainedValueChanged); 107 this.Content.ConstraintDataChanged += new EventHandler(Content_ConstrainedDataChanged); 85 108 } 86 109 … … 91 114 this.Content.ConstraintOperationChanged -= new EventHandler(Content_ComparisonOperationChanged); 92 115 this.Content.ConstraintColumnChanged -= new EventHandler(Content_ConstraintColumnChanged); 93 this.Content.ConstrainedValueChanged += new EventHandler(Content_ConstrainedValueChanged); 116 this.Content.ConstrainedValueChanged -= new EventHandler(Content_ConstrainedValueChanged); 117 this.Content.ConstraintDataChanged -= new EventHandler(Content_ConstrainedDataChanged); 94 118 } 95 119 … … 99 123 } 100 124 125 private void Content_ConstrainedDataChanged(object sender, EventArgs e) 126 { 127 if (Content.ConstraintData != null) 128 tbFilterData.Text = Content.ConstraintData.GetValue(); 129 else 130 tbFilterData.Text = string.Empty; 131 } 132 101 133 protected virtual void Content_ConstraintColumnChanged(object sender, EventArgs e) 102 134 { 103 135 if (Content.ConstrainedValue != null) 104 136 { 105 cbAttr.SelectedItem = Content.ConstraintColumn; 106 } 107 } 137 if (cbAttr.Items.IndexOf(cbAttr.SelectedItem) != Content.ConstraintColumn) 138 { 139 cbAttr.SelectedItem = this.cbAttr.Items[Content.ConstraintColumn]; 140 } 141 } 142 this.Content.ConstraintData = new StringValue(); 143 } 144 108 145 109 146 protected virtual void Content_ComparisonOperationChanged(object sender, EventArgs e) … … 116 153 { 117 154 base.SetEnabledStateOfControls(); 155 /* 118 156 cbAttr.Enabled = !this.ReadOnly && Content != null; 119 157 cbFilterOperation.Enabled = !this.ReadOnly && Content != null; 158 tbFilterData.Enabled = Content != null; 159 tbFilterData.ReadOnly = ReadOnly; 160 * */ 161 cbAttr.Enabled = Content != null && !Content.Active; 162 cbFilterOperation.Enabled = Content != null && !Content.Active; 163 tbFilterData.Enabled = Content != null && !Content.Active; 120 164 } 121 165 … … 135 179 protected virtual void Content_ActiveChanged(object sender, EventArgs e) 136 180 { 137 this.ReadOnly = Content.Active; 181 this.ReadOnly = !Content.Active; 182 SetEnabledStateOfControls(); 183 Refresh(); ResumeRepaint(true); 184 } 185 186 private void tbFilterData_Validated(object sender, EventArgs e) 187 { 188 IStringConvertibleValue value = new StringValue(); 189 value.SetValue(tbFilterData.Text); 190 Content.ConstraintData = value; 191 } 192 193 private void tbFilterData_Validating(object sender, System.ComponentModel.CancelEventArgs e) 194 { 195 string errorMessage = string.Empty; 196 if (!Content.ConstraintData.Validate(tbFilterData.Text, out errorMessage)) 197 { 198 errorProvider.SetError(tbFilterData, errorMessage); 199 e.Cancel = true; 200 } 201 else 202 errorProvider.Clear(); 138 203 } 139 204 -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/FilterView.cs
r10637 r10693 11 11 using HeuristicLab.Core; 12 12 using HeuristicLab.DataPreprocessing.Filter; 13 using HeuristicLab.Collections; 13 14 14 15 namespace HeuristicLab.DataPreprocessing.Views … … 30 31 filterView.Content = new CheckedItemCollection<IFilter>(); 31 32 filterView.Content.ItemsAdded += Content_ItemsAdded; 33 filterView.Content.ItemsRemoved += Content_ItemsRemoved; 32 34 filterView.Content.CheckedItemsChanged += Content_CheckedItemsChanged; 33 //filterView.ReadOnly = false;34 35 groupBoxFilter.Controls.Add(filterView); 35 36 } … … 48 49 filter.Active = !filter.Active; 49 50 } 51 UpdateFilterInfo(); 52 Refresh(); 53 ResumeRepaint(true); 54 } 55 56 private void UpdateFilterInfo() 57 { 50 58 List<IFilter> filters = filterView.ItemCollection.ToList<IFilter>(); 51 59 bool[] result = Content.FilterLogic.Preview(filters); 52 //todo: inform Logic for new filter 60 int filteredCnt = 0; 61 for (int i = 0; i < result.Length; i++) 62 { 63 if (result[i] == true) 64 filteredCnt++; 65 } 66 tbFiltered.Text = filteredCnt.ToString(); 67 double percentage = filteredCnt * 100 / result.Length; 68 tbPercentage.Text = percentage.ToString() + "%"; 69 tbTotal.Text = result.Length.ToString(); 53 70 } 54 71 … … 64 81 { 65 82 filter.ConstrainedValue = Content.FilterLogic.PreprocessingData; 83 filter.Active = true; 84 filterView.Content.SetItemCheckedState(filter, false); 66 85 } 86 UpdateFilterInfo(); 87 } 88 89 private void Content_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IFilter> e) 90 { 91 UpdateFilterInfo(); 67 92 } 68 93
Note: See TracChangeset
for help on using the changeset viewer.