Changeset 12986


Ignore:
Timestamp:
10/07/15 16:47:17 (4 years ago)
Author:
pfleck
Message:

#2486

  • Added buttons for adding columns and rows.
  • Fixed a bug with row names.
Location:
trunk/sources
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.DataPreprocessing.Views/3.4/DataGridContentView.Designer.cs

    r12012 r12986  
    6363      this.btnReplace = new System.Windows.Forms.Button();
    6464      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
     65      this.addLineButton = new System.Windows.Forms.Button();
     66      this.addColumnButton = new System.Windows.Forms.Button();
    6567      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    6668      this.contextMenuCell.SuspendLayout();
     
    7072      //
    7173      this.rowsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)));
    72       this.rowsTextBox.Enabled = false;
    7374      this.errorProvider.SetIconAlignment(this.rowsTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    7475      this.errorProvider.SetIconPadding(this.rowsTextBox, 2);
    75       this.rowsTextBox.ReadOnly = true;
    7676      this.rowsTextBox.Size = new System.Drawing.Size(71, 20);
    7777      //
     
    7979      //
    8080      this.columnsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)));
    81       this.columnsTextBox.Enabled = false;
    82       this.columnsTextBox.ReadOnly = true;
    8381      this.columnsTextBox.Size = new System.Drawing.Size(71, 20);
    8482      //
    85       // statisticsTextBox
    86       //
    87       this.statisticsTextBox.Size = new System.Drawing.Size(522, 13);
    88       //
    8983      // btnApplySort
    9084      //
    91       this.btnApplySort.Location = new System.Drawing.Point(349, 19);
     85      this.btnApplySort.Location = new System.Drawing.Point(320, -1);
    9286      this.btnApplySort.Name = "btnApplySort";
    93       this.btnApplySort.Size = new System.Drawing.Size(75, 23);
     87      this.btnApplySort.Size = new System.Drawing.Size(87, 23);
    9488      this.btnApplySort.TabIndex = 7;
    9589      this.btnApplySort.Text = "Apply Sort";
     
    10498            this.replaceValueOverSelectionToolStripMenuItem});
    10599      this.contextMenuCell.Name = "contextMenuCell";
    106       this.contextMenuCell.Size = new System.Drawing.Size(225, 70);
     100      this.contextMenuCell.Size = new System.Drawing.Size(225, 48);
    107101      //
    108102      // replaceValueOverColumnToolStripMenuItem
     
    154148      this.interpolationToolStripMenuItem_Column.Click += new System.EventHandler(this.ReplaceWithInterpolation_Column_Click);
    155149      //
    156       // smoothingToolStripMenuItem
    157       //
    158       this.smoothingToolStripMenuItem_Column.Name = "smoothingToolStripMenuItem";
     150      // smoothingToolStripMenuItem_Column
     151      //
     152      this.smoothingToolStripMenuItem_Column.Name = "smoothingToolStripMenuItem_Column";
    159153      this.smoothingToolStripMenuItem_Column.Size = new System.Drawing.Size(155, 22);
    160154      this.smoothingToolStripMenuItem_Column.Text = "Smoothing";
     
    202196      // btnSearch
    203197      //
    204       this.btnSearch.Location = new System.Drawing.Point(201, 19);
     198      this.btnSearch.Location = new System.Drawing.Point(173, -1);
    205199      this.btnSearch.Name = "btnSearch";
    206200      this.btnSearch.Size = new System.Drawing.Size(53, 23);
     
    213207      // btnReplace
    214208      //
    215       this.btnReplace.Location = new System.Drawing.Point(260, 19);
     209      this.btnReplace.Location = new System.Drawing.Point(232, -1);
    216210      this.btnReplace.Name = "btnReplace";
    217211      this.btnReplace.Size = new System.Drawing.Size(55, 23);
     
    222216      this.btnReplace.Click += new System.EventHandler(this.btnReplace_Click);
    223217      //
     218      // addLineButton
     219      //
     220      this.addLineButton.Location = new System.Drawing.Point(173, 25);
     221      this.addLineButton.Name = "addLineButton";
     222      this.addLineButton.Size = new System.Drawing.Size(114, 23);
     223      this.addLineButton.TabIndex = 10;
     224      this.addLineButton.Text = "Add Line";
     225      this.addLineButton.UseVisualStyleBackColor = true;
     226      this.addLineButton.Click += new System.EventHandler(this.addLineButton_Click);
     227      //
     228      // addColumnButton
     229      //
     230      this.addColumnButton.Location = new System.Drawing.Point(293, 25);
     231      this.addColumnButton.Name = "addColumnButton";
     232      this.addColumnButton.Size = new System.Drawing.Size(114, 23);
     233      this.addColumnButton.TabIndex = 10;
     234      this.addColumnButton.Text = "Add Column";
     235      this.addColumnButton.UseVisualStyleBackColor = true;
     236      this.addColumnButton.Click += new System.EventHandler(this.addColumnButton_Click);
     237      //
    224238      // DataGridContentView
    225239      //
    226240      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    227241      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     242      this.Controls.Add(this.addColumnButton);
     243      this.Controls.Add(this.addLineButton);
    228244      this.Controls.Add(this.btnReplace);
    229245      this.Controls.Add(this.btnSearch);
    230246      this.Controls.Add(this.btnApplySort);
    231247      this.Name = "DataGridContentView";
    232       this.Size = new System.Drawing.Size(528, 404);
    233248      this.Controls.SetChildIndex(this.statisticsTextBox, 0);
    234249      this.Controls.SetChildIndex(this.rowsLabel, 0);
     
    239254      this.Controls.SetChildIndex(this.btnSearch, 0);
    240255      this.Controls.SetChildIndex(this.btnReplace, 0);
     256      this.Controls.SetChildIndex(this.addLineButton, 0);
     257      this.Controls.SetChildIndex(this.addColumnButton, 0);
    241258      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    242259      this.contextMenuCell.ResumeLayout(false);
     
    265282    private System.Windows.Forms.ToolTip toolTip;
    266283    private System.Windows.Forms.ToolStripMenuItem smoothingToolStripMenuItem_Column;
     284    private System.Windows.Forms.Button addLineButton;
     285    private System.Windows.Forms.Button addColumnButton;
    267286  }
    268287}
  • trunk/sources/HeuristicLab.DataPreprocessing.Views/3.4/DataGridContentView.cs

    r12983 r12986  
    164164
    165165      ClearSorting();
    166       //UpdateData(); // rownames are created on DataGrid creation. Therefore, no update possible, yet.
    167166    }
    168167
     
    632631    #endregion
    633632
     633    private void addLineButton_Click(object sender, EventArgs e) {
     634      Content.PreProcessingData.InsertRow(Content.Rows);
     635    }
     636
     637    private void addColumnButton_Click(object sender, EventArgs e) {
     638      Content.PreProcessingData.InsertColumn<double>(Content.Columns.ToString(), Content.Columns);
     639    }
     640
    634641  }
    635642}
  • trunk/sources/HeuristicLab.DataPreprocessing/3.4/Implementations/DataGridContent.cs

    r12983 r12986  
    4141    public IFilterLogic FilterLogic { get; private set; }
    4242
    43     private IEnumerable<string> rowNames;
    44 
    4543    public int Rows {
    4644      get {
     
    7270    public IEnumerable<string> RowNames {
    7371      get {
    74         return rowNames;
     72        return Enumerable.Range(1, Rows).Select(n => n.ToString());
    7573      }
    7674      set {
     
    103101      FilterLogic = theFilterLogic;
    104102      PreProcessingData = preProcessingData;
    105       createRowNames();
    106103    }
    107104
     
    116113    public void DeleteRows(IEnumerable<int> rows) {
    117114      PreProcessingData.DeleteRowsWithIndices(rows);
    118       createRowNames();
    119115    }
    120116
     
    133129    public bool SetValue(string value, int rowIndex, int columnIndex) {
    134130      return PreProcessingData.SetValue(value, columnIndex, rowIndex);
    135     }
    136 
    137     private void createRowNames() {
    138       rowNames = Enumerable.Range(1, Rows).Select(n => n.ToString());
    139131    }
    140132
  • trunk/sources/HeuristicLab.DataPreprocessing/3.4/Implementations/TransactionalPreprocessingData.cs

    r12983 r12986  
    225225      if (!IsInTransaction)
    226226        OnChanged(DataPreprocessingChangedEventType.DeleteRow, -1, -1);
     227      ResetPartitions();
    227228    }
    228229
     
    235236      if (!IsInTransaction)
    236237        OnChanged(DataPreprocessingChangedEventType.AddRow, -1, rowIndex);
     238      ResetPartitions();
    237239    }
    238240
     
    244246      if (!IsInTransaction)
    245247        OnChanged(DataPreprocessingChangedEventType.DeleteRow, -1, rowIndex);
     248      ResetPartitions();
    246249    }
    247250
     
    284287    }
    285288
     289
     290    private void ResetPartitions() {
     291      TrainingPartition = new IntRange();
     292      TestPartition = new IntRange();
     293    }
    286294
    287295    #endregion
Note: See TracChangeset for help on using the changeset viewer.