Changeset 2669
- Timestamp:
- 01/22/10 03:29:02 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 4 added
- 13 deleted
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Collections/3.3/IndexedItem.cs
r2623 r2669 44 44 public override string ToString() { 45 45 StringBuilder sb = new StringBuilder(); 46 sb.Append("[").Append(index).Append(" ,");46 sb.Append("[").Append(index).Append(": "); 47 47 if (value != null) sb.Append(value.ToString()); 48 48 sb.Append("]"); -
trunk/sources/HeuristicLab.Core.Views/3.3/NamedItemView.cs
r2664 r2669 100 100 101 101 // check if variable name was set successfully 102 e.Cancel = !NamedItemBase.Name.Equals(nameTextBox.Text);102 e.Cancel = e.Cancel || !NamedItemBase.Name.Equals(nameTextBox.Text); 103 103 if (e.Cancel) { 104 104 MessageBox.Show(this, "\"" + nameTextBox.Text + "\" is not a valid name.", "Invalid Value", MessageBoxButtons.OK, MessageBoxIcon.Error); -
trunk/sources/HeuristicLab.Core/3.3/NamedItemCollection.cs
r2664 r2669 114 114 115 115 private void Item_NameChanging(object sender, CancelEventArgs<string> e) { 116 e.Cancel = this.ContainsKey(e.Value);116 e.Cancel = e.Cancel || this.ContainsKey(e.Value); 117 117 } 118 118 private void Item_NameChanged(object sender, EventArgs e) { -
trunk/sources/HeuristicLab.Core/3.3/Parameter.cs
r2664 r2669 63 63 return clone; 64 64 } 65 66 public override string ToString() { 67 return string.Format("{0} ({1})", Name, DataType.Name); 68 } 65 69 } 66 70 } -
trunk/sources/HeuristicLab.Data.Views/3.3/BoolDataView.cs
r2665 r2669 27 27 using System.Text; 28 28 using System.Windows.Forms; 29 using HeuristicLab.Core; 29 30 using HeuristicLab.Core.Views; 30 31 using HeuristicLab.MainForm; … … 48 49 49 50 protected override void DeregisterObjectEvents() { 50 BoolData. ValueChanged -= new EventHandler(BoolData_ValueChanged);51 BoolData.Changed -= new ChangedEventHandler(BoolData_Changed); 51 52 base.DeregisterObjectEvents(); 52 53 } … … 54 55 protected override void RegisterObjectEvents() { 55 56 base.RegisterObjectEvents(); 56 BoolData. ValueChanged += new EventHandler(BoolData_ValueChanged);57 BoolData.Changed += new ChangedEventHandler(BoolData_Changed); 57 58 } 58 59 … … 70 71 } 71 72 72 private void BoolData_ ValueChanged(object sender,EventArgs e) {73 private void BoolData_Changed(object sender, ChangedEventArgs e) { 73 74 if (InvokeRequired) 74 Invoke(new EventHandler(BoolData_ValueChanged), sender, e);75 Invoke(new ChangedEventHandler(BoolData_Changed), sender, e); 75 76 else 76 77 valueCheckBox.Checked = BoolData.Value; -
trunk/sources/HeuristicLab.Data.Views/3.3/HeuristicLab.Data.Views-3.3.csproj
r2665 r2669 57 57 <DependentUpon>BoolDataView.cs</DependentUpon> 58 58 </Compile> 59 <Compile Include="StringConvertibleArrayDataView.cs"> 60 <SubType>UserControl</SubType> 61 </Compile> 62 <Compile Include="StringConvertibleArrayDataView.Designer.cs"> 63 <DependentUpon>StringConvertibleArrayDataView.cs</DependentUpon> 64 </Compile> 59 65 <Compile Include="StringConvertibleDataView.cs"> 60 66 <SubType>UserControl</SubType> … … 71 77 </ItemGroup> 72 78 <ItemGroup> 79 <ProjectReference Include="..\..\HeuristicLab.Common\3.2\HeuristicLab.Common-3.2.csproj"> 80 <Project>{1FC004FC-59AF-4249-B1B6-FF25873A20E4}</Project> 81 <Name>HeuristicLab.Common-3.2</Name> 82 </ProjectReference> 73 83 <ProjectReference Include="..\..\HeuristicLab.Core.Views\3.3\HeuristicLab.Core.Views-3.3.csproj"> 74 84 <Project>{E226881D-315F-423D-B419-A766FE0D8685}</Project> -
trunk/sources/HeuristicLab.Data.Views/3.3/HeuristicLabDataViewsPlugin.cs
r2663 r2669 31 31 [Plugin("HeuristicLab.Data.Views-3.3", "")] 32 32 [PluginFile("HeuristicLab.Data.Views-3.3.dll", PluginFileType.Assembly)] 33 [PluginDependency("HeuristicLab.Common-3.2")] 33 34 [PluginDependency("HeuristicLab.Core-3.3")] 34 35 [PluginDependency("HeuristicLab.Core.Views-3.3")] -
trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleDataView.cs
r2665 r2669 27 27 using System.Text; 28 28 using System.Windows.Forms; 29 using HeuristicLab.Core; 29 30 using HeuristicLab.Core.Views; 30 31 using HeuristicLab.MainForm; … … 48 49 49 50 protected override void DeregisterObjectEvents() { 50 StringConvertibleData. ValueChanged -= new EventHandler(StringConvertibleData_ValueChanged);51 StringConvertibleData.Changed -= new ChangedEventHandler(StringConvertibleData_Changed); 51 52 base.DeregisterObjectEvents(); 52 53 } … … 54 55 protected override void RegisterObjectEvents() { 55 56 base.RegisterObjectEvents(); 56 StringConvertibleData. ValueChanged += new EventHandler(StringConvertibleData_ValueChanged);57 StringConvertibleData.Changed += new ChangedEventHandler(StringConvertibleData_Changed); 57 58 } 58 59 … … 61 62 if (StringConvertibleData == null) { 62 63 Caption = "StringConvertibleData View"; 63 valueTextBox.Text = "-";64 valueTextBox.Text = string.Empty; 64 65 valueTextBox.Enabled = false; 65 66 } else { … … 70 71 } 71 72 72 private void StringConvertibleData_ ValueChanged(object sender,EventArgs e) {73 private void StringConvertibleData_Changed(object sender, ChangedEventArgs e) { 73 74 if (InvokeRequired) 74 Invoke(new EventHandler(StringConvertibleData_ValueChanged), sender, e);75 Invoke(new ChangedEventHandler(StringConvertibleData_Changed), sender, e); 75 76 else 76 77 valueTextBox.Text = StringConvertibleData.GetValue(); … … 78 79 79 80 private void valueTextBox_Validating(object sender, CancelEventArgs e) { 80 e.Cancel = !StringConvertibleData.SetValue(valueTextBox.Text);81 e.Cancel = e.Cancel || !StringConvertibleData.SetValue(valueTextBox.Text); 81 82 if (e.Cancel) { 82 83 MessageBox.Show(this, "\"" + valueTextBox.Text + "\" is not a valid value.", "Invalid Value", MessageBoxButtons.OK, MessageBoxIcon.Error); -
trunk/sources/HeuristicLab.Data/3.3/BoolData.cs
r2665 r2669 33 33 public sealed class BoolData : ValueTypeData<bool>, IStringConvertibleData { 34 34 public BoolData() : base() { } 35 public BoolData(bool value) 36 : base() { 37 Value = value; 38 } 35 public BoolData(bool value) : base(value) { } 39 36 40 37 public override IDeepCloneable Clone(Cloner cloner) { -
trunk/sources/HeuristicLab.Data/3.3/DateTimeData.cs
r2665 r2669 33 33 public sealed class DateTimeData : ValueTypeData<DateTime>, IStringConvertibleData { 34 34 public DateTimeData() : base() { } 35 public DateTimeData(DateTime value) 36 : base() { 37 Value = value; 38 } 35 public DateTimeData(DateTime value) : base(value) { } 39 36 40 37 public override IDeepCloneable Clone(Cloner cloner) { … … 44 41 } 45 42 43 public override string ToString() { 44 return Value.ToString("o"); // round-trip format 45 } 46 46 47 string IStringConvertibleData.GetValue() { 47 return Value.ToString( );48 return Value.ToString("o"); // round-trip format 48 49 } 49 50 bool IStringConvertibleData.SetValue(string value) { -
trunk/sources/HeuristicLab.Data/3.3/DoubleData.cs
r2665 r2669 33 33 public sealed class DoubleData : ValueTypeData<double>, IStringConvertibleData { 34 34 public DoubleData() : base() { } 35 public DoubleData(double value) 36 : base() { 37 Value = value; 38 } 35 public DoubleData(double value) : base(value) { } 39 36 40 37 public override IDeepCloneable Clone(Cloner cloner) { … … 44 41 } 45 42 43 public override string ToString() { 44 return Value.ToString("r"); // round-trip format 45 } 46 46 47 string IStringConvertibleData.GetValue() { 47 return Value.ToString( );48 return Value.ToString("r"); // round-trip format 48 49 } 49 50 bool IStringConvertibleData.SetValue(string value) { -
trunk/sources/HeuristicLab.Data/3.3/HeuristicLab.Data-3.3.csproj
r2665 r2669 103 103 <SubType>Code</SubType> 104 104 </Compile> 105 <Compile Include="ReferenceTypeData.cs" /> 105 <Compile Include="IStringConvertibleArrayData.cs" /> 106 <Compile Include="ValueTypeArrayData.cs" /> 107 <Compile Include="IntArrayData.cs" /> 106 108 <Compile Include="StringData.cs"> 107 109 <SubType>Code</SubType> … … 126 128 <Project>{0E27A536-1C4A-4624-A65E-DC4F4F23E3E1}</Project> 127 129 <Name>HeuristicLab.Common.Resources-3.2</Name> 130 </ProjectReference> 131 <ProjectReference Include="..\..\HeuristicLab.Common\3.2\HeuristicLab.Common-3.2.csproj"> 132 <Project>{1FC004FC-59AF-4249-B1B6-FF25873A20E4}</Project> 133 <Name>HeuristicLab.Common-3.2</Name> 128 134 </ProjectReference> 129 135 <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj"> -
trunk/sources/HeuristicLab.Data/3.3/HeuristicLabDataPlugin.cs
r2663 r2669 31 31 [Plugin("HeuristicLab.Data-3.3", "")] 32 32 [PluginFile("HeuristicLab.Data-3.3.dll", PluginFileType.Assembly)] 33 [PluginDependency("HeuristicLab.Common-3.2")] 33 34 [PluginDependency("HeuristicLab.Common.Resources-3.2")] 34 35 [PluginDependency("HeuristicLab.Core-3.3")] -
trunk/sources/HeuristicLab.Data/3.3/IStringConvertibleData.cs
r2665 r2669 24 24 using System.Text; 25 25 using System.Xml; 26 using HeuristicLab.Core; 26 27 27 28 namespace HeuristicLab.Data { … … 30 31 bool SetValue(string value); 31 32 32 event EventHandler ValueChanged;33 event ChangedEventHandler Changed; 33 34 } 34 35 } -
trunk/sources/HeuristicLab.Data/3.3/IntArrayData.cs
r2520 r2669 25 25 using System.Xml; 26 26 using HeuristicLab.Core; 27 using System.Globalization;28 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 28 30 29 namespace HeuristicLab.Data { 31 /// <summary>32 /// The representation of an array of integer values.33 /// </summary>34 30 [EmptyStorableClass] 35 public class IntArrayData : ArrayDataBase { 36 /// <summary> 37 /// Gets or sets the int elements of the array. 38 /// </summary> 39 /// <remarks>Uses property <see cref="ArrayDataBase.Data"/> of base class <see cref="ArrayDataBase"/>. 40 /// No own data storage present.</remarks> 41 public new int[] Data { 42 get { return (int[])base.Data; } 43 set { base.Data = value; } 31 [Item("IntArrayData", "Represents an array of integer values.")] 32 [Creatable("Test")] 33 public sealed class IntArrayData : ValueTypeArrayData<int>, IStringConvertibleArrayData { 34 public IntArrayData() : base() { } 35 public IntArrayData(int length) : base(length) { } 36 public IntArrayData(IntArrayData elements) : base(elements) { } 37 public IntArrayData(int[] elements) : base(elements) { } 38 39 public override IDeepCloneable Clone(Cloner cloner) { 40 IntArrayData clone = new IntArrayData(this); 41 cloner.RegisterClonedObject(this, clone); 42 return clone; 44 43 } 45 44 46 /// <summary> 47 /// Initializes a new instance of <see cref="IntArrayData"/>. 48 /// </summary> 49 public IntArrayData() { 50 Data = new int[0]; 45 int IStringConvertibleArrayData.Length { 46 get { return Length; } 47 set { Length = value; } 51 48 } 52 /// <summary> 53 /// Initializes a new instance of <see cref="IntArrayData"/>. 54 /// <note type="caution"> No CopyConstructor! <paramref name="data"/> is not copied!</note> 55 /// </summary> 56 /// <param name="data">The array of integers to represent.</param> 57 public IntArrayData(int[] data) { 58 Data = data; 49 string IStringConvertibleArrayData.GetValue(int index) { 50 return this[index].ToString(); 59 51 } 60 61 /// <summary> 62 /// The string representation of the array, formatted according to the given <paramref name="format"/>. 63 /// </summary> 64 /// <param name="format">The <see cref="NumberFormatInfo"></see> the single int values 65 /// should be formatted accordingly.</param> 66 /// <returns>The elements of the array as string, each element separated by a semicolon 67 /// and formatted according to the parameter <paramref name="format"/>.</returns> 68 private string ToString(NumberFormatInfo format) { 69 StringBuilder builder = new StringBuilder(); 70 for (int i = 0; i < Data.Length; i++) { 71 builder.Append(";"); 72 builder.Append(Data[i].ToString(format)); 52 bool IStringConvertibleArrayData.SetValue(string value, int index) { 53 int i; 54 if (int.TryParse(value, out i)) { 55 this[index] = i; 56 return true; 57 } else { 58 return false; 73 59 } 74 if (builder.Length > 0) builder.Remove(0, 1);75 return builder.ToString();76 60 } 77 61 } -
trunk/sources/HeuristicLab.Data/3.3/IntData.cs
r2665 r2669 33 33 public sealed class IntData : ValueTypeData<int>, IStringConvertibleData { 34 34 public IntData() : base() { } 35 public IntData(int value) 36 : base() { 37 Value = value; 38 } 35 public IntData(int value) : base(value) { } 39 36 40 37 public override IDeepCloneable Clone(Cloner cloner) { -
trunk/sources/HeuristicLab.Data/3.3/StringData.cs
r2665 r2669 31 31 [Item("String", "Represents a string.")] 32 32 [Creatable("Test")] 33 public sealed class StringData : ReferenceTypeData<string>, IStringConvertibleData { 34 public StringData() : base() { 35 Value = string.Empty; 33 public sealed class StringData : Item, IStringConvertibleData { 34 [Storable] 35 private string value; 36 public string Value { 37 get { return value; } 38 set { 39 if (value != this.value) { 40 if ((value != null) || (this.value != string.Empty)) { 41 this.value = value != null ? value : string.Empty; 42 OnChanged(); 43 } 44 } 45 } 36 46 } 37 public StringData(string value) 38 : base() { 39 Value = value; 47 48 public StringData() { 49 this.value = string.Empty; 50 } 51 public StringData(string value) { 52 this.value = value != null ? value : string.Empty; 40 53 } 41 54 … … 44 57 cloner.RegisterClonedObject(this, clone); 45 58 return clone; 59 } 60 61 public override string ToString() { 62 return value; 46 63 } 47 64 -
trunk/sources/HeuristicLab.Data/3.3/TimeSpanData.cs
r2665 r2669 33 33 public sealed class TimeSpanData : ValueTypeData<TimeSpan>, IStringConvertibleData { 34 34 public TimeSpanData() : base() { } 35 public TimeSpanData(TimeSpan value) 36 : base() { 37 Value = value; 38 } 35 public TimeSpanData(TimeSpan value) : base(value) { } 39 36 40 37 public override IDeepCloneable Clone(Cloner cloner) { -
trunk/sources/HeuristicLab.Data/3.3/ValueTypeData.cs
r2664 r2669 37 37 if (!value.Equals(this.value)) { 38 38 this.value = value; 39 On ValueChanged();39 OnChanged(); 40 40 } 41 41 } … … 43 43 44 44 public ValueTypeData() { 45 value = default(T); 45 this.value = default(T); 46 } 47 public ValueTypeData(T value) { 48 this.value = value; 46 49 } 47 50 … … 55 58 return value.ToString(); 56 59 } 57 58 public event EventHandler ValueChanged;59 protected virtual void OnValueChanged() {60 if (ValueChanged != null)61 ValueChanged(this, EventArgs.Empty);62 OnChanged();63 }64 60 } 65 61 }
Note: See TracChangeset
for help on using the changeset viewer.