Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/13/13 20:54:50 (11 years ago)
Author:
mkommend
Message:

#1734: Improved data importer usability:

  • new closing message
  • rename column reacts on lost focus
  • updated copyright info
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/View/ColumnGroupView.cs

    r9615 r9627  
    333333        this.commandChain.Add(new SortCommand(DataSet, this.ColumnGroup.Name,
    334334          e.ColumnIndex, (Control.ModifierKeys & Keys.Control) == Keys.Control));
    335         //this.UpdateSortGlyph();
    336         //this.dataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.DisplayedCells);
    337         //UpdateStateInformation();
    338335      }
    339336    }
     
    497494
    498495    private string ToExcelColumnIndex(int index) {
    499       //if (symb.Length == 1) {       // 'A' .. 'Z'
    500       //  return TryTranslateColumnIndexDigit(symb[0], out columnIndex);
    501       //} else if (symb.Length == 2) { // 'AA' ... 'ZZ'
    502       //  bool ok;
    503       //  int d0, d1;
    504       //  ok = TryTranslateColumnIndexDigit(symb[0], out d1) & TryTranslateColumnIndexDigit(symb[1], out d0);
    505       //  columnIndex = (d1 + 1) * 26 + d0;
    506       //  return ok;
    507       //} else {
    508       //  columnIndex = 0;
    509       //  return false;
    510       //}
    511496      #region digits
    512497      var digits = new char[] {
     
    553538    #region DataGridView virtual mode event handler
    554539    private void dataGridView_CellValueNeeded(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e) {
     540      if (!ColumnGroup.Columns.Any()) return;
    555541      e.Value = ColumnGroup.Columns.ElementAt(e.ColumnIndex).GetValue(e.RowIndex);
    556542    }
     
    603589    #region txtColumnName event handler
    604590    private void txtColumnName_Leave(object source, EventArgs e) {
     591      if (!this.txtColumnName.Visible) return;
    605592      this.txtColumnName.Visible = false;
     593
     594      DataGridView.HitTestInfo h = this.dataGridView.HitTest(txtColumnName.Location.X, txtColumnName.Location.Y);
     595      if (txtColumnName.Text != this.ColumnGroup.GetColumn(h.ColumnIndex).Name)
     596        this.commandChain.Add(new RenameColumnCommand(DataSet, this.ColumnGroup.Name, h.ColumnIndex, txtColumnName.Text));
    606597    }
    607598
     
    611602      if (e.KeyCode == Keys.Enter) {
    612603        DataGridView.HitTestInfo h = this.dataGridView.HitTest(txtColumnName.Location.X, txtColumnName.Location.Y);
    613         this.commandChain.Add(new RenameColumnCommand(DataSet, this.ColumnGroup.Name, h.ColumnIndex, txtColumnName.Text));
     604        if (txtColumnName.Text != this.ColumnGroup.GetColumn(h.ColumnIndex).Name)
     605          this.commandChain.Add(new RenameColumnCommand(DataSet, this.ColumnGroup.Name, h.ColumnIndex, txtColumnName.Text));
    614606      }
    615607      this.txtColumnName.Visible = false;
     
    653645
    654646    private bool CheckIfNewColumnGroupNameIsAllowed(string newName) {
    655       return !this.DataSet.ColumnGroups.Any(cg => cg.Name == newName);
     647      return this.DataSet.ColumnGroups.All(cg => cg.Name != newName);
    656648    }
    657649    #endregion
Note: See TracChangeset for help on using the changeset viewer.