Changeset 10637
- Timestamp:
- 03/19/14 16:10:24 (11 years ago)
- Location:
- branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/ComparisonFilterView.Designer.cs
r10589 r10637 84 84 this.cbAttr.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 85 85 | System.Windows.Forms.AnchorStyles.Right))); 86 this.cbAttr.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 86 87 this.cbAttr.FormattingEnabled = true; 87 88 this.cbAttr.Location = new System.Drawing.Point(92, 12); … … 89 90 this.cbAttr.Size = new System.Drawing.Size(247, 21); 90 91 this.cbAttr.TabIndex = 3; 92 this.cbAttr.SelectedIndexChanged += new System.EventHandler(this.cbAttr_SelectedIndexChanged); 91 93 // 92 94 // cbFilterOperation … … 94 96 this.cbFilterOperation.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 95 97 | System.Windows.Forms.AnchorStyles.Right))); 98 this.cbFilterOperation.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 96 99 this.cbFilterOperation.FormattingEnabled = true; 97 100 this.cbFilterOperation.Location = new System.Drawing.Point(92, 39); … … 99 102 this.cbFilterOperation.Size = new System.Drawing.Size(247, 21); 100 103 this.cbFilterOperation.TabIndex = 4; 104 this.cbFilterOperation.SelectedIndexChanged += new System.EventHandler(this.cbFilterOperation_SelectedIndexChanged); 101 105 // 102 106 // tbFilterData -
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 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/FilterView.Designer.cs
r10589 r10637 31 31 this.groupBoxFilter = new System.Windows.Forms.GroupBox(); 32 32 this.groupBoxFilterInfo = new System.Windows.Forms.GroupBox(); 33 this.lblPercentage = new System.Windows.Forms.Label(); 34 this.tbPercentage = new System.Windows.Forms.TextBox(); 35 this.tbFiltered = new System.Windows.Forms.TextBox(); 36 this.lblFiltered = new System.Windows.Forms.Label(); 37 this.tbTotal = new System.Windows.Forms.TextBox(); 38 this.lblTotal = new System.Windows.Forms.Label(); 33 39 this.applyFilterButton = new System.Windows.Forms.Button(); 40 this.groupBoxFilterInfo.SuspendLayout(); 34 41 this.SuspendLayout(); 35 42 // … … 50 57 | System.Windows.Forms.AnchorStyles.Left) 51 58 | System.Windows.Forms.AnchorStyles.Right))); 59 this.groupBoxFilterInfo.Controls.Add(this.lblPercentage); 60 this.groupBoxFilterInfo.Controls.Add(this.tbPercentage); 61 this.groupBoxFilterInfo.Controls.Add(this.tbFiltered); 62 this.groupBoxFilterInfo.Controls.Add(this.lblFiltered); 63 this.groupBoxFilterInfo.Controls.Add(this.tbTotal); 64 this.groupBoxFilterInfo.Controls.Add(this.lblTotal); 52 65 this.groupBoxFilterInfo.Location = new System.Drawing.Point(4, 337); 53 66 this.groupBoxFilterInfo.Name = "groupBoxFilterInfo"; … … 56 69 this.groupBoxFilterInfo.TabStop = false; 57 70 this.groupBoxFilterInfo.Text = "Filter Info"; 71 // 72 // lblPercentage 73 // 74 this.lblPercentage.AutoSize = true; 75 this.lblPercentage.Location = new System.Drawing.Point(15, 74); 76 this.lblPercentage.Name = "lblPercentage"; 77 this.lblPercentage.Size = new System.Drawing.Size(65, 13); 78 this.lblPercentage.TabIndex = 11; 79 this.lblPercentage.Text = "Percentage:"; 80 // 81 // tbPercentage 82 // 83 this.tbPercentage.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 84 | System.Windows.Forms.AnchorStyles.Right))); 85 this.tbPercentage.Enabled = false; 86 this.tbPercentage.Location = new System.Drawing.Point(104, 71); 87 this.tbPercentage.Name = "tbPercentage"; 88 this.tbPercentage.Size = new System.Drawing.Size(549, 20); 89 this.tbPercentage.TabIndex = 10; 90 // 91 // tbFiltered 92 // 93 this.tbFiltered.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 94 | System.Windows.Forms.AnchorStyles.Right))); 95 this.tbFiltered.Enabled = false; 96 this.tbFiltered.Location = new System.Drawing.Point(104, 45); 97 this.tbFiltered.Name = "tbFiltered"; 98 this.tbFiltered.Size = new System.Drawing.Size(549, 20); 99 this.tbFiltered.TabIndex = 9; 100 // 101 // lblFiltered 102 // 103 this.lblFiltered.AutoSize = true; 104 this.lblFiltered.Location = new System.Drawing.Point(15, 47); 105 this.lblFiltered.Name = "lblFiltered"; 106 this.lblFiltered.Size = new System.Drawing.Size(41, 13); 107 this.lblFiltered.TabIndex = 8; 108 this.lblFiltered.Text = "Filtered"; 109 // 110 // tbTotal 111 // 112 this.tbTotal.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 113 | System.Windows.Forms.AnchorStyles.Right))); 114 this.tbTotal.Enabled = false; 115 this.tbTotal.Location = new System.Drawing.Point(104, 19); 116 this.tbTotal.Name = "tbTotal"; 117 this.tbTotal.Size = new System.Drawing.Size(549, 20); 118 this.tbTotal.TabIndex = 7; 119 // 120 // lblTotal 121 // 122 this.lblTotal.AutoSize = true; 123 this.lblTotal.Location = new System.Drawing.Point(15, 21); 124 this.lblTotal.Name = "lblTotal"; 125 this.lblTotal.Size = new System.Drawing.Size(34, 13); 126 this.lblTotal.TabIndex = 6; 127 this.lblTotal.Text = "Total:"; 58 128 // 59 129 // applyFilterButton … … 77 147 this.Name = "FilterView"; 78 148 this.Size = new System.Drawing.Size(670, 506); 149 this.groupBoxFilterInfo.ResumeLayout(false); 150 this.groupBoxFilterInfo.PerformLayout(); 79 151 this.ResumeLayout(false); 80 152 … … 86 158 private System.Windows.Forms.GroupBox groupBoxFilterInfo; 87 159 private System.Windows.Forms.Button applyFilterButton; 160 private System.Windows.Forms.TextBox tbTotal; 161 private System.Windows.Forms.Label lblTotal; 162 private System.Windows.Forms.Label lblPercentage; 163 private System.Windows.Forms.TextBox tbPercentage; 164 private System.Windows.Forms.TextBox tbFiltered; 165 private System.Windows.Forms.Label lblFiltered; 88 166 89 167 -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/FilterView.cs
r10589 r10637 23 23 { 24 24 InitializeComponent(); 25 tbTotal.Text = "0"; 26 tbFiltered.Text = "0"; 27 tbPercentage.Text = "0%"; 25 28 filterView = new CheckedItemCollectionView<IFilter>(); 26 29 filterView.Dock = DockStyle.Fill; 30 filterView.Content = new CheckedItemCollection<IFilter>(); 31 filterView.Content.ItemsAdded += Content_ItemsAdded; 32 filterView.Content.CheckedItemsChanged += Content_CheckedItemsChanged; 33 //filterView.ReadOnly = false; 27 34 groupBoxFilter.Controls.Add(filterView); 28 filterView.Content = new CheckedItemCollection<IFilter>();29 filterView.Content.CheckedItemsChanged += Content_CheckedItemsChanged;30 35 } 31 36 … … 33 38 { 34 39 get { return (FilterContent)base.Content; } 35 set { base.Content = value; }40 set { base.Content = value; tbTotal.Text = Content.FilterLogic.PreprocessingData.Rows.ToString(); } 36 41 } 37 42 38 43 private void Content_CheckedItemsChanged(object sender, Collections.CollectionItemsChangedEventArgs<IFilter> e) 39 44 { 45 //change active state of filters 46 foreach (IFilter filter in e.Items) 47 { 48 filter.Active = !filter.Active; 49 } 50 List<IFilter> filters = filterView.ItemCollection.ToList<IFilter>(); 51 bool[] result = Content.FilterLogic.Preview(filters); 40 52 //todo: inform Logic for new filter 41 53 } … … 46 58 } 47 59 60 //whenever a new filter is added the preprocessing data is set to the filter 61 private void Content_ItemsAdded(object sender, Collections.CollectionItemsChangedEventArgs<IFilter> e) 62 { 63 foreach (IFilter filter in e.Items) 64 { 65 filter.ConstrainedValue = Content.FilterLogic.PreprocessingData; 66 } 67 } 68 48 69 } 49 70 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/HeuristicLab.DataPreprocessing.Views-3.3.csproj
r10633 r10637 22 22 <ErrorReport>prompt</ErrorReport> 23 23 <WarningLevel>4</WarningLevel> 24 <UseVSHostingProcess>false</UseVSHostingProcess> 24 25 </PropertyGroup> 25 26 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> … … 220 221 </ProjectReference> 221 222 </ItemGroup> 223 <ItemGroup> 224 <EmbeddedResource Include="ComparisonFilterView.resx"> 225 <DependentUpon>ComparisonFilterView.cs</DependentUpon> 226 </EmbeddedResource> 227 <EmbeddedResource Include="DataPreprocessingView.resx"> 228 <DependentUpon>DataPreprocessingView.cs</DependentUpon> 229 </EmbeddedResource> 230 <EmbeddedResource Include="FilterView.resx"> 231 <DependentUpon>FilterView.cs</DependentUpon> 232 </EmbeddedResource> 233 </ItemGroup> 222 234 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 223 235 <PropertyGroup>
Note: See TracChangeset
for help on using the changeset viewer.