- Timestamp:
- 07/13/16 10:51:56 (8 years ago)
- Location:
- branches/PerformanceComparison/HeuristicLab.Optimization.Views/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PerformanceComparison/HeuristicLab.Optimization.Views/3.3/ResultParameterView.Designer.cs
r12764 r14058 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 26 26 /// </summary> 27 27 private System.ComponentModel.IContainer components = null; 28 29 /// <summary> 30 /// Clean up any resources being used. 31 /// </summary> 32 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> 33 protected override void Dispose(bool disposing) { 34 if (disposing) { 35 if (components != null) components.Dispose(); 36 } 37 base.Dispose(disposing); 38 } 39 28 40 29 #region Component Designer generated code 41 30 … … 45 34 /// </summary> 46 35 private void InitializeComponent() { 47 this.resultNameTextBox = new System.Windows.Forms.TextBox(); 48 this.resultNameLabel = new System.Windows.Forms.Label(); 36 this.resultCollectionNameTextBox = new System.Windows.Forms.TextBox(); 37 this.resultCollectionNameLabel = new System.Windows.Forms.Label(); 38 this.defaultValueGroupBox = new System.Windows.Forms.GroupBox(); 39 this.removeDefaultValueButton = new System.Windows.Forms.Button(); 40 this.setDefaultValueButton = new System.Windows.Forms.Button(); 41 this.defaultValueViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 49 42 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 43 this.defaultValueGroupBox.SuspendLayout(); 50 44 this.SuspendLayout(); 51 45 // 52 // dataTypeLabel46 // actualNameTextBox 53 47 // 54 this. dataTypeLabel.Location = new System.Drawing.Point(3, 55);55 this. dataTypeLabel.TabIndex = 5;48 this.actualNameTextBox.Location = new System.Drawing.Point(98, 26); 49 this.actualNameTextBox.Size = new System.Drawing.Size(288, 20); 56 50 // 57 51 // dataTypeTextBox 58 52 // 59 this.dataTypeTextBox.Location = new System.Drawing.Point(80, 52); 60 this.dataTypeTextBox.Size = new System.Drawing.Size(306, 20); 61 this.dataTypeTextBox.TabIndex = 6; 53 this.dataTypeTextBox.Location = new System.Drawing.Point(98, 52); 54 this.dataTypeTextBox.Size = new System.Drawing.Size(288, 20); 62 55 // 63 56 // nameTextBox … … 65 58 this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft); 66 59 this.errorProvider.SetIconPadding(this.nameTextBox, 2); 67 this.nameTextBox.Location = new System.Drawing.Point( 80, 0);68 this.nameTextBox.Size = new System.Drawing.Size(2 81, 20);60 this.nameTextBox.Location = new System.Drawing.Point(98, 0); 61 this.nameTextBox.Size = new System.Drawing.Size(263, 20); 69 62 // 70 // infoLabel63 // resultCollectionNameTextBox 71 64 // 72 this.infoLabel.Location = new System.Drawing.Point(367, 3); 65 this.resultCollectionNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 66 | System.Windows.Forms.AnchorStyles.Right))); 67 this.resultCollectionNameTextBox.Location = new System.Drawing.Point(98, 78); 68 this.resultCollectionNameTextBox.Name = "resultCollectionNameTextBox"; 69 this.resultCollectionNameTextBox.Size = new System.Drawing.Size(288, 20); 70 this.resultCollectionNameTextBox.TabIndex = 6; 71 this.resultCollectionNameTextBox.Validated += new System.EventHandler(this.resultNameTextBox_Validated); 73 72 // 74 // actualNameTextBox73 // resultCollectionNameLabel 75 74 // 76 this.actualNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 77 | System.Windows.Forms.AnchorStyles.Right))); 78 this.actualNameTextBox.Location = new System.Drawing.Point(80, 26); 79 this.actualNameTextBox.Name = "actualNameTextBox"; 80 this.actualNameTextBox.Size = new System.Drawing.Size(306, 20); 81 this.actualNameTextBox.TabIndex = 4; 82 this.actualNameTextBox.Validated += new System.EventHandler(this.actualNameTextBox_Validated); 75 this.resultCollectionNameLabel.AutoSize = true; 76 this.resultCollectionNameLabel.Location = new System.Drawing.Point(3, 81); 77 this.resultCollectionNameLabel.Name = "resultCollectionNameLabel"; 78 this.resultCollectionNameLabel.Size = new System.Drawing.Size(89, 13); 79 this.resultCollectionNameLabel.TabIndex = 5; 80 this.resultCollectionNameLabel.Text = "&Result Collection:"; 83 81 // 84 // actualNameLabel82 // defaultValueGroupBox 85 83 // 86 this.actualNameLabel.AutoSize = true; 87 this.actualNameLabel.Location = new System.Drawing.Point(3, 29); 88 this.actualNameLabel.Name = "actualNameLabel"; 89 this.actualNameLabel.Size = new System.Drawing.Size(71, 13); 90 this.actualNameLabel.TabIndex = 3; 91 this.actualNameLabel.Text = "&Actual Name:"; 84 this.defaultValueGroupBox.AllowDrop = true; 85 this.defaultValueGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 86 | System.Windows.Forms.AnchorStyles.Left) 87 | System.Windows.Forms.AnchorStyles.Right))); 88 this.defaultValueGroupBox.Controls.Add(this.removeDefaultValueButton); 89 this.defaultValueGroupBox.Controls.Add(this.setDefaultValueButton); 90 this.defaultValueGroupBox.Controls.Add(this.defaultValueViewHost); 91 this.defaultValueGroupBox.Location = new System.Drawing.Point(0, 104); 92 this.defaultValueGroupBox.Name = "defaultValueGroupBox"; 93 this.defaultValueGroupBox.Size = new System.Drawing.Size(386, 222); 94 this.defaultValueGroupBox.TabIndex = 7; 95 this.defaultValueGroupBox.TabStop = false; 96 this.defaultValueGroupBox.Text = "Default Value"; 97 this.defaultValueGroupBox.DragDrop += new System.Windows.Forms.DragEventHandler(this.defaultValueGroupBox_DragDrop); 98 this.defaultValueGroupBox.DragEnter += new System.Windows.Forms.DragEventHandler(this.defaultValueGroupBox_DragEnterOver); 99 this.defaultValueGroupBox.DragOver += new System.Windows.Forms.DragEventHandler(this.defaultValueGroupBox_DragEnterOver); 92 100 // 93 // re sultNameTextBox101 // removeDefaultValueButton 94 102 // 95 this.re sultNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)96 | System.Windows.Forms.AnchorStyles.Right)));97 this.re sultNameTextBox.Location = new System.Drawing.Point(80, 78);98 this.re sultNameTextBox.Name = "resultNameTextBox";99 this.re sultNameTextBox.Size = new System.Drawing.Size(306, 20);100 this.re sultNameTextBox.TabIndex = 6;101 this.re sultNameTextBox.Validated += new System.EventHandler(this.resultNameTextBox_Validated);103 this.removeDefaultValueButton.Location = new System.Drawing.Point(38, 19); 104 this.removeDefaultValueButton.Name = "removeDefaultValueButton"; 105 this.removeDefaultValueButton.Size = new System.Drawing.Size(26, 23); 106 this.removeDefaultValueButton.TabIndex = 1; 107 this.removeDefaultValueButton.Text = "Remove"; 108 this.removeDefaultValueButton.UseVisualStyleBackColor = true; 109 this.removeDefaultValueButton.Click += new System.EventHandler(this.removeDefaultValueButton_Click); 102 110 // 103 // resultNameLabel111 // setDefaultValueButton 104 112 // 105 this.resultNameLabel.AutoSize = true; 106 this.resultNameLabel.Location = new System.Drawing.Point(3, 81); 107 this.resultNameLabel.Name = "resultNameLabel"; 108 this.resultNameLabel.Size = new System.Drawing.Size(71, 13); 109 this.resultNameLabel.TabIndex = 5; 110 this.resultNameLabel.Text = "&Result Name:"; 113 this.setDefaultValueButton.Location = new System.Drawing.Point(6, 19); 114 this.setDefaultValueButton.Name = "setDefaultValueButton"; 115 this.setDefaultValueButton.Size = new System.Drawing.Size(26, 23); 116 this.setDefaultValueButton.TabIndex = 1; 117 this.setDefaultValueButton.Text = "Set"; 118 this.setDefaultValueButton.UseVisualStyleBackColor = true; 119 this.setDefaultValueButton.Click += new System.EventHandler(this.setDefaultValueButton_Click); 111 120 // 112 // LookupParameterView121 // defaultValueViewHost 113 122 // 114 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 123 this.defaultValueViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 124 | System.Windows.Forms.AnchorStyles.Left) 125 | System.Windows.Forms.AnchorStyles.Right))); 126 this.defaultValueViewHost.Caption = "View"; 127 this.defaultValueViewHost.Content = null; 128 this.defaultValueViewHost.Enabled = false; 129 this.defaultValueViewHost.Location = new System.Drawing.Point(6, 48); 130 this.defaultValueViewHost.Name = "defaultValueViewHost"; 131 this.defaultValueViewHost.ReadOnly = false; 132 this.defaultValueViewHost.Size = new System.Drawing.Size(374, 168); 133 this.defaultValueViewHost.TabIndex = 0; 134 this.defaultValueViewHost.ViewsLabelVisible = true; 135 this.defaultValueViewHost.ViewType = null; 136 // 137 // ResultParameterView 138 // 115 139 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 116 this.Controls.Add(this.resultNameTextBox); 117 this.Controls.Add(this.resultNameLabel); 140 this.Controls.Add(this.defaultValueGroupBox); 141 this.Controls.Add(this.resultCollectionNameTextBox); 142 this.Controls.Add(this.resultCollectionNameLabel); 118 143 this.Name = "ResultParameterView"; 119 this.Size = new System.Drawing.Size(386, 76);144 this.Size = new System.Drawing.Size(386, 326); 120 145 this.Controls.SetChildIndex(this.dataTypeLabel, 0); 121 146 this.Controls.SetChildIndex(this.dataTypeTextBox, 0); … … 125 150 this.Controls.SetChildIndex(this.actualNameTextBox, 0); 126 151 this.Controls.SetChildIndex(this.nameLabel, 0); 127 this.Controls.SetChildIndex(this.resultNameLabel, 0); 128 this.Controls.SetChildIndex(this.resultNameTextBox, 0); 152 this.Controls.SetChildIndex(this.resultCollectionNameLabel, 0); 153 this.Controls.SetChildIndex(this.resultCollectionNameTextBox, 0); 154 this.Controls.SetChildIndex(this.defaultValueGroupBox, 0); 129 155 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 156 this.defaultValueGroupBox.ResumeLayout(false); 130 157 this.ResumeLayout(false); 131 158 this.PerformLayout(); … … 135 162 #endregion 136 163 137 protected System.Windows.Forms.TextBox resultNameTextBox; 138 protected System.Windows.Forms.Label resultNameLabel; 164 protected System.Windows.Forms.TextBox resultCollectionNameTextBox; 165 protected System.Windows.Forms.Label resultCollectionNameLabel; 166 private System.Windows.Forms.GroupBox defaultValueGroupBox; 167 private MainForm.WindowsForms.ViewHost defaultValueViewHost; 168 private System.Windows.Forms.Button removeDefaultValueButton; 169 private System.Windows.Forms.Button setDefaultValueButton; 139 170 } 140 171 } -
branches/PerformanceComparison/HeuristicLab.Optimization.Views/3.3/ResultParameterView.cs
r12764 r14058 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 21 21 22 22 using System; 23 using System.Windows.Forms; 24 using HeuristicLab.Common.Resources; 23 25 using HeuristicLab.Core; 26 using HeuristicLab.Core.Views; 24 27 using HeuristicLab.MainForm; 25 28 using HeuristicLab.Parameters.Views; 29 using HeuristicLab.PluginInfrastructure; 26 30 27 31 namespace HeuristicLab.Optimization.Views { … … 29 33 [Content(typeof(ResultParameter<>), true)] 30 34 [Content(typeof(IResultParameter<>), false)] 31 public partial class ResultParameterView<T> : LookupParameterView<ResultCollection> where T : class, IItem, new() { 35 public partial class ResultParameterView<T> : LookupParameterView<T> where T : class, IItem { 36 protected TypeSelectorDialog typeSelectorDialog; 32 37 33 38 public new IResultParameter<T> Content { … … 38 43 public ResultParameterView() { 39 44 InitializeComponent(); 45 setDefaultValueButton.Text = string.Empty; 46 setDefaultValueButton.Image = VSImageLibrary.Edit; 47 removeDefaultValueButton.Text = string.Empty; 48 removeDefaultValueButton.Image = VSImageLibrary.Remove; 49 } 50 51 /// <summary> 52 /// Clean up any resources being used. 53 /// </summary> 54 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> 55 protected override void Dispose(bool disposing) { 56 if (disposing) { 57 if (typeSelectorDialog != null) typeSelectorDialog.Dispose(); 58 if (components != null) components.Dispose(); 59 } 60 base.Dispose(disposing); 40 61 } 41 62 42 63 protected override void DeregisterContentEvents() { 43 Content.ResultNameChanged -= new EventHandler(Content_ResultNameChanged); 64 Content.ResultCollectionNameChanged -= ContentOnResultCollectionNameChanged; 65 Content.DefaultValueChanged -= ContentOnDefaultValueChanged; 44 66 base.DeregisterContentEvents(); 45 67 } … … 47 69 protected override void RegisterContentEvents() { 48 70 base.RegisterContentEvents(); 49 Content.ResultNameChanged += new EventHandler(Content_ResultNameChanged); 71 Content.ResultCollectionNameChanged += ContentOnResultCollectionNameChanged; 72 Content.DefaultValueChanged += ContentOnDefaultValueChanged; 50 73 } 51 74 52 75 protected override void OnContentChanged() { 53 76 base.OnContentChanged(); 54 if (Content == null) 55 resultNameTextBox.Text = "-"; 56 else 57 resultNameTextBox.Text = Content.ResultName; 77 if (Content == null) { 78 resultCollectionNameTextBox.Text = "-"; 79 defaultValueViewHost.Content = null; 80 } else { 81 resultCollectionNameTextBox.Text = Content.ResultCollectionName; 82 defaultValueViewHost.Content = Content.DefaultValue; 83 } 58 84 } 59 85 60 86 protected override void SetEnabledStateOfControls() { 61 87 base.SetEnabledStateOfControls(); 62 result NameTextBox.Enabled = Content != null;63 result NameTextBox.ReadOnly = ReadOnly;88 resultCollectionNameTextBox.Enabled = Content != null; 89 resultCollectionNameTextBox.ReadOnly = ReadOnly; 64 90 } 65 91 66 private void Content_ResultNameChanged(object sender, EventArgs e) { 67 if (InvokeRequired) 68 Invoke(new EventHandler(Content_ResultNameChanged), sender, e); 69 else 70 resultNameTextBox.Text = Content.ResultName; 92 private void ContentOnDefaultValueChanged(object sender, EventArgs e) { 93 if (InvokeRequired) Invoke((Action<object, EventArgs>)ContentOnDefaultValueChanged, sender, e); 94 else defaultValueViewHost.Content = Content.DefaultValue; 95 } 96 97 private void ContentOnResultCollectionNameChanged(object sender, EventArgs e) { 98 if (InvokeRequired) Invoke((Action<object, EventArgs>)ContentOnResultCollectionNameChanged, sender, e); 99 else resultCollectionNameTextBox.Text = Content.ResultCollectionName; 71 100 } 72 101 73 102 private void resultNameTextBox_Validated(object sender, EventArgs e) { 74 Content.ResultName = resultNameTextBox.Text; 103 if (InvokeRequired) Invoke((Action<object, EventArgs>)resultNameTextBox_Validated, sender, e); 104 else Content.ResultCollectionName = resultCollectionNameTextBox.Text; 105 } 106 107 private void setDefaultValueButton_Click(object sender, EventArgs e) { 108 if (typeSelectorDialog == null) { 109 typeSelectorDialog = new TypeSelectorDialog(); 110 typeSelectorDialog.Caption = "Select Value"; 111 typeSelectorDialog.TypeSelector.Configure(Content.DataType, false, true); 112 } 113 if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) { 114 try { 115 Content.DefaultValue = (T)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); 116 } catch (Exception ex) { 117 ErrorHandling.ShowErrorDialog(this, ex); 118 } 119 } 120 } 121 122 private void removeDefaultValueButton_Click(object sender, EventArgs e) { 123 Content.DefaultValue = null; 124 } 125 126 protected virtual void defaultValueGroupBox_DragEnterOver(object sender, DragEventArgs e) { 127 e.Effect = DragDropEffects.None; 128 if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) != null) && Content.DataType.IsAssignableFrom(e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat).GetType())) { 129 if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link; // ALT key 130 else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move; // SHIFT key 131 else if (e.AllowedEffect.HasFlag(DragDropEffects.Copy)) e.Effect = DragDropEffects.Copy; 132 else if (e.AllowedEffect.HasFlag(DragDropEffects.Move)) e.Effect = DragDropEffects.Move; 133 else if (e.AllowedEffect.HasFlag(DragDropEffects.Link)) e.Effect = DragDropEffects.Link; 134 } 135 } 136 protected virtual void defaultValueGroupBox_DragDrop(object sender, DragEventArgs e) { 137 if (e.Effect != DragDropEffects.None) { 138 T value = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as T; 139 if (e.Effect.HasFlag(DragDropEffects.Copy)) value = (T)value.Clone(); 140 Content.DefaultValue = value; 141 } 75 142 } 76 143 }
Note: See TracChangeset
for help on using the changeset viewer.