Changeset 10637 for branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/ComparisonFilterView.cs
- Timestamp:
- 03/19/14 16:10:24 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/ComparisonFilterView.cs
r10589 r10637 20 20 #endregion 21 21 22 using System.Linq; 22 23 using HeuristicLab.Core.Views; 23 24 using HeuristicLab.Core; … … 26 27 using HeuristicLab.MainForm; 27 28 using System.Collections; 29 using System; 28 30 29 31 namespace HeuristicLab.DataPreprocessing.Views { … … 40 42 } 41 43 42 //protected override void OnContentChanged() {43 // base.OnContentChanged();44 // cbAttr.Items.Clear();45 // cbFilterOperation.Items.Clear();46 // if (Content != null)47 // {48 // cbFilterOperation.Items.AddRange(Content.AllowedConstraintOperations.ToArray());49 // if (Content.ConstraintOperation != null)50 // cbFilterOperation.SelectedItem = Content.ConstraintOperation;51 // else if (cbFilterOperation.Items.Count != 0)52 // cbFilterOperation.SelectedIndex = 0;53 // UpdateColumnComboBox();54 // ReadOnly = Content.Active;55 // }56 //}57 44 45 protected override void OnContentChanged() 46 { 47 base.OnContentChanged(); 48 cbAttr.Items.Clear(); //cmbConstraintColumn.Items.Clear(); 49 cbFilterOperation.Items.Clear(); //cmbConstraintOperation.Items.Clear(); 50 tbFilterData.Text = string.Empty; 51 if (Content != null) 52 { 53 cbFilterOperation.Items.AddRange(Content.AllowedConstraintOperations.ToArray()); 54 if (Content.ConstraintOperation != null) 55 cbFilterOperation.SelectedItem = Content.ConstraintOperation; 56 else if (cbFilterOperation.Items.Count != 0) 57 cbFilterOperation.SelectedIndex = 0; 58 UpdateColumnComboBox(); 59 ReadOnly = Content.Active; 60 if (Content.ConstraintData != null) 61 { 62 tbFilterData.Text = Content.ConstraintData.GetValue(); 63 } 64 } 65 } 58 66 67 protected virtual void UpdateColumnComboBox() 68 { 69 this.cbAttr.Items.Clear(); 70 if (Content.ConstrainedValue != null) 71 { 72 this.cbAttr.Items.AddRange(Content.ConstrainedValue.VariableNames.ToArray<string>()); 73 //if (!string.IsNullOrEmpty(Content.ConstraintColumn)) 74 this.cbAttr.SelectedItem = Content.ConstraintColumn; 75 } 76 } 59 77 60 //protected virtual void UpdateColumnComboBox() 61 //{ 62 // this.cbAttr.Items.Clear(); 63 // if (Content.ConstrainedValue != null) 64 // { 65 // this.cbAttr.Items.AddRange(((IStringConvertibleMatrix)Content.ConstrainedValue).ColumnNames.ToArray()); 66 // if (!string.IsNullOrEmpty(Content.ConstraintColumn)) 67 // this.cbAttr.SelectedItem = Content.ConstraintColumn; 68 // } 69 //} 78 protected override void RegisterContentEvents() 79 { 80 base.RegisterContentEvents(); 81 this.Content.ActiveChanged += new EventHandler(Content_ActiveChanged); 82 this.Content.ConstraintOperationChanged += new EventHandler(Content_ComparisonOperationChanged); 83 this.Content.ConstraintColumnChanged += new EventHandler(Content_ConstraintColumnChanged); 84 this.Content.ConstrainedValueChanged += new EventHandler(Content_ConstrainedValueChanged); 85 } 86 87 protected override void DeregisterContentEvents() 88 { 89 base.DeregisterContentEvents(); 90 this.Content.ActiveChanged -= new EventHandler(Content_ActiveChanged); 91 this.Content.ConstraintOperationChanged -= new EventHandler(Content_ComparisonOperationChanged); 92 this.Content.ConstraintColumnChanged -= new EventHandler(Content_ConstraintColumnChanged); 93 this.Content.ConstrainedValueChanged += new EventHandler(Content_ConstrainedValueChanged); 94 } 95 96 protected virtual void Content_ConstrainedValueChanged(object sender, EventArgs e) 97 { 98 this.UpdateColumnComboBox(); 99 } 100 101 protected virtual void Content_ConstraintColumnChanged(object sender, EventArgs e) 102 { 103 if (Content.ConstrainedValue != null) 104 { 105 cbAttr.SelectedItem = Content.ConstraintColumn; 106 } 107 } 108 109 protected virtual void Content_ComparisonOperationChanged(object sender, EventArgs e) 110 { 111 if (Content.ConstraintOperation != (ConstraintOperation)this.cbFilterOperation.SelectedItem) 112 this.cbFilterOperation.SelectedItem = Content.ConstraintOperation; 113 } 114 115 protected override void SetEnabledStateOfControls() 116 { 117 base.SetEnabledStateOfControls(); 118 cbAttr.Enabled = !this.ReadOnly && Content != null; 119 cbFilterOperation.Enabled = !this.ReadOnly && Content != null; 120 } 121 122 private void cbAttr_SelectedIndexChanged(object sender, EventArgs e) 123 { 124 if (Content.ConstrainedValue != null) 125 { 126 Content.ConstraintColumn = Content.ConstrainedValue.GetColumnIndex(cbAttr.SelectedItem.ToString()); 127 } 128 } 129 130 private void cbFilterOperation_SelectedIndexChanged(object sender, EventArgs e) 131 { 132 Content.ConstraintOperation = (ConstraintOperation)this.cbFilterOperation.SelectedItem; 133 } 134 135 protected virtual void Content_ActiveChanged(object sender, EventArgs e) 136 { 137 this.ReadOnly = Content.Active; 138 } 70 139 71 140 }
Note: See TracChangeset
for help on using the changeset viewer.