Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Command/RenameColumnCommand.cs @ 6133

Last change on this file since 6133 was 6133, checked in by gkronber, 13 years ago

#1471: imported generic parts of DataImporter from private code base

File size: 1.2 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Xml;
6using HeuristicLab.DataImporter.Data.Model;
7using HeuristicLab.DataImporter.Data.CommandBase;
8using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
9
10namespace HeuristicLab.DataImporter.Data.Command {
11  [StorableClass]
12  public class RenameColumnCommand : ColumnCommandBase {
13    [Storable]
14    private string newName;
15
16    private string oldName;
17
18    private RenameColumnCommand()
19      : base(null, string.Empty, -1) {
20    }
21
22    public RenameColumnCommand(DataSet dataSet, string columnGroupName, int columnIndex, string newName)
23      : base(dataSet, columnGroupName, columnIndex) {
24      this.newName = newName;
25    }
26
27    public override string Description {
28      get { return "Rename Column"; }
29    }
30
31    public override void Execute() {
32      base.Execute();
33      oldName = Column.Name;
34      Column.Name = newName;
35      Column.FireChanged();
36      this.ColumnGroup = null;
37    }
38
39    public override void UndoExecute() {
40      base.UndoExecute();
41      Column.Name = oldName;
42      oldName = null;
43      Column.FireChanged();
44      this.ColumnGroup = null;
45    }
46  }
47}
Note: See TracBrowser for help on using the repository browser.