- Timestamp:
- 01/21/20 17:14:46 (5 years ago)
- Location:
- branches/3026_IntegrationIntoSymSpace
- Files:
-
- 8 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/HeuristicLab.JsonInterface.OptimizerIntegration.csproj
r17404 r17405 50 50 <HintPath>..\bin\HeuristicLab.Collections-3.3.dll</HintPath> 51 51 </Reference> 52 <Reference Include="HeuristicLab.Common.Resources-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 53 <SpecificVersion>False</SpecificVersion> 54 <HintPath>..\bin\HeuristicLab.Common.Resources-3.3.dll</HintPath> 55 </Reference> 52 56 <Reference Include="HeuristicLab.Core.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 53 57 <SpecificVersion>False</SpecificVersion> … … 85 89 <DependentUpon>JsonItemBaseControl.cs</DependentUpon> 86 90 </Compile> 91 <Compile Include="Shared\NumericRangeControl.cs"> 92 <SubType>UserControl</SubType> 93 </Compile> 94 <Compile Include="Shared\NumericRangeControl.Designer.cs"> 95 <DependentUpon>NumericRangeControl.cs</DependentUpon> 96 </Compile> 87 97 <Compile Include="Views\ExportJsonDialog.cs"> 88 98 <SubType>Form</SubType> … … 92 102 </Compile> 93 103 <Compile Include="FileManager.cs" /> 104 <Compile Include="Views\JsonItemArrayControl.cs"> 105 <SubType>UserControl</SubType> 106 </Compile> 107 <Compile Include="Views\JsonItemArrayControl.Designer.cs"> 108 <DependentUpon>JsonItemArrayControl.cs</DependentUpon> 109 </Compile> 94 110 <Compile Include="Views\JsonItemBoolControl.cs"> 95 111 <SubType>UserControl</SubType> … … 97 113 <Compile Include="Views\JsonItemBoolControl.Designer.cs"> 98 114 <DependentUpon>JsonItemBoolControl.cs</DependentUpon> 115 </Compile> 116 <Compile Include="Views\JsonItemDefaultControl.cs"> 117 <SubType>UserControl</SubType> 118 </Compile> 119 <Compile Include="Views\JsonItemDefaultControl.Designer.cs"> 120 <DependentUpon>JsonItemDefaultControl.cs</DependentUpon> 99 121 </Compile> 100 122 <Compile Include="Views\JsonItemRangeControl.cs"> … … 135 157 <Name>HeuristicLab.Core-3.3</Name> 136 158 </ProjectReference> 159 <ProjectReference Include="..\HeuristicLab.Data.Views\3.3\HeuristicLab.Data.Views-3.3.csproj"> 160 <Project>{72104A0B-90E7-42F3-9ABE-9BBBADD4B943}</Project> 161 <Name>HeuristicLab.Data.Views-3.3</Name> 162 </ProjectReference> 137 163 <ProjectReference Include="..\HeuristicLab.JsonInterface\HeuristicLab.JsonInterface.csproj"> 138 164 <Project>{0e3aab5e-f152-44e0-a054-4d9a83ecee08}</Project> … … 168 194 <DependentUpon>JsonItemBaseControl.cs</DependentUpon> 169 195 </EmbeddedResource> 196 <EmbeddedResource Include="Shared\NumericRangeControl.resx"> 197 <DependentUpon>NumericRangeControl.cs</DependentUpon> 198 </EmbeddedResource> 170 199 <EmbeddedResource Include="Views\ExportJsonDialog.resx"> 171 200 <DependentUpon>ExportJsonDialog.cs</DependentUpon> 201 </EmbeddedResource> 202 <EmbeddedResource Include="Views\JsonItemArrayControl.resx"> 203 <DependentUpon>JsonItemArrayControl.cs</DependentUpon> 172 204 </EmbeddedResource> 173 205 <EmbeddedResource Include="Views\JsonItemBoolControl.resx"> -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Shared/JsonItemBaseControl.Designer.cs
r17404 r17405 24 24 /// </summary> 25 25 private void InitializeComponent() { 26 this.label Path= new System.Windows.Forms.Label();26 this.labelEnable = new System.Windows.Forms.Label(); 27 27 this.checkBoxActive = new System.Windows.Forms.CheckBox(); 28 this.panel1 = new System.Windows.Forms.Panel();29 this.label3 = new System.Windows.Forms.Label();30 28 this.textBoxActualName = new System.Windows.Forms.TextBox(); 31 29 this.labelActualName = new System.Windows.Forms.Label(); 32 30 this.textBoxName = new System.Windows.Forms.TextBox(); 33 31 this.label1 = new System.Windows.Forms.Label(); 34 this.panel1.SuspendLayout();35 32 this.SuspendLayout(); 36 33 // 37 // label Path34 // labelEnable 38 35 // 39 this.label Path.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)36 this.labelEnable.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 40 37 | System.Windows.Forms.AnchorStyles.Right))); 41 this.label Path.AutoSize = true;42 this.label Path.Location = new System.Drawing.Point(24, 4);43 this.label Path.Name = "labelPath";44 this.label Path.Size = new System.Drawing.Size(29, 13);45 this.label Path.TabIndex = 3;46 this.label Path.Text = "Path";38 this.labelEnable.AutoSize = true; 39 this.labelEnable.Location = new System.Drawing.Point(6, 3); 40 this.labelEnable.Name = "labelEnable"; 41 this.labelEnable.Size = new System.Drawing.Size(40, 13); 42 this.labelEnable.TabIndex = 3; 43 this.labelEnable.Text = "Enable"; 47 44 // 48 45 // checkBoxActive 49 46 // 50 47 this.checkBoxActive.AutoSize = true; 51 this.checkBoxActive.Location = new System.Drawing.Point( 3, 3);48 this.checkBoxActive.Location = new System.Drawing.Point(92, 3); 52 49 this.checkBoxActive.Name = "checkBoxActive"; 53 50 this.checkBoxActive.Size = new System.Drawing.Size(15, 14); … … 56 53 this.checkBoxActive.CheckedChanged += new System.EventHandler(this.checkBoxActive_CheckedChanged); 57 54 // 58 // panel159 //60 this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)61 | System.Windows.Forms.AnchorStyles.Right)));62 this.panel1.BackColor = System.Drawing.Color.Gray;63 this.panel1.Controls.Add(this.checkBoxActive);64 this.panel1.Controls.Add(this.labelPath);65 this.panel1.Location = new System.Drawing.Point(0, 0);66 this.panel1.Name = "panel1";67 this.panel1.Size = new System.Drawing.Size(501, 20);68 this.panel1.TabIndex = 4;69 //70 // label371 //72 this.label3.AutoSize = true;73 this.label3.Location = new System.Drawing.Point(6, 84);74 this.label3.Name = "label3";75 this.label3.Size = new System.Drawing.Size(34, 13);76 this.label3.TabIndex = 13;77 this.label3.Text = "Value";78 this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;79 //80 55 // textBoxActualName 81 56 // 82 57 this.textBoxActualName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 83 58 | System.Windows.Forms.AnchorStyles.Right))); 84 this.textBoxActualName.Location = new System.Drawing.Point(92, 55);59 this.textBoxActualName.Location = new System.Drawing.Point(92, 49); 85 60 this.textBoxActualName.Name = "textBoxActualName"; 86 this.textBoxActualName.Size = new System.Drawing.Size(40 2, 20);61 this.textBoxActualName.Size = new System.Drawing.Size(404, 20); 87 62 this.textBoxActualName.TabIndex = 12; 88 63 this.textBoxActualName.TextChanged += new System.EventHandler(this.textBoxActualName_TextChanged); … … 91 66 // 92 67 this.labelActualName.AutoSize = true; 93 this.labelActualName.Location = new System.Drawing.Point(6, 5 8);68 this.labelActualName.Location = new System.Drawing.Point(6, 52); 94 69 this.labelActualName.Name = "labelActualName"; 95 70 this.labelActualName.Size = new System.Drawing.Size(65, 13); … … 102 77 this.textBoxName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 103 78 | System.Windows.Forms.AnchorStyles.Right))); 104 this.textBoxName.Location = new System.Drawing.Point(92, 2 9);79 this.textBoxName.Location = new System.Drawing.Point(92, 23); 105 80 this.textBoxName.Name = "textBoxName"; 106 this.textBoxName.Size = new System.Drawing.Size(402, 20); 81 this.textBoxName.ReadOnly = true; 82 this.textBoxName.Size = new System.Drawing.Size(404, 20); 107 83 this.textBoxName.TabIndex = 10; 108 84 this.textBoxName.TextChanged += new System.EventHandler(this.textBoxName_TextChanged); … … 111 87 // 112 88 this.label1.AutoSize = true; 113 this.label1.Location = new System.Drawing.Point(6, 32);89 this.label1.Location = new System.Drawing.Point(6, 26); 114 90 this.label1.Name = "label1"; 115 91 this.label1.Size = new System.Drawing.Size(35, 13); … … 122 98 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 123 99 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 124 this. BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;125 this.Controls.Add(this. label3);100 this.Controls.Add(this.labelEnable); 101 this.Controls.Add(this.checkBoxActive); 126 102 this.Controls.Add(this.textBoxActualName); 127 103 this.Controls.Add(this.labelActualName); 128 104 this.Controls.Add(this.textBoxName); 129 105 this.Controls.Add(this.label1); 130 this.Controls.Add(this.panel1);131 106 this.Name = "JsonItemBaseControl"; 132 107 this.Padding = new System.Windows.Forms.Padding(3); 133 this.Size = new System.Drawing.Size(500, 152); 134 this.panel1.ResumeLayout(false); 135 this.panel1.PerformLayout(); 108 this.Size = new System.Drawing.Size(502, 154); 136 109 this.ResumeLayout(false); 137 110 this.PerformLayout(); … … 141 114 #endregion 142 115 143 private System.Windows.Forms.Label label Path;116 private System.Windows.Forms.Label labelEnable; 144 117 private System.Windows.Forms.CheckBox checkBoxActive; 145 private System.Windows.Forms.Panel panel1;146 private System.Windows.Forms.Label label3;147 118 private System.Windows.Forms.TextBox textBoxActualName; 148 119 private System.Windows.Forms.Label labelActualName; -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Shared/JsonItemBaseControl.cs
r17404 r17405 20 20 InitializeComponent(); 21 21 VM = vm; 22 labelPath.Text = VM.Item.Path;23 22 checkBoxActive.Checked = VM.Selected; 24 23 textBoxName.Text = VM.Item.Name; -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/JsonItemVM.cs
r17404 r17405 7 7 8 8 namespace HeuristicLab.JsonInterface.OptimizerIntegration { 9 public delegate void OnSelectionChangeHandler(JsonItemVM sender, bool selection); 10 public delegate void OnChildAddedHandler(JsonItemVM sender, JsonItemVM child); 11 9 12 public class JsonItemVM { 10 13 public JsonItem Item { get; set; } 11 14 12 public bool Selected { get; set; } = true; 15 private IList<JsonItemVM> children = new List<JsonItemVM>(); 16 public IEnumerable<JsonItemVM> Children { 17 get => children; 18 } 19 20 public JsonItemVM Parent { get; set; } 21 22 private bool selected = true; 23 public bool Selected { 24 get => selected; 25 set { 26 selected = value; 27 OnSelectionChange?.Invoke(this, Selected); 28 } 29 } 30 31 public event OnSelectionChangeHandler OnSelectionChange; 32 public event OnChildAddedHandler OnChildAdded; 13 33 14 34 public JsonItemVM(JsonItem item) { 15 35 this.Item = item; 16 36 } 37 38 public void AddChild(JsonItemVM vm) { 39 children.Add(vm); 40 vm.Parent = this; 41 OnChildAdded?.Invoke(this, vm); 42 } 17 43 } 18 44 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/ExportJsonDialog.Designer.cs
r17404 r17405 27 27 this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); 28 28 this.exportButton = new System.Windows.Forms.Button(); 29 this.tabel = new System.Windows.Forms.TableLayoutPanel(); 29 this.treeView = new System.Windows.Forms.TreeView(); 30 this.groupBoxDetails = new System.Windows.Forms.GroupBox(); 31 this.panel = new System.Windows.Forms.Panel(); 30 32 this.jsonItemBindingSource = new System.Windows.Forms.BindingSource(this.components); 33 this.groupBoxDetails.SuspendLayout(); 31 34 ((System.ComponentModel.ISupportInitialize)(this.jsonItemBindingSource)).BeginInit(); 32 35 this.SuspendLayout(); … … 41 44 // 42 45 this.exportButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 43 this.exportButton.Location = new System.Drawing.Point( 397, 515);46 this.exportButton.Location = new System.Drawing.Point(801, 687); 44 47 this.exportButton.Name = "exportButton"; 45 48 this.exportButton.Size = new System.Drawing.Size(121, 34); … … 49 52 this.exportButton.Click += new System.EventHandler(this.exportButton_Click); 50 53 // 51 // t abel54 // treeView 52 55 // 53 this.tabel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 56 this.treeView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 57 | System.Windows.Forms.AnchorStyles.Left))); 58 this.treeView.Location = new System.Drawing.Point(12, 12); 59 this.treeView.Name = "treeView"; 60 this.treeView.Size = new System.Drawing.Size(342, 669); 61 this.treeView.TabIndex = 3; 62 this.treeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView_AfterSelect); 63 // 64 // groupBoxDetails 65 // 66 this.groupBoxDetails.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 54 67 | System.Windows.Forms.AnchorStyles.Left) 55 68 | System.Windows.Forms.AnchorStyles.Right))); 56 this.tabel.AutoScroll = true; 57 this.tabel.BackColor = System.Drawing.SystemColors.Control; 58 this.tabel.ColumnCount = 1; 59 this.tabel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); 60 this.tabel.Location = new System.Drawing.Point(12, 12); 61 this.tabel.Name = "tabel"; 62 this.tabel.RowCount = 1; 63 this.tabel.RowStyles.Add(new System.Windows.Forms.RowStyle()); 64 this.tabel.Size = new System.Drawing.Size(506, 497); 65 this.tabel.TabIndex = 2; 69 this.groupBoxDetails.Controls.Add(this.panel); 70 this.groupBoxDetails.Location = new System.Drawing.Point(360, 12); 71 this.groupBoxDetails.Name = "groupBoxDetails"; 72 this.groupBoxDetails.Size = new System.Drawing.Size(562, 669); 73 this.groupBoxDetails.TabIndex = 4; 74 this.groupBoxDetails.TabStop = false; 75 this.groupBoxDetails.Text = "Details"; 76 // 77 // panel 78 // 79 this.panel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 80 | System.Windows.Forms.AnchorStyles.Left) 81 | System.Windows.Forms.AnchorStyles.Right))); 82 this.panel.AutoScroll = true; 83 this.panel.Location = new System.Drawing.Point(7, 20); 84 this.panel.Name = "panel"; 85 this.panel.Size = new System.Drawing.Size(549, 643); 86 this.panel.TabIndex = 0; 66 87 // 67 88 // jsonItemBindingSource … … 73 94 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 74 95 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 75 this.ClientSize = new System.Drawing.Size(530, 561); 96 this.ClientSize = new System.Drawing.Size(934, 733); 97 this.Controls.Add(this.groupBoxDetails); 98 this.Controls.Add(this.treeView); 76 99 this.Controls.Add(this.exportButton); 77 this.Controls.Add(this.tabel);78 100 this.Name = "ExportJsonDialog"; 79 101 this.RightToLeft = System.Windows.Forms.RightToLeft.No; 80 102 this.ShowIcon = false; 81 103 this.Text = "Export Json"; 104 this.groupBoxDetails.ResumeLayout(false); 82 105 ((System.ComponentModel.ISupportInitialize)(this.jsonItemBindingSource)).EndInit(); 83 106 this.ResumeLayout(false); … … 91 114 private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn1; 92 115 private System.Windows.Forms.Button exportButton; 93 private System.Windows.Forms.TableLayoutPanel tabel; 116 private System.Windows.Forms.TreeView treeView; 117 private System.Windows.Forms.GroupBox groupBoxDetails; 118 private System.Windows.Forms.Panel panel; 94 119 } 95 120 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/ExportJsonDialog.cs
r17404 r17405 17 17 private IContent content; 18 18 private static SaveFileDialog saveFileDialog; 19 19 private IDictionary<int, UserControl> ctrlCollection = new Dictionary<int, UserControl>(); 20 private JsonItem root; 21 private IOptimizer optimizer; 20 22 private IList<JsonItemVM> vms; 21 23 private JCGenerator generator = new JCGenerator(); … … 25 27 content = value; 26 28 27 IEnumerable<JsonItem> items = generator.FetchJsonItems(content as IOptimizer);29 //IEnumerable<JsonItem> items = generator.FetchJsonItems(content as IOptimizer); 28 30 vms = new List<JsonItemVM>(); 29 t abel.Controls.Clear();31 treeView.Nodes.Clear(); 30 32 31 foreach (var item in items) { 32 if (!(item is UnsupportedJsonItem) && item.Value != null && item.Range != null) { 33 JsonItemVM vm = new JsonItemVM(item); 34 vms.Add(vm); 35 UserControl control = null; 36 if(item.Value is string) { 37 control = new JsonItemValidValuesControl(vm); 38 } else if (item.Value is bool) { 39 control = new JsonItemBoolControl(vm); 40 } else if (item.Value is int) { 41 control = new JsonItemValueControl(vm, false); 42 } else if (item.Value is double) { 43 control = new JsonItemValueControl(vm, true); 44 } else if (item.Value is Array) { 45 if(((Array)item.Value).GetValue(0) is int) 46 control = new JsonItemRangeControl(vm, false); 47 else if (((Array)item.Value).GetValue(0) is double) 48 control = new JsonItemRangeControl(vm, true); 49 } 50 if (control != null) { 51 control.Anchor = AnchorStyles.Left | AnchorStyles.Right; 52 tabel.Controls.Add(control); 53 } 54 } 55 } 33 optimizer = content as IOptimizer; 34 root = JsonItemConverter.Extract(optimizer); 35 TreeNode parent = new TreeNode(root.Name); 36 BuildTreeNode(parent, root); 37 treeView.Nodes.Add(parent); 56 38 } 57 39 } … … 62 44 63 45 private void exportButton_Click(object sender, EventArgs e) { 64 IList<JsonItem> items = new List<JsonItem>();65 66 46 foreach(var x in vms) { 67 if (x.Selected) 68 items.Add(x.Item); 47 if (!x.Selected) { 48 x.Item.Parent.Children.Remove(x.Item); 49 } 69 50 } 70 51 … … 80 61 81 62 if (saveFileDialog.ShowDialog() == DialogResult.OK) { 82 File.WriteAllText(saveFileDialog.FileName, generator.GenerateTemplate( items));63 File.WriteAllText(saveFileDialog.FileName, generator.GenerateTemplate(root, optimizer)); 83 64 } 84 65 85 66 this.Close(); 86 67 } 68 69 private JsonItemVM BuildTreeNode(TreeNode node, JsonItem item) { 70 JsonItemVM vm = new JsonItemVM(item); 71 72 vms.Add(vm); 73 ctrlCollection.Add(node.GetHashCode(), GenerateControl(vm)); 74 if (item.Children != null) { 75 foreach (var c in item.Children) { 76 if (IsDrawableItem(c)) { 77 if (c is ResultItem) { 78 79 } else { 80 TreeNode childNode = new TreeNode(c.Name); 81 node.Nodes.Add(childNode); 82 vm.AddChild(BuildTreeNode(childNode, c)); 83 } 84 } 85 } 86 } 87 88 return vm; 89 } 90 91 private bool IsDrawableItem(JsonItem item) { 92 bool b = false; 93 if (item.Children != null) { 94 foreach (var c in item.Children) { 95 b = b || IsDrawableItem(c); 96 } 97 } 98 99 return b || (item.Value != null || item.Range != null || item.ActualName != null); 100 } 101 102 private void treeView_AfterSelect(object sender, TreeViewEventArgs e) { 103 if(ctrlCollection.TryGetValue(treeView.SelectedNode.GetHashCode(), out UserControl ctrl)) { 104 panel.Controls.Clear(); 105 if (ctrl != null) { 106 panel.Controls.Add(ctrl); 107 } 108 panel.Refresh(); 109 } 110 } 111 112 private UserControl GenerateControl(JsonItemVM vm) { 113 JsonItem item = vm.Item; 114 UserControl control = null; 115 if (!(item is UnsupportedJsonItem)) { 116 if (item.Value is string && item.Range != null) { 117 control = new JsonItemValidValuesControl(vm); 118 } else if (item.Value is bool && item.Range != null) { 119 control = new JsonItemBoolControl(vm); 120 } else if (item.Value is int && item.Range != null) { 121 control = new JsonItemValueControl(vm, false); 122 } else if (item.Value is double && item.Range != null) { 123 control = new JsonItemValueControl(vm, true); 124 } else if (item.Value is Array) { 125 Array arr = (Array)item.Value; 126 if (arr.Length == 2 && arr.GetValue(0) is int && item.Range != null) 127 control = new JsonItemRangeControl(vm, false); 128 else if (arr.Length == 2 && arr.GetValue(0) is double && item.Range != null) 129 control = new JsonItemRangeControl(vm, true); 130 else if (arr.Rank == 1 && arr.GetValue(0) is double) { 131 control = new JsonItemArrayControl(vm); 132 } 133 } else { 134 control = new JsonItemBaseControl(vm); 135 } 136 if (control != null) { 137 control.Dock = DockStyle.Fill; 138 control.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; 139 } 140 } 141 return control; 142 } 87 143 } 88 144 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemBoolControl.Designer.cs
r17404 r17405 25 25 private void InitializeComponent() { 26 26 this.checkBoxValue = new System.Windows.Forms.CheckBox(); 27 this.label2 = new System.Windows.Forms.Label(); 27 28 this.SuspendLayout(); 28 29 // … … 32 33 | System.Windows.Forms.AnchorStyles.Right))); 33 34 this.checkBoxValue.AutoSize = true; 34 this.checkBoxValue.Location = new System.Drawing.Point(92, 84);35 this.checkBoxValue.Location = new System.Drawing.Point(92, 75); 35 36 this.checkBoxValue.Name = "checkBoxValue"; 36 37 this.checkBoxValue.Size = new System.Drawing.Size(15, 14); … … 39 40 this.checkBoxValue.CheckStateChanged += new System.EventHandler(this.checkBoxValue_CheckStateChanged); 40 41 // 42 // label2 43 // 44 this.label2.AutoSize = true; 45 this.label2.Location = new System.Drawing.Point(6, 75); 46 this.label2.Name = "label2"; 47 this.label2.Size = new System.Drawing.Size(34, 13); 48 this.label2.TabIndex = 20; 49 this.label2.Text = "Value"; 50 // 41 51 // JsonItemBoolControl 42 52 // … … 44 54 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 45 55 this.BackColor = System.Drawing.SystemColors.Control; 56 this.Controls.Add(this.label2); 46 57 this.Controls.Add(this.checkBoxValue); 47 58 this.Name = "JsonItemBoolControl"; 48 59 this.Size = new System.Drawing.Size(500, 105); 49 60 this.Controls.SetChildIndex(this.checkBoxValue, 0); 61 this.Controls.SetChildIndex(this.label2, 0); 50 62 this.ResumeLayout(false); 51 63 this.PerformLayout(); … … 55 67 #endregion 56 68 private System.Windows.Forms.CheckBox checkBoxValue; 69 private System.Windows.Forms.Label label2; 57 70 } 58 71 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemRangeControl.Designer.cs
r17404 r17405 29 29 this.label4 = new System.Windows.Forms.Label(); 30 30 this.label2 = new System.Windows.Forms.Label(); 31 this.textBoxRangeTo = new System.Windows.Forms.TextBox(); 32 this.textBoxRangeFrom = new System.Windows.Forms.TextBox(); 33 this.label5 = new System.Windows.Forms.Label(); 34 this.label6 = new System.Windows.Forms.Label(); 35 this.groupBox2 = new System.Windows.Forms.GroupBox(); 31 this.numericRangeControl1 = new HeuristicLab.JsonInterface.OptimizerIntegration.Shared.NumericRangeControl(); 36 32 this.groupBox1.SuspendLayout(); 37 this.groupBox2.SuspendLayout();38 33 this.SuspendLayout(); 39 34 // … … 46 41 this.groupBox1.Controls.Add(this.label4); 47 42 this.groupBox1.Controls.Add(this.label2); 48 this.groupBox1.Location = new System.Drawing.Point(9, 81);43 this.groupBox1.Location = new System.Drawing.Point(9, 75); 49 44 this.groupBox1.Name = "groupBox1"; 50 45 this.groupBox1.Size = new System.Drawing.Size(487, 64); … … 93 88 this.label2.Text = "From"; 94 89 // 95 // textBoxRangeTo90 // numericRangeControl1 96 91 // 97 this.textBoxRangeTo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 98 | System.Windows.Forms.AnchorStyles.Right))); 99 this.textBoxRangeTo.Location = new System.Drawing.Point(249, 36); 100 this.textBoxRangeTo.Name = "textBoxRangeTo"; 101 this.textBoxRangeTo.Size = new System.Drawing.Size(230, 20); 102 this.textBoxRangeTo.TabIndex = 3; 103 this.textBoxRangeTo.Leave += new System.EventHandler(this.textBoxRangeTo_Leave); 104 // 105 // textBoxRangeFrom 106 // 107 this.textBoxRangeFrom.Location = new System.Drawing.Point(10, 36); 108 this.textBoxRangeFrom.Name = "textBoxRangeFrom"; 109 this.textBoxRangeFrom.Size = new System.Drawing.Size(230, 20); 110 this.textBoxRangeFrom.TabIndex = 2; 111 this.textBoxRangeFrom.Leave += new System.EventHandler(this.textBoxRangeFrom_Leave); 112 // 113 // label5 114 // 115 this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 116 | System.Windows.Forms.AnchorStyles.Right))); 117 this.label5.AutoSize = true; 118 this.label5.Location = new System.Drawing.Point(246, 20); 119 this.label5.Name = "label5"; 120 this.label5.Size = new System.Drawing.Size(20, 13); 121 this.label5.TabIndex = 1; 122 this.label5.Text = "To"; 123 // 124 // label6 125 // 126 this.label6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 127 | System.Windows.Forms.AnchorStyles.Right))); 128 this.label6.AutoSize = true; 129 this.label6.Location = new System.Drawing.Point(7, 20); 130 this.label6.Name = "label6"; 131 this.label6.Size = new System.Drawing.Size(30, 13); 132 this.label6.TabIndex = 0; 133 this.label6.Text = "From"; 134 // 135 // groupBox2 136 // 137 this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 138 | System.Windows.Forms.AnchorStyles.Right))); 139 this.groupBox2.Controls.Add(this.textBoxRangeTo); 140 this.groupBox2.Controls.Add(this.textBoxRangeFrom); 141 this.groupBox2.Controls.Add(this.label5); 142 this.groupBox2.Controls.Add(this.label6); 143 this.groupBox2.Location = new System.Drawing.Point(9, 151); 144 this.groupBox2.Name = "groupBox2"; 145 this.groupBox2.Size = new System.Drawing.Size(487, 64); 146 this.groupBox2.TabIndex = 18; 147 this.groupBox2.TabStop = false; 148 this.groupBox2.Text = "Range"; 92 this.numericRangeControl1.Location = new System.Drawing.Point(9, 145); 93 this.numericRangeControl1.Name = "numericRangeControl1"; 94 this.numericRangeControl1.Size = new System.Drawing.Size(487, 112); 95 this.numericRangeControl1.TabIndex = 18; 96 this.numericRangeControl1.Load += new System.EventHandler(this.numericRangeControl1_Load); 149 97 // 150 98 // JsonItemRangeControl … … 152 100 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 153 101 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 154 this.Controls.Add(this. groupBox2);102 this.Controls.Add(this.numericRangeControl1); 155 103 this.Controls.Add(this.groupBox1); 156 104 this.Name = "JsonItemRangeControl"; 157 this.Size = new System.Drawing.Size(500, 2 20);105 this.Size = new System.Drawing.Size(500, 262); 158 106 this.Controls.SetChildIndex(this.groupBox1, 0); 159 this.Controls.SetChildIndex(this. groupBox2, 0);107 this.Controls.SetChildIndex(this.numericRangeControl1, 0); 160 108 this.groupBox1.ResumeLayout(false); 161 109 this.groupBox1.PerformLayout(); 162 this.groupBox2.ResumeLayout(false);163 this.groupBox2.PerformLayout();164 110 this.ResumeLayout(false); 165 111 this.PerformLayout(); … … 174 120 private System.Windows.Forms.Label label4; 175 121 private System.Windows.Forms.Label label2; 176 private System.Windows.Forms.TextBox textBoxRangeTo; 177 private System.Windows.Forms.TextBox textBoxRangeFrom; 178 private System.Windows.Forms.Label label5; 179 private System.Windows.Forms.Label label6; 180 private System.Windows.Forms.GroupBox groupBox2; 122 private Shared.NumericRangeControl numericRangeControl1; 181 123 } 182 124 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemRangeControl.cs
r17404 r17405 35 35 36 36 private void SetValue() { 37 if (!string.IsNullOrWhiteSpace(textBox RangeFrom.Text))37 if (!string.IsNullOrWhiteSpace(textBoxValueFrom.Text)) 38 38 value[0] = Parse(textBoxValueFrom.Text); 39 39 else 40 40 value[0] = ((Array)VM.Item.Value).GetValue(0); 41 41 42 if (!string.IsNullOrWhiteSpace(textBox RangeTo.Text))42 if (!string.IsNullOrWhiteSpace(textBoxValueTo.Text)) 43 43 value[1] = Parse(textBoxValueTo.Text); 44 44 else … … 46 46 VM.Item.Value = value; 47 47 } 48 49 private void SetRange() { 50 if (!string.IsNullOrWhiteSpace(textBoxRangeFrom.Text)) 51 range[0] = Parse(textBoxRangeFrom.Text); 52 else 53 range[0] = VM.Item.Range.First(); 54 55 if (!string.IsNullOrWhiteSpace(textBoxRangeTo.Text)) 56 range[1] = Parse(textBoxRangeTo.Text); 57 else 58 range[1] = VM.Item.Range.Last(); 59 VM.Item.Range = range; 60 } 61 48 62 49 private void textBoxValueFrom_Leave(object sender, EventArgs e) { 63 50 SetValue(); … … 68 55 } 69 56 70 private void textBoxRangeFrom_Leave(object sender, EventArgs e) { 71 SetRange(); 72 } 73 74 private void textBoxRangeTo_Leave(object sender, EventArgs e) { 75 SetRange(); 57 private void numericRangeControl1_Load(object sender, EventArgs e) { 58 numericRangeControl1.IsDouble = isDouble; 59 numericRangeControl1.VM = VM; 76 60 } 77 61 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemValidValuesControl.Designer.cs
r17404 r17405 24 24 /// </summary> 25 25 private void InitializeComponent() { 26 this.textBoxAdd = new System.Windows.Forms.TextBox();27 26 this.tableOptions = new System.Windows.Forms.TableLayoutPanel(); 28 this.buttonAdd = new System.Windows.Forms.Button(); 29 this.groupBox1 = new System.Windows.Forms.GroupBox(); 30 this.panel2 = new System.Windows.Forms.Panel(); 27 this.groupBoxRange = new System.Windows.Forms.GroupBox(); 31 28 this.comboBoxValues = new System.Windows.Forms.ComboBox(); 32 this.tableOptions.SuspendLayout(); 33 this.groupBox1.SuspendLayout(); 34 this.panel2.SuspendLayout(); 29 this.label2 = new System.Windows.Forms.Label(); 30 this.groupBoxRange.SuspendLayout(); 35 31 this.SuspendLayout(); 36 //37 // textBoxAdd38 //39 this.textBoxAdd.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)40 | System.Windows.Forms.AnchorStyles.Right)));41 this.textBoxAdd.Location = new System.Drawing.Point(3, 3);42 this.textBoxAdd.Name = "textBoxAdd";43 this.textBoxAdd.Size = new System.Drawing.Size(420, 20);44 this.textBoxAdd.TabIndex = 10;45 32 // 46 33 // tableOptions 47 34 // 48 this.tableOptions.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 35 this.tableOptions.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 36 | System.Windows.Forms.AnchorStyles.Left) 49 37 | System.Windows.Forms.AnchorStyles.Right))); 50 38 this.tableOptions.AutoSize = true; 51 39 this.tableOptions.ColumnCount = 2; 40 this.tableOptions.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); 52 41 this.tableOptions.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); 53 this.tableOptions.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 43F)); 54 this.tableOptions.Controls.Add(this.textBoxAdd, 0, 0); 55 this.tableOptions.Controls.Add(this.buttonAdd, 1, 0); 56 this.tableOptions.Location = new System.Drawing.Point(3, 3); 42 this.tableOptions.Location = new System.Drawing.Point(6, 19); 57 43 this.tableOptions.Name = "tableOptions"; 58 44 this.tableOptions.RowCount = 1; 59 45 this.tableOptions.RowStyles.Add(new System.Windows.Forms.RowStyle()); 60 this.tableOptions.Size = new System.Drawing.Size(4 69, 73);46 this.tableOptions.Size = new System.Drawing.Size(478, 151); 61 47 this.tableOptions.TabIndex = 12; 62 48 // 63 // buttonAdd49 // groupBoxRange 64 50 // 65 this.buttonAdd.Location = new System.Drawing.Point(446, 3); 66 this.buttonAdd.Name = "buttonAdd"; 67 this.buttonAdd.Size = new System.Drawing.Size(20, 20); 68 this.buttonAdd.TabIndex = 12; 69 this.buttonAdd.Text = "+"; 70 this.buttonAdd.UseVisualStyleBackColor = true; 71 this.buttonAdd.Click += new System.EventHandler(this.buttonAdd_Click); 72 // 73 // groupBox1 74 // 75 this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 76 | System.Windows.Forms.AnchorStyles.Right))); 77 this.groupBox1.Controls.Add(this.panel2); 78 this.groupBox1.Location = new System.Drawing.Point(6, 107); 79 this.groupBox1.Name = "groupBox1"; 80 this.groupBox1.Size = new System.Drawing.Size(488, 104); 81 this.groupBox1.TabIndex = 14; 82 this.groupBox1.TabStop = false; 83 this.groupBox1.Text = "Range"; 84 // 85 // panel2 86 // 87 this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 51 this.groupBoxRange.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 88 52 | System.Windows.Forms.AnchorStyles.Left) 89 53 | System.Windows.Forms.AnchorStyles.Right))); 90 this.panel2.AutoScroll = true; 91 this.panel2.Controls.Add(this.tableOptions); 92 this.panel2.Location = new System.Drawing.Point(7, 20); 93 this.panel2.Name = "panel2"; 94 this.panel2.Size = new System.Drawing.Size(475, 78); 95 this.panel2.TabIndex = 0; 54 this.groupBoxRange.AutoSize = true; 55 this.groupBoxRange.Controls.Add(this.tableOptions); 56 this.groupBoxRange.Location = new System.Drawing.Point(6, 108); 57 this.groupBoxRange.Name = "groupBoxRange"; 58 this.groupBoxRange.Size = new System.Drawing.Size(490, 176); 59 this.groupBoxRange.TabIndex = 14; 60 this.groupBoxRange.TabStop = false; 61 this.groupBoxRange.Text = "Range"; 96 62 // 97 63 // comboBoxValues … … 101 67 this.comboBoxValues.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 102 68 this.comboBoxValues.FormattingEnabled = true; 103 this.comboBoxValues.Location = new System.Drawing.Point(92, 81);69 this.comboBoxValues.Location = new System.Drawing.Point(92, 75); 104 70 this.comboBoxValues.Name = "comboBoxValues"; 105 this.comboBoxValues.Size = new System.Drawing.Size(40 2, 21);71 this.comboBoxValues.Size = new System.Drawing.Size(404, 21); 106 72 this.comboBoxValues.TabIndex = 15; 73 // 74 // label2 75 // 76 this.label2.AutoSize = true; 77 this.label2.Location = new System.Drawing.Point(6, 78); 78 this.label2.Name = "label2"; 79 this.label2.Size = new System.Drawing.Size(34, 13); 80 this.label2.TabIndex = 16; 81 this.label2.Text = "Value"; 107 82 // 108 83 // JsonItemValidValuesControl … … 110 85 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 111 86 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 87 this.AutoSize = true; 88 this.Controls.Add(this.label2); 112 89 this.Controls.Add(this.comboBoxValues); 113 this.Controls.Add(this.groupBox 1);90 this.Controls.Add(this.groupBoxRange); 114 91 this.ForeColor = System.Drawing.Color.Black; 115 92 this.Name = "JsonItemValidValuesControl"; 116 this.Size = new System.Drawing.Size(500, 2 17);93 this.Size = new System.Drawing.Size(500, 290); 117 94 this.Load += new System.EventHandler(this.JsonItemValidValuesControl_Load); 118 this.Controls.SetChildIndex(this.groupBox 1, 0);95 this.Controls.SetChildIndex(this.groupBoxRange, 0); 119 96 this.Controls.SetChildIndex(this.comboBoxValues, 0); 120 this.tableOptions.ResumeLayout(false); 121 this.tableOptions.PerformLayout(); 122 this.groupBox1.ResumeLayout(false); 123 this.panel2.ResumeLayout(false); 124 this.panel2.PerformLayout(); 97 this.Controls.SetChildIndex(this.label2, 0); 98 this.groupBoxRange.ResumeLayout(false); 99 this.groupBoxRange.PerformLayout(); 125 100 this.ResumeLayout(false); 126 101 this.PerformLayout(); … … 129 104 130 105 #endregion 131 private System.Windows.Forms.TextBox textBoxAdd;132 private System.Windows.Forms.Button buttonAdd;133 106 private System.Windows.Forms.TableLayoutPanel tableOptions; 134 private System.Windows.Forms.GroupBox groupBox1; 135 private System.Windows.Forms.Panel panel2; 107 private System.Windows.Forms.GroupBox groupBoxRange; 136 108 private System.Windows.Forms.ComboBox comboBoxValues; 109 private System.Windows.Forms.Label label2; 137 110 } 138 111 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemValidValuesControl.cs
r17404 r17405 21 21 } 22 22 } 23 23 24 } 24 25 25 26 private void AddOption(string opt) { 26 comboBoxValues.Items.Add(opt);27 AddComboOption(opt); 27 28 TextBox tb = new TextBox(); 28 29 tb.Text = opt; … … 30 31 tb.Size = new Size(420, 20); 31 32 tb.ReadOnly = true; 32 Button btn = new Button(); 33 btn.Text = "-"; 34 btn.Size = new Size(20, 20); 35 btn.Click += (o, args) => { 36 tableOptions.Controls.Remove(tb); 37 tableOptions.Controls.Remove(btn); 38 comboBoxValues.Items.Remove(tb.Text); 39 IList<string> items = new List<string>(); 40 foreach(var i in comboBoxValues.Items) { 41 items.Add((string)i); 42 } 43 VM.Item.Range = items; 44 tableOptions.Refresh(); 33 34 CheckBox checkBox = new CheckBox(); 35 checkBox.Checked = true; 36 37 checkBox.CheckStateChanged += (o, args) => { 38 if (checkBox.Checked) 39 AddComboOption(opt); 40 else 41 RemoveComboOption(opt); 45 42 }; 43 tableOptions.Controls.Add(checkBox); 46 44 tableOptions.Controls.Add(tb); 47 tableOptions.Controls.Add(btn);48 45 } 49 46 50 private void buttonAdd_Click(object sender, EventArgs e) { 51 string newOption = textBoxAdd.Text; 52 if (string.IsNullOrWhiteSpace(newOption)) return; 53 textBoxAdd.Text = ""; 54 AddOption(newOption); 47 private void AddComboOption(string opt) { 48 comboBoxValues.Items.Add(opt); 49 IList<string> items = new List<string>(); 50 foreach (var i in comboBoxValues.Items) { 51 items.Add((string)i); 52 } 53 VM.Item.Range = items; 54 tableOptions.Refresh(); 55 55 } 56 56 57 private void RemoveComboOption(string opt) { 58 comboBoxValues.Items.Remove(opt); 59 IList<string> items = new List<string>(); 60 foreach (var i in comboBoxValues.Items) { 61 items.Add((string)i); 62 } 63 VM.Item.Range = items; 64 tableOptions.Refresh(); 65 } 66 57 67 private void comboBoxValues_SelectedValueChanged(object sender, EventArgs e) { 58 68 VM.Item.Value = (string)comboBoxValues.SelectedItem; -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemValueControl.Designer.cs
r17404 r17405 25 25 private void InitializeComponent() { 26 26 this.textBoxValue = new System.Windows.Forms.TextBox(); 27 this.groupBox1 = new System.Windows.Forms.GroupBox();28 this.textBoxTo = new System.Windows.Forms.TextBox();29 this.textBoxFrom = new System.Windows.Forms.TextBox();30 this.label4 = new System.Windows.Forms.Label();31 27 this.label2 = new System.Windows.Forms.Label(); 32 this. groupBox1.SuspendLayout();28 this.numericRangeControl1 = new HeuristicLab.JsonInterface.OptimizerIntegration.Shared.NumericRangeControl(); 33 29 this.SuspendLayout(); 34 30 // … … 37 33 this.textBoxValue.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 38 34 | System.Windows.Forms.AnchorStyles.Right))); 39 this.textBoxValue.Location = new System.Drawing.Point(92, 81);35 this.textBoxValue.Location = new System.Drawing.Point(92, 75); 40 36 this.textBoxValue.Name = "textBoxValue"; 41 this.textBoxValue.Size = new System.Drawing.Size(40 2, 20);37 this.textBoxValue.Size = new System.Drawing.Size(404, 20); 42 38 this.textBoxValue.TabIndex = 14; 43 39 this.textBoxValue.Leave += new System.EventHandler(this.textBoxValue_Leave); 44 40 // 45 // groupBox146 //47 this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)48 | System.Windows.Forms.AnchorStyles.Right)));49 this.groupBox1.Controls.Add(this.textBoxTo);50 this.groupBox1.Controls.Add(this.textBoxFrom);51 this.groupBox1.Controls.Add(this.label4);52 this.groupBox1.Controls.Add(this.label2);53 this.groupBox1.Location = new System.Drawing.Point(9, 107);54 this.groupBox1.Name = "groupBox1";55 this.groupBox1.Size = new System.Drawing.Size(487, 64);56 this.groupBox1.TabIndex = 15;57 this.groupBox1.TabStop = false;58 this.groupBox1.Text = "Range";59 //60 // textBoxTo61 //62 this.textBoxTo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)63 | System.Windows.Forms.AnchorStyles.Right)));64 this.textBoxTo.Location = new System.Drawing.Point(249, 36);65 this.textBoxTo.Name = "textBoxTo";66 this.textBoxTo.Size = new System.Drawing.Size(230, 20);67 this.textBoxTo.TabIndex = 3;68 this.textBoxTo.Leave += new System.EventHandler(this.textBoxTo_Leave);69 //70 // textBoxFrom71 //72 this.textBoxFrom.Location = new System.Drawing.Point(10, 36);73 this.textBoxFrom.Name = "textBoxFrom";74 this.textBoxFrom.Size = new System.Drawing.Size(230, 20);75 this.textBoxFrom.TabIndex = 2;76 this.textBoxFrom.Leave += new System.EventHandler(this.textBoxFrom_Leave);77 //78 // label479 //80 this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)81 | System.Windows.Forms.AnchorStyles.Right)));82 this.label4.AutoSize = true;83 this.label4.Location = new System.Drawing.Point(246, 20);84 this.label4.Name = "label4";85 this.label4.Size = new System.Drawing.Size(20, 13);86 this.label4.TabIndex = 1;87 this.label4.Text = "To";88 //89 41 // label2 90 42 // 91 this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)92 | System.Windows.Forms.AnchorStyles.Right)));93 43 this.label2.AutoSize = true; 94 this.label2.Location = new System.Drawing.Point( 7, 20);44 this.label2.Location = new System.Drawing.Point(6, 78); 95 45 this.label2.Name = "label2"; 96 this.label2.Size = new System.Drawing.Size(30, 13); 97 this.label2.TabIndex = 0; 98 this.label2.Text = "From"; 46 this.label2.Size = new System.Drawing.Size(34, 13); 47 this.label2.TabIndex = 15; 48 this.label2.Text = "Value"; 49 // 50 // numericRangeControl1 51 // 52 this.numericRangeControl1.IsDouble = false; 53 this.numericRangeControl1.Location = new System.Drawing.Point(9, 101); 54 this.numericRangeControl1.Name = "numericRangeControl1"; 55 this.numericRangeControl1.Size = new System.Drawing.Size(487, 112); 56 this.numericRangeControl1.TabIndex = 16; 57 this.numericRangeControl1.VM = null; 58 this.numericRangeControl1.Load += new System.EventHandler(this.numericRangeControl1_Load); 99 59 // 100 60 // JsonItemValueControl … … 102 62 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 103 63 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 104 this.Controls.Add(this.groupBox1); 64 this.Controls.Add(this.numericRangeControl1); 65 this.Controls.Add(this.label2); 105 66 this.Controls.Add(this.textBoxValue); 106 67 this.Name = "JsonItemValueControl"; 107 this.Size = new System.Drawing.Size(500, 177);68 this.Size = new System.Drawing.Size(500, 220); 108 69 this.Controls.SetChildIndex(this.textBoxValue, 0); 109 this.Controls.SetChildIndex(this.groupBox1, 0); 110 this.groupBox1.ResumeLayout(false); 111 this.groupBox1.PerformLayout(); 70 this.Controls.SetChildIndex(this.label2, 0); 71 this.Controls.SetChildIndex(this.numericRangeControl1, 0); 112 72 this.ResumeLayout(false); 113 73 this.PerformLayout(); … … 118 78 119 79 private System.Windows.Forms.TextBox textBoxValue; 120 private System.Windows.Forms.GroupBox groupBox1;121 private System.Windows.Forms.TextBox textBoxTo;122 private System.Windows.Forms.TextBox textBoxFrom;123 private System.Windows.Forms.Label label4;124 80 private System.Windows.Forms.Label label2; 81 private Shared.NumericRangeControl numericRangeControl1; 125 82 } 126 83 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemValueControl.cs
r17404 r17405 19 19 this.isDouble = isDouble; 20 20 textBoxValue.Text = VM.Item.Value.ToString(); 21 textBoxFrom.Text = VM.Item.Range.First().ToString();22 textBoxTo.Text = VM.Item.Range.Last().ToString();23 21 range[0] = VM.Item.Range.First(); 24 22 range[1] = VM.Item.Range.Last(); … … 27 25 private object Parse(string s) { 28 26 if (isDouble) { 29 if (s == "-1,79769313486232E+308") return double.MinValue;30 if (s == "1,79769313486232E+308") return double.MaxValue;31 27 return double.Parse(s.Replace(",", "."), NumberStyles.Any, CultureInfo.InvariantCulture); 32 28 } … … 34 30 } 35 31 36 private void SetRange() {37 if (!string.IsNullOrWhiteSpace(textBoxFrom.Text))38 range[0] = Parse(textBoxFrom.Text);39 else40 range[0] = VM.Item.Range.First();41 42 if (!string.IsNullOrWhiteSpace(textBoxTo.Text))43 range[1] = Parse(textBoxTo.Text);44 else45 range[1] = VM.Item.Range.Last();46 VM.Item.Range = range;47 }48 49 private void textBoxTo_Leave(object sender, EventArgs e) {50 SetRange();51 }52 53 private void textBoxFrom_Leave(object sender, EventArgs e) {54 SetRange();55 }56 32 57 33 private void textBoxValue_Leave(object sender, EventArgs e) { … … 59 35 VM.Item.Value = Parse(textBoxValue.Text); 60 36 } 37 38 private void numericRangeControl1_Load(object sender, EventArgs e) { 39 numericRangeControl1.IsDouble = isDouble; 40 numericRangeControl1.VM = VM; 41 } 61 42 } 62 43 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Constants.cs
r17395 r17405 16 16 internal const string HLFileLocation = "HLFileLocation"; 17 17 internal const string Parameters = "Parameters"; 18 internal const string ActivatedResults = "ActivatedResults"; 18 19 19 20 internal const string Template = @"{ … … 23 24 '" + HLFileLocation + @"':'' 24 25 }, 25 '" + Parameters + @"': [] 26 '" + Parameters + @"': [], 27 '" + ActivatedResults + @"': [] 26 28 }"; 27 29 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/AlgorithmConverter.cs
r17395 r17405 24 24 base.Populate(value, item, root); 25 25 IAlgorithm algorithm = value as IAlgorithm; 26 foreach(var res in algorithm.Results) { 27 item.AddChilds(new ResultItem() { 28 Name = res.Name, 29 Value = true, 30 Range = new object[] { true, false } 31 }); 32 } 26 33 item.AddChilds(root.Extract(algorithm.Problem, root)); 27 34 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/HeuristicLab.JsonInterface.csproj
r17395 r17405 66 66 <Compile Include="Converters\ValueLookupParameterConverter.cs" /> 67 67 <Compile Include="Converters\ValueRangeConverter.cs" /> 68 <Compile Include="ResultItem.cs" /> 68 69 <Compile Include="SingleLineArrayJsonWriter.cs" /> 69 70 <Compile Include="Extensions\TypeExtensions.cs" /> -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JCGenerator.cs
r17404 r17405 20 20 private IOptimizer Optimizer { get; set; } 21 21 22 22 23 public string GenerateTemplate(IOptimizer optimizer) { 23 24 // data container … … 33 34 // which have parameters aswell 34 35 AddIItem(optimizer); 35 36 36 // save the JArray with JsonItems (= IParameterizedItems) 37 37 Template[Constants.Parameters] = JArrayItems; … … 45 45 Template[Constants.Metadata][Constants.HLFileLocation] = @"C:\Workspace\template.hl"; 46 46 47 JArray ResultItems = new JArray(); 48 47 49 JArrayItems = new JArray(); 48 50 foreach (var item in items) { 49 JArrayItems.Add(Serialize(item)); 51 if (item is ResultItem) 52 ResultItems.Add(Serialize(item)); 53 else 54 JArrayItems.Add(Serialize(item)); 50 55 } 51 56 Template[Constants.Parameters] = JArrayItems; 57 Template[Constants.ActivatedResults] = ResultItems; 58 59 // serialize template and return string 60 return SingleLineArrayJsonWriter.Serialize(Template); 61 } 62 63 public string GenerateTemplate(JsonItem rootItem, IOptimizer optimizer) { 64 // data container 65 Template = JObject.Parse(Constants.Template); 66 JsonItems = new List<JsonItem>(); 67 68 // extract JsonItem, save the name in the metadata section of the 69 // template and save it an JArray incl. all parameters of the JsonItem, 70 // which have parameters aswell 71 Template[Constants.Metadata][Constants.Optimizer] = optimizer.Name; 72 PopulateJsonItems(rootItem); 73 74 ProtoBufSerializer serializer = new ProtoBufSerializer(); 75 serializer.Serialize(Optimizer, @"C:\Workspace\template.hl"); 76 Template[Constants.Metadata][Constants.HLFileLocation] = @"C:\Workspace\template.hl"; 77 78 JArray ResultItems = new JArray(); 79 80 JArrayItems = new JArray(); 81 foreach (var item in JsonItems) { 82 if (item is ResultItem) 83 ResultItems.Add(Serialize(item)); 84 else 85 JArrayItems.Add(Serialize(item)); 86 } 87 Template[Constants.Parameters] = JArrayItems; 88 Template[Constants.ActivatedResults] = ResultItems; 52 89 53 90 // serialize template and return string … … 81 118 private void PopulateJsonItems(JsonItem item) { 82 119 IEnumerable<JsonItem> tmpParameter = item.Children; 83 84 if (item.Value != null || item.Range != null ) {120 121 if (item.Value != null || item.Range != null || item is ResultItem || item.ActualName != null) { 85 122 JsonItems.Add(item); 86 123 }
Note: See TracChangeset
for help on using the changeset viewer.