Changeset 2665
- Timestamp:
- 01/21/10 05:10:12 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 8 added
- 16 deleted
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core.Views/3.3/HeuristicLab.Core.Views-3.3.csproj
r2664 r2665 59 59 </Compile> 60 60 <Compile Include="Auxiliary.cs" /> 61 <Compile Include="DefaultItemView.cs">62 <SubType>UserControl</SubType>63 </Compile>64 <Compile Include="DefaultItemView.Designer.cs">65 <DependentUpon>DefaultItemView.cs</DependentUpon>66 </Compile>67 61 <Compile Include="EngineView.cs"> 68 62 <SubType>UserControl</SubType> -
trunk/sources/HeuristicLab.Core.Views/3.3/ParameterView.cs
r2664 r2665 33 33 /// The visual representation of a <see cref="Parameter"/>. 34 34 /// </summary> 35 [Content(typeof( IParameter), true)]35 [Content(typeof(Parameter), true)] 36 36 public partial class ParameterView : NamedItemView { 37 37 /// <summary> … … 40 40 /// <remarks>Uses property <see cref="ViewBase.Item"/> of base class <see cref="ViewBase"/>. 41 41 /// No own data storage present.</remarks> 42 public IParameter Parameter {43 get { return ( IParameter)Item; }42 public Parameter Parameter { 43 get { return (Parameter)Item; } 44 44 set { base.Item = value; } 45 45 } … … 57 57 /// <remarks>Calls <see cref="VariableView()"/>.</remarks> 58 58 /// <param name="variable">The variable to represent visually.</param> 59 public ParameterView( IParameter parameter)59 public ParameterView(Parameter parameter) 60 60 : this() { 61 61 Parameter = parameter; -
trunk/sources/HeuristicLab.Core.Views/3.3/ViewHost.Designer.cs
r2655 r2665 46 46 private void InitializeComponent() { 47 47 this.viewPanel = new System.Windows.Forms.Panel(); 48 this.messageLabel = new System.Windows.Forms.Label(); 48 49 this.viewLabel = new System.Windows.Forms.Label(); 49 50 this.viewComboBox = new System.Windows.Forms.ComboBox(); … … 59 60 this.viewPanel.Size = new System.Drawing.Size(227, 157); 60 61 this.viewPanel.TabIndex = 2; 62 // 63 // messageLabel 64 // 65 this.messageLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 66 | System.Windows.Forms.AnchorStyles.Right))); 67 this.messageLabel.Location = new System.Drawing.Point(3, 24); 68 this.messageLabel.Name = "messageLabel"; 69 this.messageLabel.Size = new System.Drawing.Size(221, 20); 70 this.messageLabel.TabIndex = 0; 71 this.messageLabel.Text = "No view available."; 72 this.messageLabel.TextAlign = System.Drawing.ContentAlignment.TopCenter; 61 73 // 62 74 // viewLabel … … 85 97 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 86 98 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 99 this.Controls.Add(this.messageLabel); 87 100 this.Controls.Add(this.viewComboBox); 88 101 this.Controls.Add(this.viewLabel); … … 100 113 private System.Windows.Forms.Label viewLabel; 101 114 private System.Windows.Forms.ComboBox viewComboBox; 115 private System.Windows.Forms.Label messageLabel; 102 116 103 117 } -
trunk/sources/HeuristicLab.Core.Views/3.3/ViewHost.cs
r2655 r2665 53 53 viewComboBox.Enabled = false; 54 54 viewComboBox.Visible = false; 55 messageLabel.Visible = false; 55 56 if (viewPanel.Controls.Count > 0) viewPanel.Controls[0].Dispose(); 56 57 viewPanel.Controls.Clear(); … … 63 64 foreach (Type viewType in viewTypes) 64 65 viewComboBox.Items.Add(viewType); 65 if (viewComboBox.Items.Count > 0) { 66 if (viewComboBox.Items.Count == 0) { 67 messageLabel.Visible = true; 68 } else { 66 69 viewLabel.Visible = true; 67 70 viewComboBox.Enabled = true; 68 71 viewComboBox.Visible = true; 72 messageLabel.Visible = false; 69 73 } 70 74 -
trunk/sources/HeuristicLab.Data.Views/3.3/HeuristicLab.Data.Views-3.3.csproj
r2663 r2665 51 51 </ItemGroup> 52 52 <ItemGroup> 53 <Compile Include="HeuristicLabDataViewsPlugin.cs" /> 54 <Compile Include="IntDataView.cs"> 53 <Compile Include="BoolDataView.cs"> 55 54 <SubType>UserControl</SubType> 56 55 </Compile> 57 <Compile Include=" IntDataView.Designer.cs">58 <DependentUpon> IntDataView.cs</DependentUpon>56 <Compile Include="BoolDataView.Designer.cs"> 57 <DependentUpon>BoolDataView.cs</DependentUpon> 59 58 </Compile> 59 <Compile Include="StringConvertibleDataView.cs"> 60 <SubType>UserControl</SubType> 61 </Compile> 62 <Compile Include="StringConvertibleDataView.Designer.cs"> 63 <DependentUpon>StringConvertibleDataView.cs</DependentUpon> 64 </Compile> 65 <Compile Include="HeuristicLabDataViewsPlugin.cs" /> 60 66 <Compile Include="Properties\AssemblyInfo.cs" /> 61 67 </ItemGroup> -
trunk/sources/HeuristicLab.Data/3.3/BoolData.cs
r2526 r2665 28 28 29 29 namespace HeuristicLab.Data { 30 /// <summary>31 /// Class to represent boolean values.32 /// </summary>33 30 [EmptyStorableClass] 34 public class BoolData : ObjectData { 35 /// <summary> 36 /// Gets or sets the boolean value. 37 /// </summary> 38 /// <remarks>Uses property <see cref="ObjectData.Data"/> 39 /// of base class <see cref="ObjectData"/>. No own data storage present.</remarks> 40 public new bool Data { 41 get { return (bool)base.Data; } 42 set { base.Data = value; } 31 [Item("Boolean", "Represents a boolean value.")] 32 [Creatable("Test")] 33 public sealed class BoolData : ValueTypeData<bool>, IStringConvertibleData { 34 public BoolData() : base() { } 35 public BoolData(bool value) 36 : base() { 37 Value = value; 43 38 } 44 39 45 /// <summary> 46 /// Initializes a new instance of <see cref="BoolData"/> with default value <c>false</c>. 47 /// </summary> 48 public BoolData() { 49 Data = false; 50 } 51 /// <summary> 52 /// Initializes a new instance of <see cref="BoolData"/> with the boolean value <paramref name="data"/>. 53 /// </summary> 54 /// <param name="data">The boolean value to assign.</param> 55 public BoolData(bool data) { 56 Data = data; 40 public override IDeepCloneable Clone(Cloner cloner) { 41 BoolData clone = new BoolData(Value); 42 cloner.RegisterClonedObject(this, clone); 43 return clone; 57 44 } 58 45 59 /// <summary>60 /// Clones the current instance.61 /// </summary>62 /// <remarks>The cloned instance is added to the <paramref name="dictionary"/>.</remarks>63 /// <param name="clonedObjects">Dictionary of all already cloned objects.</param>64 /// <returns>The cloned instance as <see cref="BoolData"/>.</returns>65 public override IItem Clone(ICloner cloner) {66 BoolData clone = new BoolData();67 cloner.RegisterClonedObject(this, clone);68 clone.Data = Data;69 return clone;46 string IStringConvertibleData.GetValue() { 47 return Value.ToString(); 48 } 49 bool IStringConvertibleData.SetValue(string value) { 50 bool b; 51 if (bool.TryParse(value, out b)) { 52 Value = b; 53 return true; 54 } else { 55 return false; 56 } 70 57 } 71 58 } -
trunk/sources/HeuristicLab.Data/3.3/DoubleData.cs
r2526 r2665 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 /// Class to represent double values.33 /// </summary>34 30 [EmptyStorableClass] 35 public class DoubleData : ObjectData { 36 /// <summary> 37 /// Gets or sets the double value. 38 /// </summary> 39 /// <remarks>Uses property <see cref="ObjectData.Data"/> of base class <see cref="ObjectData"></see>. 40 /// No own data storage present.</remarks> 41 public new double Data { 42 get { return (double)base.Data; } 43 set { base.Data = value; } 31 [Item("Double", "Represents a double value.")] 32 [Creatable("Test")] 33 public sealed class DoubleData : ValueTypeData<double>, IStringConvertibleData { 34 public DoubleData() : base() { } 35 public DoubleData(double value) 36 : base() { 37 Value = value; 44 38 } 45 39 46 /// <summary> 47 /// Initializes a new instance of <see cref="DoubleData"/> with default value <c>0.0</c>. 48 /// </summary> 49 public DoubleData() { 50 Data = 0.0; 51 } 52 /// <summary> 53 /// Initializes a new instance of <see cref="DoubleData"/>. 54 /// <note type="caution"> No CopyConstructor! <paramref name="data"/> is not copied!</note> 55 /// </summary> 56 /// <param name="data">The double value the instance should represent.</param> 57 public DoubleData(double data) { 58 Data = data; 40 public override IDeepCloneable Clone(Cloner cloner) { 41 DoubleData clone = new DoubleData(Value); 42 cloner.RegisterClonedObject(this, clone); 43 return clone; 59 44 } 60 45 61 /// <summary> 62 /// Clones the current instance and adds it to the dictionary <paramref name="clonedObjects"/>. 63 /// </summary> 64 /// <param name="clonedObjects">Dictionary of all already cloned objects.</param> 65 /// <returns>The cloned instance as <see cref="DoubleData"/>.</returns> 66 public override IItem Clone(ICloner cloner) { 67 DoubleData clone = new DoubleData(); 68 cloner.RegisterClonedObject(this, clone); 69 clone.Data = Data; 70 return clone; 46 string IStringConvertibleData.GetValue() { 47 return Value.ToString(); 48 } 49 bool IStringConvertibleData.SetValue(string value) { 50 double d; 51 if (double.TryParse(value, out d)) { 52 Value = d; 53 return true; 54 } else { 55 return false; 56 } 71 57 } 72 58 } -
trunk/sources/HeuristicLab.Data/3.3/HeuristicLab.Data-3.3.csproj
r2663 r2665 100 100 </ItemGroup> 101 101 <ItemGroup> 102 <Compile Include="BoolData.cs"> 103 <SubType>Code</SubType> 104 </Compile> 105 <Compile Include="ReferenceTypeData.cs" /> 106 <Compile Include="StringData.cs"> 107 <SubType>Code</SubType> 108 </Compile> 109 <Compile Include="TimeSpanData.cs" /> 110 <Compile Include="DateTimeData.cs" /> 111 <Compile Include="DoubleData.cs"> 112 <SubType>Code</SubType> 113 </Compile> 114 <Compile Include="IStringConvertibleData.cs" /> 102 115 <Compile Include="ValueTypeData.cs"> 103 116 <SubType>Code</SubType> -
trunk/sources/HeuristicLab.Data/3.3/IntData.cs
r2663 r2665 29 29 namespace HeuristicLab.Data { 30 30 [EmptyStorableClass] 31 [Item("Int Data", "Represents an integer value.")]31 [Item("Integer", "Represents an integer value.")] 32 32 [Creatable("Test")] 33 public sealed class IntData : ValueTypeData<int> {33 public sealed class IntData : ValueTypeData<int>, IStringConvertibleData { 34 34 public IntData() : base() { } 35 35 public IntData(int value) … … 43 43 return clone; 44 44 } 45 46 string IStringConvertibleData.GetValue() { 47 return Value.ToString(); 48 } 49 bool IStringConvertibleData.SetValue(string value) { 50 int i; 51 if (int.TryParse(value, out i)) { 52 Value = i; 53 return true; 54 } else { 55 return false; 56 } 57 } 45 58 } 46 59 } -
trunk/sources/HeuristicLab.Data/3.3/StringData.cs
r2526 r2665 28 28 29 29 namespace HeuristicLab.Data { 30 /// <summary>31 /// The representation of a string.32 /// </summary>33 30 [EmptyStorableClass] 34 public class StringData : ObjectData {35 /// <summary>36 /// Gets or sets the string value.37 /// </summary>38 /// <remarks>Uses property <see cref="ObjectData.Data"/> of base class <see cref="ObjectData"/>.39 /// No own data storage present.</remarks>40 public new string Data {41 get { return (string)base.Data; }42 set { base.Data = value; }31 [Item("String", "Represents a string.")] 32 [Creatable("Test")] 33 public sealed class StringData : ReferenceTypeData<string>, IStringConvertibleData { 34 public StringData() : base() { 35 Value = string.Empty; 36 } 37 public StringData(string value) 38 : base() { 39 Value = value; 43 40 } 44 41 45 /// <summary> 46 /// Initializes a new instance of <see cref="StringData"/> 47 /// with the name of the type of the current instance as default value. 48 /// </summary> 49 public StringData() { 50 Data = this.GetType().Name; 51 } 52 /// <summary> 53 /// Initializes a new instance of <see cref="StringData"/> with the specified <paramref name="data"/>. 54 /// </summary> 55 /// <param name="data">The string value the current instance should represent.</param> 56 public StringData(string data) { 57 Data = data; 58 } 59 60 /// <summary> 61 /// Clones the current instance. 62 /// </summary> 63 /// <remarks>The current instance is added to the dictionary <paramref name="clonedObjects"/>.</remarks> 64 /// <param name="clonedObjects">A dictionary of all already cloned objects.</param> 65 /// <returns>The coned instance as <see cref="StringData"/>.</returns> 66 public override IItem Clone(ICloner cloner) { 67 StringData clone = new StringData(); 42 public override IDeepCloneable Clone(Cloner cloner) { 43 StringData clone = new StringData(Value); 68 44 cloner.RegisterClonedObject(this, clone); 69 clone.Data = Data;70 45 return clone; 71 46 } 72 47 73 /// <summary>74 /// The string representation of the current instance.75 /// </summary>76 /// <returns>The string value.</returns>77 public override string ToString() {78 return Data;48 string IStringConvertibleData.GetValue() { 49 return Value; 50 } 51 bool IStringConvertibleData.SetValue(string value) { 52 Value = value != null ? value : string.Empty; 53 return true; 79 54 } 80 55 } -
trunk/sources/HeuristicLab.Optimizer/3.3/FileManager.cs
r2656 r2665 53 53 if (newItemDialog.ShowDialog() == DialogResult.OK) { 54 54 IView view = MainFormManager.CreateDefaultView(newItemDialog.Item); 55 if (view is IObjectView) { 56 view.Caption = "Item" + newDocumentsCounter.ToString() + ".hl"; 57 newDocumentsCounter++; 55 if (view == null) { 56 MessageBox.Show("There is no view for the new item. It cannot be displayed. ", "No View Available", MessageBoxButtons.OK, MessageBoxIcon.Error); 57 } else { 58 if (view is IObjectView) { 59 view.Caption = "Item" + newDocumentsCounter.ToString() + ".hl"; 60 newDocumentsCounter++; 61 } 62 MainFormManager.MainForm.ShowView(view); 58 63 } 59 MainFormManager.MainForm.ShowView(view);60 64 } 61 65 } … … 188 192 Invoke(delegate() { 189 193 IObjectView view = MainFormManager.CreateDefaultView(item) as IObjectView; 190 if (view != null) { 194 if (view == null) { 195 MessageBox.Show("There is no view for the loaded item. It cannot be displayed. ", "No View Available", MessageBoxButtons.OK, MessageBoxIcon.Error); 196 } else { 191 197 view.Caption = Path.GetFileName(filename); 192 198 files.Add(view, new FileInfo(filename));
Note: See TracChangeset
for help on using the changeset viewer.