Changeset 4870 for trunk/sources/HeuristicLab.Analysis/3.3/DataTable.cs
- Timestamp:
- 11/20/10 02:44:45 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Analysis/3.3/DataTable.cs
r4774 r4870 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.ComponentModel; 24 25 using System.Drawing; 25 26 using System.Linq; … … 41 42 } 42 43 43 [Storable] 44 private DataTableVisualProperties visualProperties; 45 public DataTableVisualProperties VisualProperties { 46 get { return visualProperties; } 47 set { 48 if (visualProperties != value) { 49 if (value == null) throw new ArgumentNullException("VisualProperties"); 50 if (visualProperties != null) visualProperties.PropertyChanged -= new PropertyChangedEventHandler(VisualProperties_PropertyChanged); 51 visualProperties = value; 52 visualProperties.PropertyChanged += new PropertyChangedEventHandler(VisualProperties_PropertyChanged); 53 OnVisualPropertiesChanged(); 54 } 55 } 56 } 57 44 58 private NamedItemCollection<DataRow> rows; 45 59 public NamedItemCollection<DataRow> Rows { … … 47 61 } 48 62 49 #region Storing & Cloning 63 #region Persistence Properties 64 [Storable(Name = "VisualProperties")] 65 private DataTableVisualProperties StorableVisualProperties { 66 get { return VisualProperties; } 67 set { VisualProperties = value; } 68 } 69 [Storable(Name = "rows")] 70 private IEnumerable<DataRow> StorableRows { 71 get { return rows; } 72 set { rows = new NamedItemCollection<DataRow>(value); } 73 } 74 #endregion 75 50 76 [StorableConstructor] 51 77 private DataTable(bool deserializing) : base(deserializing) { } 52 78 private DataTable(DataTable original, Cloner cloner) 53 79 : base(original, cloner) { 80 this.VisualProperties = (DataTableVisualProperties)cloner.Clone(original.visualProperties); 54 81 this.rows = cloner.Clone(original.rows); 55 82 this.RegisterRowsEvents(); 56 83 } 84 public DataTable() 85 : base() { 86 VisualProperties = new DataTableVisualProperties(); 87 rows = new NamedItemCollection<DataRow>(); 88 this.RegisterRowsEvents(); 89 } 90 public DataTable(string name) 91 : base(name) { 92 VisualProperties = new DataTableVisualProperties(); 93 rows = new NamedItemCollection<DataRow>(); 94 this.RegisterRowsEvents(); 95 } 96 public DataTable(string name, string description) 97 : base(name, description) { 98 VisualProperties = new DataTableVisualProperties(); 99 rows = new NamedItemCollection<DataRow>(); 100 this.RegisterRowsEvents(); 101 } 102 103 // BackwardsCompatibility3.3 104 #region Backwards compatible code, remove with 3.4 105 [StorableHook(HookType.AfterDeserialization)] 106 private void AfterDeserialization() { 107 if (VisualProperties == null) VisualProperties = new DataTableVisualProperties(); 108 } 109 #endregion 110 57 111 public override IDeepCloneable Clone(Cloner cloner) { 58 112 return new DataTable(this, cloner); 59 113 } 60 #endregion 61 public DataTable() 62 : base() { 63 rows = new NamedItemCollection<DataRow>(); 64 this.RegisterRowsEvents(); 65 } 66 public DataTable(string name) 67 : base(name) { 68 rows = new NamedItemCollection<DataRow>(); 69 this.RegisterRowsEvents(); 70 } 71 public DataTable(string name, string description) 72 : base(name, description) { 73 rows = new NamedItemCollection<DataRow>(); 74 this.RegisterRowsEvents(); 114 115 public event EventHandler VisualPropertiesChanged; 116 private void OnVisualPropertiesChanged() { 117 EventHandler handler = VisualPropertiesChanged; 118 if (handler != null) handler(this, EventArgs.Empty); 119 } 120 121 private void VisualProperties_PropertyChanged(object sender, PropertyChangedEventArgs e) { 122 OnVisualPropertiesChanged(); 75 123 } 76 124
Note: See TracChangeset
for help on using the changeset viewer.