Changeset 13252
- Timestamp:
- 11/18/15 14:10:12 (9 years ago)
- Location:
- trunk/sources
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.DataPreprocessing.Views/3.4/DataGridContentView.Designer.cs
r12986 r13252 63 63 this.btnReplace = new System.Windows.Forms.Button(); 64 64 this.toolTip = new System.Windows.Forms.ToolTip(this.components); 65 this.add LineButton = new System.Windows.Forms.Button();65 this.addRowButton = new System.Windows.Forms.Button(); 66 66 this.addColumnButton = new System.Windows.Forms.Button(); 67 this.renameColumnsButton = new System.Windows.Forms.Button(); 67 68 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 68 69 this.contextMenuCell.SuspendLayout(); … … 81 82 this.columnsTextBox.Size = new System.Drawing.Size(71, 20); 82 83 // 84 // statisticsTextBox 85 // 86 this.statisticsTextBox.Location = new System.Drawing.Point(3, 387); 87 this.statisticsTextBox.Size = new System.Drawing.Size(421, 13); 88 // 83 89 // btnApplySort 84 90 // 85 this.btnApplySort.Location = new System.Drawing.Point( 320, -1);91 this.btnApplySort.Location = new System.Drawing.Point(234, 0); 86 92 this.btnApplySort.Name = "btnApplySort"; 87 this.btnApplySort.Size = new System.Drawing.Size( 87, 23);93 this.btnApplySort.Size = new System.Drawing.Size(104, 23); 88 94 this.btnApplySort.TabIndex = 7; 89 95 this.btnApplySort.Text = "Apply Sort"; … … 196 202 // btnSearch 197 203 // 198 this.btnSearch.Location = new System.Drawing.Point(173, -1);204 this.btnSearch.Location = new System.Drawing.Point(173, 0); 199 205 this.btnSearch.Name = "btnSearch"; 200 this.btnSearch.Size = new System.Drawing.Size(5 3, 23);206 this.btnSearch.Size = new System.Drawing.Size(55, 23); 201 207 this.btnSearch.TabIndex = 8; 202 208 this.btnSearch.Text = "Search"; … … 207 213 // btnReplace 208 214 // 209 this.btnReplace.Location = new System.Drawing.Point( 232, -1);215 this.btnReplace.Location = new System.Drawing.Point(173, 26); 210 216 this.btnReplace.Name = "btnReplace"; 211 217 this.btnReplace.Size = new System.Drawing.Size(55, 23); … … 216 222 this.btnReplace.Click += new System.EventHandler(this.btnReplace_Click); 217 223 // 218 // add LineButton219 // 220 this.add LineButton.Location = new System.Drawing.Point(173, 25);221 this.add LineButton.Name = "addLineButton";222 this.add LineButton.Size = new System.Drawing.Size(114, 23);223 this.add LineButton.TabIndex = 10;224 this.add LineButton.Text = "Add Line";225 this.add LineButton.UseVisualStyleBackColor = true;226 this.add LineButton.Click += new System.EventHandler(this.addLineButton_Click);224 // addRowButton 225 // 226 this.addRowButton.Location = new System.Drawing.Point(344, 26); 227 this.addRowButton.Name = "addRowButton"; 228 this.addRowButton.Size = new System.Drawing.Size(76, 23); 229 this.addRowButton.TabIndex = 10; 230 this.addRowButton.Text = "Add Row"; 231 this.addRowButton.UseVisualStyleBackColor = true; 232 this.addRowButton.Click += new System.EventHandler(this.addRowButton_Click); 227 233 // 228 234 // addColumnButton 229 235 // 230 this.addColumnButton.Location = new System.Drawing.Point( 293, 25);236 this.addColumnButton.Location = new System.Drawing.Point(344, 0); 231 237 this.addColumnButton.Name = "addColumnButton"; 232 this.addColumnButton.Size = new System.Drawing.Size( 114, 23);238 this.addColumnButton.Size = new System.Drawing.Size(76, 23); 233 239 this.addColumnButton.TabIndex = 10; 234 240 this.addColumnButton.Text = "Add Column"; … … 236 242 this.addColumnButton.Click += new System.EventHandler(this.addColumnButton_Click); 237 243 // 244 // renameColumnsButton 245 // 246 this.renameColumnsButton.Location = new System.Drawing.Point(234, 26); 247 this.renameColumnsButton.Name = "renameColumnsButton"; 248 this.renameColumnsButton.Size = new System.Drawing.Size(104, 23); 249 this.renameColumnsButton.TabIndex = 11; 250 this.renameColumnsButton.Text = "Rename Columns"; 251 this.renameColumnsButton.UseVisualStyleBackColor = true; 252 this.renameColumnsButton.Click += new System.EventHandler(this.renameColumnsButton_Click); 253 // 238 254 // DataGridContentView 239 255 // 240 256 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 241 257 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 258 this.Controls.Add(this.renameColumnsButton); 242 259 this.Controls.Add(this.addColumnButton); 243 this.Controls.Add(this.add LineButton);260 this.Controls.Add(this.addRowButton); 244 261 this.Controls.Add(this.btnReplace); 245 262 this.Controls.Add(this.btnSearch); 246 263 this.Controls.Add(this.btnApplySort); 247 264 this.Name = "DataGridContentView"; 265 this.Size = new System.Drawing.Size(430, 403); 266 this.Controls.SetChildIndex(this.btnApplySort, 0); 267 this.Controls.SetChildIndex(this.btnSearch, 0); 268 this.Controls.SetChildIndex(this.btnReplace, 0); 269 this.Controls.SetChildIndex(this.addRowButton, 0); 270 this.Controls.SetChildIndex(this.addColumnButton, 0); 271 this.Controls.SetChildIndex(this.renameColumnsButton, 0); 248 272 this.Controls.SetChildIndex(this.statisticsTextBox, 0); 249 273 this.Controls.SetChildIndex(this.rowsLabel, 0); … … 251 275 this.Controls.SetChildIndex(this.rowsTextBox, 0); 252 276 this.Controls.SetChildIndex(this.columnsTextBox, 0); 253 this.Controls.SetChildIndex(this.btnApplySort, 0);254 this.Controls.SetChildIndex(this.btnSearch, 0);255 this.Controls.SetChildIndex(this.btnReplace, 0);256 this.Controls.SetChildIndex(this.addLineButton, 0);257 this.Controls.SetChildIndex(this.addColumnButton, 0);258 277 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 259 278 this.contextMenuCell.ResumeLayout(false); … … 282 301 private System.Windows.Forms.ToolTip toolTip; 283 302 private System.Windows.Forms.ToolStripMenuItem smoothingToolStripMenuItem_Column; 284 private System.Windows.Forms.Button add LineButton;303 private System.Windows.Forms.Button addRowButton; 285 304 private System.Windows.Forms.Button addColumnButton; 305 private System.Windows.Forms.Button renameColumnsButton; 286 306 } 287 307 } -
trunk/sources/HeuristicLab.DataPreprocessing.Views/3.4/DataGridContentView.cs
r12986 r13252 59 59 InitializeComponent(); 60 60 dataGridView.CellMouseClick += dataGridView_CellMouseClick; 61 dataGridView.RowHeaderMouseClick += dataGridView_RowHeaderMouseClick; 61 62 dataGridView.KeyDown += dataGridView_KeyDown; 62 63 dataGridView.MouseUp += dataGridView_MouseUp; … … 184 185 protected override void dataGridView_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { 185 186 if (Content != null) { 186 if (e.Button == System.Windows.Forms.MouseButtons.Left) {187 if (e.Button == MouseButtons.Left) { 187 188 dataGridView.Focus(); 188 189 dataGridView.ClearSelection(); … … 193 194 dataGridView[e.ColumnIndex, i].Selected = true; 194 195 } 195 } else if (Content.SortableView) { 196 } else if (e.Button == MouseButtons.Middle) { 197 int newIndex = e.ColumnIndex >= 0 ? e.ColumnIndex : 0; 198 Content.PreProcessingData.InsertColumn<double>(newIndex.ToString(), newIndex); 199 } else if (e.Button == MouseButtons.Right && Content.SortableView) { 196 200 SortColumn(e.ColumnIndex); 197 201 } 198 202 } 199 203 searchIterator = null; 204 } 205 private void dataGridView_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { 206 if (Content != null) { 207 if (e.Button == MouseButtons.Middle) { 208 int newIndex = e.RowIndex >= 0 ? e.RowIndex : 0; 209 Content.PreProcessingData.InsertRow(newIndex); 210 } 211 } 200 212 } 201 213 … … 469 481 private void dataGridView_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) { 470 482 if (Content == null) return; 471 if (e.Button == System.Windows.Forms.MouseButtons.Right && !(e.ColumnIndex != -1 && e.RowIndex == -1)) {483 if (e.Button == MouseButtons.Right && !(e.ColumnIndex != -1 && e.RowIndex == -1)) { 472 484 if (e.ColumnIndex == -1 || e.RowIndex == -1) { 473 485 replaceValueOverColumnToolStripMenuItem.Visible = false; … … 631 643 #endregion 632 644 633 private void add LineButton_Click(object sender, EventArgs e) {645 private void addRowButton_Click(object sender, EventArgs e) { 634 646 Content.PreProcessingData.InsertRow(Content.Rows); 635 647 } … … 639 651 } 640 652 653 private void renameColumnsButton_Click(object sender, EventArgs e) { 654 var renameDialog = new RenameColumnsDialog(Content.ColumnNames); 655 656 if (renameDialog.ShowDialog(this) == DialogResult.OK) { 657 Content.PreProcessingData.RenameColumns(renameDialog.ColumnNames); 658 } 659 } 641 660 } 642 661 } -
trunk/sources/HeuristicLab.DataPreprocessing.Views/3.4/HeuristicLab.DataPreprocessing.Views-3.4.csproj
r12683 r13252 120 120 <Compile Include="ComparisonFilterView.Designer.cs"> 121 121 <DependentUpon>ComparisonFilterView.cs</DependentUpon> 122 </Compile> 123 <Compile Include="RenameColumnsDialog.cs"> 124 <SubType>Form</SubType> 125 </Compile> 126 <Compile Include="RenameColumnsDialog.Designer.cs"> 127 <DependentUpon>RenameColumnsDialog.cs</DependentUpon> 122 128 </Compile> 123 129 <Compile Include="ScatterPlotSingleView.cs"> -
trunk/sources/HeuristicLab.DataPreprocessing/3.4/Implementations/FilteredPreprocessingData.cs
r12059 r13252 119 119 throw new InvalidOperationException("DeleteColumn not possible while data is filtered"); 120 120 originalData.DeleteColumn(columnIndex); 121 } 122 123 public void RenameColumn(int columnIndex, string name) { 124 if (IsFiltered) 125 throw new InvalidOperationException("RenameColumn not possible while data is filtered"); 126 originalData.RenameColumn(columnIndex, name); 127 } 128 129 public void RenameColumns(IList<string> names) { 130 if (IsFiltered) 131 throw new InvalidOperationException("RenameColumns not possible while data is filtered"); 132 originalData.RenameColumns(names); 121 133 } 122 134 -
trunk/sources/HeuristicLab.DataPreprocessing/3.4/Implementations/PreprocessingData.cs
r12509 r13252 196 196 public abstract void DeleteColumn(int columnIndex); 197 197 198 public abstract void RenameColumn(int columnIndex, string name); 199 public abstract void RenameColumns(IList<string> list); 200 198 201 public abstract Dataset ExportToDataset(); 199 202 -
trunk/sources/HeuristicLab.DataPreprocessing/3.4/Implementations/TransactionalPreprocessingData.cs
r12986 r13252 265 265 } 266 266 267 public override void RenameColumn(int columnIndex, string name) { 268 SaveSnapshot(DataPreprocessingChangedEventType.ChangeColumn, columnIndex, -1); 269 if (columnIndex < 0 || columnIndex > variableNames.Count) 270 throw new ArgumentOutOfRangeException("columnIndex"); 271 variableNames[columnIndex] = name; 272 273 if (!IsInTransaction) 274 OnChanged(DataPreprocessingChangedEventType.ChangeColumn, -1, -1); 275 } 276 277 public override void RenameColumns(IList<string> names) { 278 if (names == null) throw new ArgumentNullException("names"); 279 if (names.Count != variableNames.Count) throw new ArgumentException("number of names must match the number of columns.", "names"); 280 281 SaveSnapshot(DataPreprocessingChangedEventType.ChangeColumn, -1, -1); 282 for (int i = 0; i < names.Count; i++) 283 variableNames[i] = names[i]; 284 285 if (!IsInTransaction) 286 OnChanged(DataPreprocessingChangedEventType.ChangeColumn, -1, -1); 287 } 288 267 289 public override Dataset ExportToDataset() { 268 290 IList<IList> values = new List<IList>(); -
trunk/sources/HeuristicLab.DataPreprocessing/3.4/Interfaces/IPreprocessingData.cs
r12059 r13252 47 47 void DeleteColumn(int columnIndex); 48 48 49 void RenameColumn(int columnIndex, string name); 50 void RenameColumns(IList<string> names); 51 49 52 bool AreAllStringColumns(IEnumerable<int> columnIndices); 50 53 bool Validate(string value, out string errorMessage, int columnIndex); -
trunk/sources/HeuristicLab.DataPreprocessing/3.4/ProblemDataCreator.cs
r12983 r13252 63 63 var inputVariables = oldProblemData.InputVariables.ToDictionary(x => x.Value, x => x); 64 64 foreach (var variable in problemData.InputVariables) { 65 bool isChecked = oldProblemData.InputVariables.Contains(variable) && oldProblemData.InputVariables.ItemChecked(inputVariables[variable.Value]);65 bool isChecked = inputVariables.ContainsKey(variable.Value) && oldProblemData.InputVariables.ItemChecked(inputVariables[variable.Value]); 66 66 problemData.InputVariables.SetItemCheckedState(variable, isChecked); 67 67 } … … 72 72 private IDataAnalysisProblemData CreateRegressionData(RegressionProblemData oldProblemData) { 73 73 var targetVariable = oldProblemData.TargetVariable; 74 // target variable must be double and must exist in the new dataset 75 return new RegressionProblemData(ExportedDataset, GetDoubleInputVariables(targetVariable), targetVariable, Transformations); 74 if (!context.Data.VariableNames.Contains(targetVariable)) 75 targetVariable = context.Data.VariableNames.First(); 76 var inputVariables = GetDoubleInputVariables(targetVariable); 77 var newProblemData = new RegressionProblemData(ExportedDataset, inputVariables, targetVariable, Transformations); 78 return newProblemData; 76 79 } 77 80 78 81 private IDataAnalysisProblemData CreateClassificationData(ClassificationProblemData oldProblemData) { 79 // target variable must be double and must exist in the new dataset80 82 var targetVariable = oldProblemData.TargetVariable; 81 var newProblemData = new ClassificationProblemData(ExportedDataset, GetDoubleInputVariables(targetVariable), targetVariable, Transformations); 83 if (!context.Data.VariableNames.Contains(targetVariable)) 84 targetVariable = context.Data.VariableNames.First(); 85 var inputVariables = GetDoubleInputVariables(targetVariable); 86 var newProblemData = new ClassificationProblemData(ExportedDataset, inputVariables, targetVariable, Transformations); 82 87 newProblemData.PositiveClass = oldProblemData.PositiveClass; 83 88 return newProblemData;
Note: See TracChangeset
for help on using the changeset viewer.