Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9627


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
Location:
branches/HeuristicLab.DataImporter
Files:
3 added
8 edited
1 copied

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
  • branches/HeuristicLab.DataImporter/HeuristicLab.DataImporter.DataProcessor/DataProcessorView.cs

    r9615 r9627  
    343343    private bool CheckUnsavedChanges() {
    344344      if (this.lastSavedCommand != this.dataProcessor.CommandChain.LastExecutedCommand) {
    345         DialogResult result = MessageBox.Show("Save changes (Yes), discard changes (No) or cancel the current action (Cancel)?", "Warning", MessageBoxButtons.YesNoCancel);
     345        DialogResult result = new SaveDialog().ShowDialog(this);
    346346        if (result == DialogResult.Yes)
    347           this.Save();
     347          return this.Save();
    348348        else if (result == DialogResult.Cancel)
    349349          return false;
     
    352352    }
    353353
    354     private void Save() {
     354    private bool Save() {
    355355      if (string.IsNullOrEmpty(this.lastSavedFile))
    356         this.SaveAs();
    357       else
    358         this.Save(dataProcessor, this.lastSavedFile);
     356        return this.SaveAs();
     357
     358      this.Save(dataProcessor, this.lastSavedFile);
     359      return true;
    359360    }
    360361
     
    372373    }
    373374
    374     private void SaveAs() {
     375    private bool SaveAs() {
    375376      SaveFileDialog saveFileDialog = new SaveFileDialog();
    376377      saveFileDialog.AddExtension = true;
     
    396397          Save(dataProcessor, lastSavedFile);
    397398        }
    398       }
     399        return true;
     400      }
     401      return false;
    399402    }
    400403
  • branches/HeuristicLab.DataImporter/HeuristicLab.DataImporter.DataProcessor/HeuristicLab.DataImporter.DataProcessor.csproj

    r8532 r9627  
    145145    </Compile>
    146146    <None Include="Plugin.cs.frame" />
     147    <Compile Include="SaveDialog.cs">
     148      <SubType>Form</SubType>
     149    </Compile>
     150    <Compile Include="SaveDialog.Designer.cs">
     151      <DependentUpon>SaveDialog.cs</DependentUpon>
     152    </Compile>
    147153    <Compile Include="ProgressDialog.cs">
    148154      <SubType>Form</SubType>
     
    210216      <Generator>ResXFileCodeGenerator</Generator>
    211217      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
     218    </EmbeddedResource>
     219    <EmbeddedResource Include="SaveDialog.resx">
     220      <DependentUpon>SaveDialog.cs</DependentUpon>
    212221    </EmbeddedResource>
    213222  </ItemGroup>
     
    254263    </BootstrapperPackage>
    255264  </ItemGroup>
     265  <ItemGroup>
     266    <None Include="Resources\VS2008ImageLibrary_Actions_Warning.png" />
     267  </ItemGroup>
    256268  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    257269  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
  • branches/HeuristicLab.DataImporter/HeuristicLab.DataImporter.DataProcessor/Properties/Resources.Designer.cs

    r6133 r9627  
    22// <auto-generated>
    33//     This code was generated by a tool.
    4 //     Runtime Version:4.0.30319.1
     4//     Runtime Version:4.0.30319.18047
    55//
    66//     Changes to this file may cause incorrect behavior and will be lost if
     
    6161        }
    6262       
     63        /// <summary>
     64        ///   Looks up a localized resource of type System.Drawing.Bitmap.
     65        /// </summary>
    6366        internal static System.Drawing.Bitmap Edit_redoHL {
    6467            get {
     
    6871        }
    6972       
     73        /// <summary>
     74        ///   Looks up a localized resource of type System.Drawing.Bitmap.
     75        /// </summary>
    7076        internal static System.Drawing.Bitmap Edit_RedoHS {
    7177            get {
     
    7581        }
    7682       
     83        /// <summary>
     84        ///   Looks up a localized resource of type System.Drawing.Bitmap.
     85        /// </summary>
    7786        internal static System.Drawing.Bitmap Edit_UndoHL {
    7887            get {
     
    8291        }
    8392       
     93        /// <summary>
     94        ///   Looks up a localized resource of type System.Drawing.Bitmap.
     95        /// </summary>
    8496        internal static System.Drawing.Bitmap Edit_UndoHS {
    8597            get {
     
    89101        }
    90102       
     103        /// <summary>
     104        ///   Looks up a localized resource of type System.Drawing.Bitmap.
     105        /// </summary>
    91106        internal static System.Drawing.Bitmap OpenSelectedItemHS {
    92107            get {
     
    96111        }
    97112       
     113        /// <summary>
     114        ///   Looks up a localized resource of type System.Drawing.Bitmap.
     115        /// </summary>
    98116        internal static System.Drawing.Bitmap RecordHS {
    99117            get {
     
    103121        }
    104122       
     123        /// <summary>
     124        ///   Looks up a localized resource of type System.Drawing.Bitmap.
     125        /// </summary>
    105126        internal static System.Drawing.Bitmap SaveAllHS {
    106127            get {
     
    110131        }
    111132       
     133        /// <summary>
     134        ///   Looks up a localized resource of type System.Drawing.Bitmap.
     135        /// </summary>
    112136        internal static System.Drawing.Bitmap StopHS {
    113137            get {
     
    116140            }
    117141        }
     142       
     143        /// <summary>
     144        ///   Looks up a localized resource of type System.Drawing.Bitmap.
     145        /// </summary>
     146        internal static System.Drawing.Bitmap VS2008ImageLibrary_Actions_Warning {
     147            get {
     148                object obj = ResourceManager.GetObject("VS2008ImageLibrary_Actions_Warning", resourceCulture);
     149                return ((System.Drawing.Bitmap)(obj));
     150            }
     151        }
    118152    }
    119153}
  • branches/HeuristicLab.DataImporter/HeuristicLab.DataImporter.DataProcessor/Properties/Resources.resx

    r6133 r9627  
    113113  </resheader>
    114114  <resheader name="reader">
    115     <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
     115    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
    116116  </resheader>
    117117  <resheader name="writer">
    118     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
     118    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
    119119  </resheader>
    120   <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
     120  <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
     121  <data name="Edit_redoHL" type="System.Resources.ResXFileRef, System.Windows.Forms">
     122    <value>..\Resources\Edit_redoHL.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
     123  </data>
     124  <data name="OpenSelectedItemHS" type="System.Resources.ResXFileRef, System.Windows.Forms">
     125    <value>..\Resources\OpenSelectedItemHS.BMP;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
     126  </data>
     127  <data name="Edit_UndoHS" type="System.Resources.ResXFileRef, System.Windows.Forms">
     128    <value>..\Resources\Edit_UndoHS.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
     129  </data>
     130  <data name="StopHS" type="System.Resources.ResXFileRef, System.Windows.Forms">
     131    <value>..\Resources\StopHS.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
     132  </data>
    121133  <data name="Edit_UndoHL" type="System.Resources.ResXFileRef, System.Windows.Forms">
    122134    <value>..\Resources\Edit_UndoHL.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
     
    125137    <value>..\Resources\Edit_RedoHS.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
    126138  </data>
    127   <data name="Edit_UndoHS" type="System.Resources.ResXFileRef, System.Windows.Forms">
    128     <value>..\Resources\Edit_UndoHS.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
    129   </data>
    130   <data name="Edit_redoHL" type="System.Resources.ResXFileRef, System.Windows.Forms">
    131     <value>..\Resources\Edit_redoHL.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
    132   </data>
    133139  <data name="SaveAllHS" type="System.Resources.ResXFileRef, System.Windows.Forms">
    134140    <value>..\Resources\SaveAllHS.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
    135   </data>
    136   <data name="OpenSelectedItemHS" type="System.Resources.ResXFileRef, System.Windows.Forms">
    137     <value>..\Resources\OpenSelectedItemHS.BMP;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
    138141  </data>
    139142  <data name="RecordHS" type="System.Resources.ResXFileRef, System.Windows.Forms">
    140143    <value>..\Resources\RecordHS.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
    141144  </data>
    142   <data name="StopHS" type="System.Resources.ResXFileRef, System.Windows.Forms">
    143     <value>..\Resources\StopHS.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
     145  <data name="VS2008ImageLibrary_Actions_Warning" type="System.Resources.ResXFileRef, System.Windows.Forms">
     146    <value>..\Resources\VS2008ImageLibrary_Actions_Warning.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
    144147  </data>
    145148</root>
  • branches/HeuristicLab.DataImporter/HeuristicLab.DataImporter.DbExplorer.MsSqlServer/Properties/AssemblyInfo.cs.frame

    r7632 r9627  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/HeuristicLab.DataImporter/HeuristicLab.DataImporter.DbExplorer.MsSqlServer/SqlServerExplorer.cs

    r7629 r9627  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/HeuristicLab.DataImporter/HeuristicLab.DataImporter.DbExplorer.Oracle/Properties/AssemblyInfo.cs.frame

    r7632 r9627  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
Note: See TracChangeset for help on using the changeset viewer.